* [dpdk-dev] [RFC 00/14] prefix network structures @ 2018-10-24 8:18 Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 01/14] net: add rte prefix to arp structures Olivier Matz ` (20 more replies) 0 siblings, 21 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev This RFC targets 19.02. The rte_net headers conflict with the libc headers, because some definitions are duplicated, sometimes with few differences. This was discussed in [1], and more recently at the techboard. Before sending the deprecation notice (target for this is 18.11), here is a draft that can be discussed. This RFC adds the rte_ (or RTE_) prefix to all structures, functions and defines in rte_net library. This is a big changeset, that will break the API of many functions, but not the ABI. One question I'm asking is how can we manage the transition. Initially, I hoped it was possible to have a compat layer during one release (supporting both prefixed and unprefixed names), but now that the patch is done, it seems the impact is too big, and impacts too many libraries. Few examples: - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) - many rte_flow structures use the rte_ prefixed net structures - the mac field of virtio_net structure is rte_ether_addr - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) ... Therefore, it is clear that doing this would break the compilation of many external applications. Another drawback we need to take in account: it will make the backport of patches more difficult, although this is something that could be tempered by a script. While it is obviously better to have a good namespace convention, we need to identify the issues we have today before deciding it's worth doing the change. Comments? Things that are missing in RFC: - test with FreeBSD - manually fix some indentation issues Olivier Matz (14): net: add rte prefix to arp structures net: add rte prefix to arp defines net: add rte prefix to ether structures net: add rte prefix to ether functions net: add rte prefix to ether defines net: add rte prefix to esp structure net: add rte prefix to gre structure net: add rte prefix to icmp structure net: add rte prefix to icmp defines net: add rte prefix to ip structure net: add rte prefix to ip defines net: add rte prefix to sctp structure net: add rte prefix to tcp structure net: add rte prefix to udp structure app/pdump/main.c | 2 +- app/test-eventdev/test_perf_common.c | 2 +- app/test-eventdev/test_pipeline_common.c | 2 +- app/test-pmd/cmdline.c | 66 ++--- app/test-pmd/cmdline_flow.c | 10 +- app/test-pmd/config.c | 34 +-- app/test-pmd/csumonly.c | 156 +++++----- app/test-pmd/flowgen.c | 30 +- app/test-pmd/icmpecho.c | 120 ++++---- app/test-pmd/ieee1588fwd.c | 18 +- app/test-pmd/macfwd.c | 12 +- app/test-pmd/macswap.c | 16 +- app/test-pmd/parameters.c | 6 +- app/test-pmd/testpmd.c | 22 +- app/test-pmd/testpmd.h | 18 +- app/test-pmd/txonly.c | 36 +-- app/test-pmd/util.c | 34 +-- doc/guides/prog_guide/bbdev.rst | 6 +- .../prog_guide/packet_classif_access_ctrl.rst | 18 +- doc/guides/prog_guide/rte_flow.rst | 4 +- doc/guides/sample_app_ug/flow_classify.rst | 28 +- doc/guides/sample_app_ug/flow_filtering.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- doc/guides/sample_app_ug/l3_forward.rst | 12 +- doc/guides/sample_app_ug/link_status_intr.rst | 6 +- doc/guides/sample_app_ug/ptpclient.rst | 6 +- doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- doc/guides/sample_app_ug/server_node_efd.rst | 12 +- doc/guides/sample_app_ug/skeleton.rst | 4 +- doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/base/fman/fman_hw.c | 2 +- drivers/bus/dpaa/include/fman.h | 2 +- drivers/bus/dpaa/include/netcfg.h | 4 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/ark/ark_ethdev.c | 16 +- drivers/net/ark/ark_ext.h | 4 +- drivers/net/ark/ark_global.h | 4 +- drivers/net/atlantic/atl_ethdev.c | 20 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- drivers/net/avf/avf.h | 4 +- drivers/net/avf/avf_ethdev.c | 50 ++-- drivers/net/avf/avf_rxtx.c | 14 +- drivers/net/avf/avf_vchnl.c | 8 +- drivers/net/avf/base/avf_adminq_cmd.h | 4 +- drivers/net/avf/base/avf_common.c | 12 +- drivers/net/avf/base/avf_prototype.h | 4 +- drivers/net/avp/avp_ethdev.c | 20 +- drivers/net/avp/rte_avp_common.h | 2 +- drivers/net/axgbe/axgbe_dev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 10 +- drivers/net/axgbe/axgbe_ethdev.h | 4 +- drivers/net/axgbe/axgbe_rxtx.c | 2 +- drivers/net/bnx2x/bnx2x.c | 16 +- drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- drivers/net/bnx2x/ecore_sp.h | 2 +- drivers/net/bnxt/bnxt.h | 4 +- drivers/net/bnxt/bnxt_ethdev.c | 70 ++--- drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 +- drivers/net/bnxt/bnxt_flow.c | 26 +- drivers/net/bnxt/bnxt_hwrm.c | 40 +-- drivers/net/bnxt/bnxt_hwrm.h | 2 +- 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 | 14 +- drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- drivers/net/bonding/rte_eth_bond.h | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 26 +- drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- drivers/net/bonding/rte_eth_bond_alb.c | 78 ++--- drivers/net/bonding/rte_eth_bond_alb.h | 10 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_args.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 194 ++++++------- drivers/net/bonding/rte_eth_bond_private.h | 6 +- drivers/net/cxgbe/base/adapter.h | 6 +- drivers/net/cxgbe/base/t4_hw.c | 8 +- drivers/net/cxgbe/cxgbe.h | 4 +- drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 10 +- drivers/net/cxgbe/cxgbe_main.c | 4 +- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- 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 | 20 +- drivers/net/dpaa/dpaa_rxtx.c | 22 +- drivers/net/dpaa2/dpaa2_ethdev.c | 36 +-- drivers/net/e1000/e1000_ethdev.h | 2 +- drivers/net/e1000/em_ethdev.c | 34 +-- drivers/net/e1000/em_rxtx.c | 22 +- drivers/net/e1000/igb_ethdev.c | 70 ++--- drivers/net/e1000/igb_flow.c | 12 +- drivers/net/e1000/igb_pf.c | 16 +- drivers/net/e1000/igb_rxtx.c | 18 +- drivers/net/ena/ena_ethdev.c | 16 +- drivers/net/ena/ena_ethdev.h | 2 +- drivers/net/enetc/base/enetc_hw.h | 4 +- drivers/net/enetc/enetc_ethdev.c | 6 +- drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_clsf.c | 40 +-- drivers/net/enic/enic_ethdev.c | 4 +- drivers/net/enic/enic_flow.c | 100 +++---- drivers/net/enic/enic_main.c | 2 +- drivers/net/enic/enic_res.c | 4 +- drivers/net/failsafe/failsafe.c | 6 +- drivers/net/failsafe/failsafe_args.c | 4 +- drivers/net/failsafe/failsafe_ether.c | 6 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/failsafe/failsafe_private.h | 4 +- drivers/net/fm10k/fm10k.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 18 +- drivers/net/i40e/base/i40e_adminq_cmd.h | 4 +- drivers/net/i40e/base/i40e_common.c | 12 +- drivers/net/i40e/base/i40e_prototype.h | 4 +- drivers/net/i40e/i40e_ethdev.c | 134 ++++----- drivers/net/i40e/i40e_ethdev.h | 22 +- drivers/net/i40e/i40e_ethdev_vf.c | 60 ++-- drivers/net/i40e/i40e_fdir.c | 126 ++++---- drivers/net/i40e/i40e_flow.c | 58 ++-- drivers/net/i40e/i40e_pf.c | 18 +- drivers/net/i40e/i40e_rxtx.c | 28 +- drivers/net/i40e/i40e_vf_representor.c | 2 +- drivers/net/i40e/rte_pmd_i40e.c | 30 +- drivers/net/i40e/rte_pmd_i40e.h | 8 +- drivers/net/ixgbe/ixgbe_ethdev.c | 94 +++--- drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- drivers/net/ixgbe/ixgbe_flow.c | 22 +- drivers/net/ixgbe/ixgbe_pf.c | 14 +- drivers/net/ixgbe/ixgbe_rxtx.c | 14 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 10 +- drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- drivers/net/kni/rte_eth_kni.c | 4 +- drivers/net/liquidio/lio_ethdev.c | 22 +- drivers/net/mlx4/mlx4.c | 4 +- drivers/net/mlx4/mlx4.h | 8 +- drivers/net/mlx4/mlx4_ethdev.c | 8 +- drivers/net/mlx4/mlx4_flow.c | 14 +- drivers/net/mlx4/mlx4_rxtx.c | 2 +- drivers/net/mlx5/mlx5.c | 4 +- drivers/net/mlx5/mlx5.h | 14 +- drivers/net/mlx5/mlx5_flow.c | 22 +- drivers/net/mlx5/mlx5_flow_tcf.c | 40 +-- drivers/net/mlx5/mlx5_flow_verbs.c | 26 +- drivers/net/mlx5/mlx5_mac.c | 18 +- drivers/net/mlx5/mlx5_nl.c | 28 +- drivers/net/mlx5/mlx5_rxtx.c | 6 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- drivers/net/mlx5/mlx5_trigger.c | 6 +- drivers/net/mvneta/mvneta_ethdev.c | 22 +- drivers/net/mvneta/mvneta_ethdev.h | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 22 +- drivers/net/mvpp2/mrvl_ethdev.h | 2 +- drivers/net/mvpp2/mrvl_flow.c | 4 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/netvsc/hn_nvs.c | 2 +- drivers/net/netvsc/hn_rndis.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 12 +- drivers/net/netvsc/hn_var.h | 4 +- drivers/net/netvsc/hn_vf.c | 12 +- drivers/net/nfp/nfp_net.c | 20 +- drivers/net/nfp/nfp_net_pmd.h | 2 +- drivers/net/null/rte_eth_null.c | 6 +- drivers/net/octeontx/octeontx_ethdev.c | 8 +- drivers/net/octeontx/octeontx_ethdev.h | 2 +- drivers/net/pcap/rte_eth_pcap.c | 22 +- drivers/net/qede/base/bcm_osal.h | 2 +- drivers/net/qede/base/ecore_dev.c | 4 +- drivers/net/qede/qede_ethdev.c | 58 ++-- drivers/net/qede/qede_ethdev.h | 6 +- drivers/net/qede/qede_filter.c | 66 ++--- drivers/net/qede/qede_if.h | 4 +- drivers/net/qede/qede_main.c | 6 +- drivers/net/qede/qede_rxtx.c | 32 +- drivers/net/qede/qede_rxtx.h | 2 +- drivers/net/ring/rte_eth_ring.c | 4 +- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ef10_tx.c | 8 +- drivers/net/sfc/sfc_ethdev.c | 20 +- drivers/net/sfc/sfc_flow.c | 12 +- drivers/net/sfc/sfc_port.c | 8 +- drivers/net/sfc/sfc_tso.c | 8 +- drivers/net/softnic/parser.c | 18 +- drivers/net/softnic/parser.h | 2 +- drivers/net/softnic/rte_eth_softnic.c | 2 +- drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- drivers/net/szedata2/rte_eth_szedata2.c | 8 +- drivers/net/tap/rte_eth_tap.c | 58 ++-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_bpf_program.c | 14 +- drivers/net/tap/tap_flow.c | 12 +- drivers/net/thunderx/base/nicvf_mbox.c | 4 +- drivers/net/thunderx/base/nicvf_plat.h | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 18 +- drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- drivers/net/vhost/rte_eth_vhost.c | 12 +- drivers/net/virtio/virtio_ethdev.c | 70 ++--- drivers/net/virtio/virtio_pci.h | 4 +- drivers/net/virtio/virtio_rxtx.c | 28 +- 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 | 12 +- drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 44 +-- examples/bbdev_app/main.c | 40 +-- examples/bond/main.c | 78 ++--- examples/distributor/main.c | 4 +- examples/ethtool/ethtool-app/ethapp.c | 8 +- examples/ethtool/ethtool-app/main.c | 10 +- examples/ethtool/lib/rte_ethtool.c | 8 +- examples/ethtool/lib/rte_ethtool.h | 6 +- examples/eventdev_pipeline/main.c | 4 +- examples/eventdev_pipeline/pipeline_common.h | 10 +- examples/flow_classify/flow_classify.c | 30 +- examples/flow_filtering/main.c | 10 +- examples/ip_fragmentation/main.c | 62 ++-- examples/ip_pipeline/cli.c | 2 +- examples/ip_pipeline/kni.c | 2 +- examples/ip_pipeline/parser.c | 18 +- examples/ip_pipeline/parser.h | 2 +- examples/ip_pipeline/pipeline.c | 40 +-- examples/ip_reassembly/main.c | 50 ++-- examples/ipsec-secgw/esp.c | 42 +-- examples/ipsec-secgw/ipsec-secgw.c | 38 +-- examples/ipsec-secgw/sa.c | 6 +- examples/ipv4_multicast/main.c | 58 ++-- examples/kni/main.c | 14 +- examples/l2fwd-cat/l2fwd-cat.c | 4 +- examples/l2fwd-crypto/main.c | 26 +- examples/l2fwd-jobstats/main.c | 8 +- examples/l2fwd-keepalive/main.c | 8 +- examples/l2fwd/main.c | 8 +- examples/l3fwd-acl/main.c | 102 +++---- examples/l3fwd-power/main.c | 100 +++---- examples/l3fwd-vf/main.c | 68 ++--- examples/l3fwd/l3fwd.h | 8 +- examples/l3fwd/l3fwd_altivec.h | 14 +- examples/l3fwd/l3fwd_common.h | 4 +- examples/l3fwd/l3fwd_em.c | 44 +-- examples/l3fwd/l3fwd_em.h | 20 +- examples/l3fwd/l3fwd_em_hlm.h | 16 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 16 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- examples/l3fwd/l3fwd_em_sequential.h | 16 +- examples/l3fwd/l3fwd_lpm.c | 50 ++-- examples/l3fwd/l3fwd_lpm.h | 20 +- examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- examples/l3fwd/l3fwd_lpm_neon.h | 30 +- examples/l3fwd/l3fwd_lpm_sse.h | 20 +- examples/l3fwd/l3fwd_neon.h | 14 +- examples/l3fwd/l3fwd_sse.h | 14 +- examples/l3fwd/main.c | 20 +- examples/link_status_interrupt/main.c | 8 +- examples/load_balancer/runtime.c | 6 +- .../client_server_mp/mp_server/main.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 322 ++++++++++----------- examples/ptpclient/ptpclient.c | 32 +- examples/qos_meter/main.c | 4 +- examples/qos_sched/init.c | 2 +- examples/quota_watermark/qw/main.c | 8 +- examples/rxtx_callbacks/main.c | 4 +- examples/server_node_efd/node/node.c | 6 +- examples/server_node_efd/server/main.c | 8 +- examples/skeleton/basicfwd.c | 4 +- examples/tep_termination/main.c | 2 +- examples/tep_termination/main.h | 2 +- examples/tep_termination/vxlan.c | 108 +++---- examples/tep_termination/vxlan.h | 8 +- examples/tep_termination/vxlan_setup.c | 30 +- examples/tep_termination/vxlan_setup.h | 2 +- examples/vhost/main.c | 40 +-- examples/vhost/main.h | 2 +- examples/vm_power_manager/channel_monitor.c | 2 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/main.c | 6 +- examples/vmdq/main.c | 12 +- examples/vmdq_dcb/main.c | 12 +- lib/librte_cmdline/cmdline_parse_etheraddr.c | 33 +-- lib/librte_ethdev/rte_eth_ctrl.h | 12 +- lib/librte_ethdev/rte_ethdev.c | 56 ++-- lib/librte_ethdev/rte_ethdev.h | 12 +- lib/librte_ethdev/rte_ethdev_core.h | 12 +- lib/librte_ethdev/rte_flow.h | 32 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 32 +- lib/librte_gro/gro_tcp4.c | 26 +- lib/librte_gro/gro_tcp4.h | 20 +- lib/librte_gro/gro_vxlan_tcp4.c | 64 ++-- lib/librte_gro/gro_vxlan_tcp4.h | 6 +- lib/librte_gso/gso_common.h | 16 +- lib/librte_gso/gso_tcp4.c | 12 +- lib/librte_gso/gso_tunnel_tcp4.c | 14 +- lib/librte_gso/gso_udp4.c | 8 +- lib/librte_gso/rte_gso.h | 8 +- lib/librte_hash/rte_thash.h | 2 +- lib/librte_ip_frag/rte_ip_frag.h | 12 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 +- lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- lib/librte_kni/rte_kni.c | 4 +- lib/librte_kni/rte_kni.h | 2 +- lib/librte_net/rte_arp.c | 32 +- lib/librte_net/rte_arp.h | 36 +-- lib/librte_net/rte_esp.h | 2 +- lib/librte_net/rte_ether.h | 178 ++++++------ lib/librte_net/rte_gre.h | 2 +- lib/librte_net/rte_icmp.h | 6 +- lib/librte_net/rte_ip.h | 70 ++--- lib/librte_net/rte_net.c | 90 +++--- lib/librte_net/rte_net.h | 22 +- lib/librte_net/rte_sctp.h | 2 +- lib/librte_net/rte_tcp.h | 2 +- lib/librte_net/rte_udp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 210 +++++++------- lib/librte_pipeline/rte_table_action.h | 4 +- lib/librte_port/rte_port_ras.c | 8 +- lib/librte_port/rte_port_source_sink.c | 6 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/virtio_net.c | 42 +-- test/test-acl/main.c | 2 +- test/test-pipeline/pipeline_acl.c | 16 +- test/test-pipeline/pipeline_hash.c | 12 +- test/test/packet_burst_generator.c | 126 ++++---- test/test/packet_burst_generator.h | 26 +- test/test/test_acl.c | 8 +- test/test/test_acl.h | 122 ++++---- test/test/test_cmdline_etheraddr.c | 16 +- test/test/test_efd.c | 20 +- test/test/test_event_eth_rx_adapter.c | 2 +- test/test/test_event_eth_tx_adapter.c | 2 +- test/test/test_flow_classify.c | 68 ++--- test/test/test_hash.c | 20 +- test/test/test_link_bonding.c | 284 +++++++++--------- test/test/test_link_bonding_mode4.c | 116 ++++---- test/test/test_link_bonding_rssconf.c | 6 +- test/test/test_lpm.c | 76 ++--- test/test/test_lpm_perf.c | 10 +- test/test/test_member.c | 20 +- test/test/test_pmd_perf.c | 20 +- test/test/test_sched.c | 20 +- test/test/test_table_acl.c | 8 +- test/test/test_thash.c | 12 +- test/test/virtual_pmd.c | 6 +- test/test/virtual_pmd.h | 2 +- 367 files changed, 3906 insertions(+), 3913 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 01/14] net: add rte prefix to arp structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 02/14] net: add rte prefix to arp defines Olivier Matz ` (19 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct arp_hdr as struct rte_arp_hdr. - rename struct arp_ipv4 as struct rte_arp_ipv4. Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields to avoid conflict with the #defines in gnu libc. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 36 ++++++++++++++++----------------- drivers/net/avf/base/avf_adminq_cmd.h | 4 ++-- drivers/net/avf/base/avf_common.c | 12 +++++------ drivers/net/avf/base/avf_prototype.h | 4 ++-- drivers/net/bonding/rte_eth_bond_alb.c | 26 ++++++++++++------------ drivers/net/bonding/rte_eth_bond_pmd.c | 16 +++++++-------- drivers/net/i40e/base/i40e_adminq_cmd.h | 4 ++-- drivers/net/i40e/base/i40e_common.c | 12 +++++------ drivers/net/i40e/base/i40e_prototype.h | 4 ++-- drivers/net/i40e/i40e_fdir.c | 4 ++-- examples/bond/main.c | 24 +++++++++++----------- lib/librte_net/rte_arp.c | 14 ++++++------- lib/librte_net/rte_arp.h | 16 +++++++-------- test/test/packet_burst_generator.c | 12 +++++------ test/test/packet_burst_generator.h | 2 +- test/test/test_link_bonding.c | 28 ++++++++++++------------- 16 files changed, 109 insertions(+), 109 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 55d266d77..34f68d73b 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -36,9 +36,9 @@ #include "testpmd.h" static const char * -arp_op_name(uint16_t arp_op) +arp_opcode_name(uint16_t arp_opcode) { - switch (arp_op ) { + switch (arp_opcode ) { case ARP_OP_REQUEST: return "ARP Request"; case ARP_OP_REPLY: @@ -277,7 +277,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_mbuf *pkt; struct ether_hdr *eth_h; struct vlan_hdr *vlan_h; - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; struct icmp_hdr *icmp_h; struct ether_addr eth_addr; @@ -288,8 +288,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) uint16_t nb_replies; uint16_t eth_type; uint16_t vlan_id; - uint16_t arp_op; - uint16_t arp_pro; + uint16_t arp_opcode; + uint16_t arp_protocol; uint32_t cksum; uint8_t i; int l2_len; @@ -347,22 +347,22 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* Reply to ARP requests */ if (eth_type == ETHER_TYPE_ARP) { - arp_h = (struct arp_hdr *) ((char *)eth_h + l2_len); - arp_op = RTE_BE_TO_CPU_16(arp_h->arp_op); - arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_pro); + 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); if (verbose_level > 0) { printf(" ARP: hrd=%d proto=0x%04x hln=%d " "pln=%d op=%u (%s)\n", - RTE_BE_TO_CPU_16(arp_h->arp_hrd), - arp_pro, arp_h->arp_hln, - arp_h->arp_pln, arp_op, - arp_op_name(arp_op)); + RTE_BE_TO_CPU_16(arp_h->arp_hardware), + arp_protocol, arp_h->arp_hlen, + arp_h->arp_plen, arp_opcode, + arp_opcode_name(arp_opcode)); } - if ((RTE_BE_TO_CPU_16(arp_h->arp_hrd) != + if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != ARP_HRD_ETHER) || - (arp_pro != ETHER_TYPE_IPv4) || - (arp_h->arp_hln != 6) || - (arp_h->arp_pln != 4) + (arp_protocol != ETHER_TYPE_IPv4) || + (arp_h->arp_hlen != 6) || + (arp_h->arp_plen != 4) ) { rte_pktmbuf_free(pkt); if (verbose_level > 0) @@ -381,7 +381,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ipv4_addr_dump(" tip=", ip_addr); printf("\n"); } - if (arp_op != ARP_OP_REQUEST) { + if (arp_opcode != ARP_OP_REQUEST) { rte_pktmbuf_free(pkt); continue; } @@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); - arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); diff --git a/drivers/net/avf/base/avf_adminq_cmd.h b/drivers/net/avf/base/avf_adminq_cmd.h index 1709f317e..7d5c40bd5 100644 --- a/drivers/net/avf/base/avf_adminq_cmd.h +++ b/drivers/net/avf/base/avf_adminq_cmd.h @@ -488,7 +488,7 @@ struct avf_aqc_cppm_configuration { AVF_CHECK_CMD_LENGTH(avf_aqc_cppm_configuration); /* Set ARP Proxy command / response (indirect 0x0104) */ -struct avf_aqc_arp_proxy_data { +struct avf_aqc_arp_protocolxy_data { __le16 command_flags; #define AVF_AQ_ARP_INIT_IPV4 0x0800 #define AVF_AQ_ARP_UNSUP_CTL 0x1000 @@ -504,7 +504,7 @@ struct avf_aqc_arp_proxy_data { u8 reserved[2]; }; -AVF_CHECK_STRUCT_LEN(0x14, avf_aqc_arp_proxy_data); +AVF_CHECK_STRUCT_LEN(0x14, avf_aqc_arp_protocolxy_data); /* Set NS Proxy Table Entry Command (indirect 0x0105) */ struct avf_aqc_ns_proxy_data { diff --git a/drivers/net/avf/base/avf_common.c b/drivers/net/avf/base/avf_common.c index bbaadada5..f9e4c993d 100644 --- a/drivers/net/avf/base/avf_common.c +++ b/drivers/net/avf/base/avf_common.c @@ -1236,16 +1236,16 @@ enum avf_status_code avf_reset(struct avf_hw *hw) } /** - * avf_aq_set_arp_proxy_config + * avf_aq_set_arp_protocolxy_config * @hw: pointer to the HW structure * @proxy_config: pointer to proxy config command table struct * @cmd_details: pointer to command details * * Set ARP offload parameters from pre-populated - * avf_aqc_arp_proxy_data struct + * avf_aqc_arp_protocolxy_data struct **/ -enum avf_status_code avf_aq_set_arp_proxy_config(struct avf_hw *hw, - struct avf_aqc_arp_proxy_data *proxy_config, +enum avf_status_code avf_aq_set_arp_protocolxy_config(struct avf_hw *hw, + struct avf_aqc_arp_protocolxy_data *proxy_config, struct avf_asq_cmd_details *cmd_details) { struct avf_aq_desc desc; @@ -1262,10 +1262,10 @@ enum avf_status_code avf_aq_set_arp_proxy_config(struct avf_hw *hw, CPU_TO_LE32(AVF_HI_DWORD((u64)proxy_config)); desc.params.external.addr_low = CPU_TO_LE32(AVF_LO_DWORD((u64)proxy_config)); - desc.datalen = CPU_TO_LE16(sizeof(struct avf_aqc_arp_proxy_data)); + desc.datalen = CPU_TO_LE16(sizeof(struct avf_aqc_arp_protocolxy_data)); status = avf_asq_send_command(hw, &desc, proxy_config, - sizeof(struct avf_aqc_arp_proxy_data), + sizeof(struct avf_aqc_arp_protocolxy_data), cmd_details); return status; diff --git a/drivers/net/avf/base/avf_prototype.h b/drivers/net/avf/base/avf_prototype.h index de031dc6a..7d5f6a5e8 100644 --- a/drivers/net/avf/base/avf_prototype.h +++ b/drivers/net/avf/base/avf_prototype.h @@ -146,8 +146,8 @@ enum avf_status_code avf_aq_get_phy_register(struct avf_hw *hw, u32 reg_addr, u32 *reg_val, struct avf_asq_cmd_details *cmd_details); -enum avf_status_code avf_aq_set_arp_proxy_config(struct avf_hw *hw, - struct avf_aqc_arp_proxy_data *proxy_config, +enum avf_status_code avf_aq_set_arp_protocolxy_config(struct avf_hw *hw, + struct avf_aqc_arp_protocolxy_data *proxy_config, struct avf_asq_cmd_details *cmd_details); enum avf_status_code avf_aq_set_ns_proxy_table_entry(struct avf_hw *hw, struct avf_aqc_ns_proxy_data *ns_proxy_table_entry, diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index c3891c7e3..b2aeb3ca9 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -74,17 +74,17 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { - struct arp_hdr *arp; + struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; struct client_data *client_info; uint8_t hash_index; - arp = (struct arp_hdr *) ((char *) (eth_h + 1) + offset); + arp = (struct rte_arp_hdr *) ((char *) (eth_h + 1) + offset); /* ARP Requests are forwarded to the application with no changes */ - if (arp->arp_op != rte_cpu_to_be_16(ARP_OP_REPLY)) + if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY)) return; /* From now on, we analyze only ARP Reply packets */ @@ -123,7 +123,7 @@ uint16_t bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { - struct arp_hdr *arp; + struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; struct client_data *client_info; @@ -132,7 +132,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, struct ether_addr bonding_mac; - arp = (struct arp_hdr *)((char *)(eth_h + 1) + offset); + arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); /* * Traffic with src MAC other than bonding should be sent on @@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, client_info = &hash_table[hash_index]; rte_spinlock_lock(&internals->mode6.lock); - if (arp->arp_op == rte_cpu_to_be_16(ARP_OP_REPLY)) { + if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) { if (client_info->in_use) { if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { @@ -196,7 +196,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals) { struct ether_hdr *eth_h; - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; uint16_t slave_idx; rte_spinlock_lock(&internals->mode6.lock); @@ -209,7 +209,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, else eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_h = (struct arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) + arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) + client_info->vlan_count * sizeof(struct vlan_hdr)); memcpy(eth_h + 1, client_info->vlan, @@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; - arp_h->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_h->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_h->arp_hln = ETHER_ADDR_LEN; - arp_h->arp_pln = sizeof(uint32_t); - arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); slave_idx = client_info->slave_idx; rte_spinlock_unlock(&internals->mode6.lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index b731132a5..a86a74a8d 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -485,9 +485,9 @@ uint32_t burstnumberTX; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB static void -arp_op_name(uint16_t arp_op, char *buf) +arp_opcode_name(uint16_t arp_opcode, char *buf) { - switch (arp_op) { + switch (arp_opcode) { case ARP_OP_REQUEST: snprintf(buf, sizeof("ARP Request"), "%s", "ARP Request"); return; @@ -566,7 +566,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB -#define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_op, port, burstnumber) \ +#define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_opcode, port, burstnumber) \ rte_log(RTE_LOG_DEBUG, bond_logtype, \ "%s port:%d SrcMAC:%02X:%02X:%02X:%02X:%02X:%02X SrcIP:%s " \ "DstMAC:%02X:%02X:%02X:%02X:%02X:%02X DstIP:%s %s %d\n", \ @@ -580,7 +580,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) eth_h->d_addr.addr_bytes[2], eth_h->d_addr.addr_bytes[3], \ eth_h->d_addr.addr_bytes[4], eth_h->d_addr.addr_bytes[5], \ dst_ip, \ - arp_op, ++burstnumber) + arp_opcode, ++burstnumber) #endif static void @@ -589,7 +589,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, { struct ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; char dst_ip[16]; char ArpOp[24]; char buf[16]; @@ -614,10 +614,10 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { - arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset); + 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); - arp_op_name(rte_be_to_cpu_16(arp_h->arp_op), ArpOp); + arp_opcode_name(rte_be_to_cpu_16(arp_h->arp_opcode), ArpOp); MODE6_DEBUG(buf, src_ip, dst_ip, eth_h, ArpOp, port, *burstnumber); } #endif @@ -1125,7 +1125,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) "Failed to allocate ARP packet from pool"); continue; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr) + pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr) + client_info->vlan_count * sizeof(struct vlan_hdr); upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h index 83062602f..c2aa8967d 100644 --- a/drivers/net/i40e/base/i40e_adminq_cmd.h +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h @@ -458,7 +458,7 @@ struct i40e_aqc_cppm_configuration { I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration); /* Set ARP Proxy command / response (indirect 0x0104) */ -struct i40e_aqc_arp_proxy_data { +struct i40e_aqc_arp_protocolxy_data { __le16 command_flags; #define I40E_AQ_ARP_INIT_IPV4 0x0800 #define I40E_AQ_ARP_UNSUP_CTL 0x1000 @@ -474,7 +474,7 @@ struct i40e_aqc_arp_proxy_data { u8 reserved[2]; }; -I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_proxy_data); +I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_protocolxy_data); /* Set NS Proxy Table Entry Command (indirect 0x0105) */ struct i40e_aqc_ns_proxy_data { diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 8a98afff1..875b8f8ad 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -7301,16 +7301,16 @@ enum i40e_status_code i40e_vf_reset(struct i40e_hw *hw) #endif /* VF_DRIVER */ /** - * i40e_aq_set_arp_proxy_config + * i40e_aq_set_arp_protocolxy_config * @hw: pointer to the HW structure * @proxy_config: pointer to proxy config command table struct * @cmd_details: pointer to command details * * Set ARP offload parameters from pre-populated - * i40e_aqc_arp_proxy_data struct + * i40e_aqc_arp_protocolxy_data struct **/ -enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, - struct i40e_aqc_arp_proxy_data *proxy_config, +enum i40e_status_code i40e_aq_set_arp_protocolxy_config(struct i40e_hw *hw, + struct i40e_aqc_arp_protocolxy_data *proxy_config, struct i40e_asq_cmd_details *cmd_details) { struct i40e_aq_desc desc; @@ -7327,10 +7327,10 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, CPU_TO_LE32(I40E_HI_DWORD((u64)proxy_config)); desc.params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)proxy_config)); - desc.datalen = CPU_TO_LE16(sizeof(struct i40e_aqc_arp_proxy_data)); + desc.datalen = CPU_TO_LE16(sizeof(struct i40e_aqc_arp_protocolxy_data)); status = i40e_asq_send_command(hw, &desc, proxy_config, - sizeof(struct i40e_aqc_arp_proxy_data), + sizeof(struct i40e_aqc_arp_protocolxy_data), cmd_details); return status; diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h index 0cf006dad..28f80178b 100644 --- a/drivers/net/i40e/base/i40e_prototype.h +++ b/drivers/net/i40e/base/i40e_prototype.h @@ -556,8 +556,8 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw, u32 reg_addr, u32 *reg_val, struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, - struct i40e_aqc_arp_proxy_data *proxy_config, +enum i40e_status_code i40e_aq_set_arp_protocolxy_config(struct i40e_hw *hw, + struct i40e_aqc_arp_protocolxy_data *proxy_config, struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_set_ns_proxy_table_entry(struct i40e_hw *hw, struct i40e_aqc_ns_proxy_data *ns_proxy_table_entry, diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index d41601a17..4b32fee1e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -911,7 +911,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, */ if (fdir_input->flow.l2_flow.ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) - payload += sizeof(struct arp_hdr); + payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; break; default: @@ -1197,7 +1197,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, */ if (fdir_input->flow.l2_flow.ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) - payload += sizeof(struct arp_hdr); + payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; } else if (fdir_input->flow_ext.customized_pctype) { /* If customized pctype is used */ diff --git a/examples/bond/main.c b/examples/bond/main.c index b282e68ba..d428c405f 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -324,7 +324,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct ether_addr d_addr; struct ether_hdr *eth_hdr; - struct arp_hdr *arp_hdr; + struct rte_arp_hdr *arp_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; @@ -367,10 +367,10 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[1]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - arp_hdr = (struct arp_hdr *)((char *)(eth_hdr + 1) + offset); + arp_hdr = (struct rte_arp_hdr *)((char *)(eth_hdr + 1) + offset); if (arp_hdr->arp_data.arp_tip == bond_ip) { - if (arp_hdr->arp_op == rte_cpu_to_be_16(ARP_OP_REQUEST)) { - arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) { + arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); @@ -435,7 +435,7 @@ static void cmd_obj_send_parsed(void *parsed_result, struct rte_mbuf *created_pkt; struct ether_hdr *eth_hdr; - struct arp_hdr *arp_hdr; + struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; size_t pkt_size; @@ -454,7 +454,7 @@ static void cmd_obj_send_parsed(void *parsed_result, return; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr); + pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; @@ -463,12 +463,12 @@ static void cmd_obj_send_parsed(void *parsed_result, memset(ð_hdr->d_addr, 0xFF, ETHER_ADDR_LEN); eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_hdr = (struct arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); - arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hln = ETHER_ADDR_LEN; - arp_hdr->arp_pln = sizeof(uint32_t); - arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REQUEST); + arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); + arp_hdr->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST); rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index f0ed9bd68..c80ebc7e1 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -12,7 +12,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, const struct ether_addr *mac) { struct ether_hdr *eth_hdr; - struct arp_hdr *rarp; + struct rte_arp_hdr *rarp; struct rte_mbuf *mbuf; if (mpool == NULL) @@ -34,12 +34,12 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, eth_hdr->ether_type = htons(ETHER_TYPE_RARP); /* RARP header. */ - rarp = (struct arp_hdr *)(eth_hdr + 1); - rarp->arp_hrd = htons(ARP_HRD_ETHER); - rarp->arp_pro = htons(ETHER_TYPE_IPv4); - rarp->arp_hln = ETHER_ADDR_LEN; - rarp->arp_pln = 4; - rarp->arp_op = htons(ARP_OP_REVREQUEST); + rarp = (struct rte_arp_hdr *)(eth_hdr + 1); + rarp->arp_hardware = htons(ARP_HRD_ETHER); + rarp->arp_protocol = htons(ETHER_TYPE_IPv4); + rarp->arp_hlen = ETHER_ADDR_LEN; + rarp->arp_plen = 4; + rarp->arp_opcode = htons(ARP_OP_REVREQUEST); ether_addr_copy(mac, &rarp->arp_data.arp_sha); ether_addr_copy(mac, &rarp->arp_data.arp_tha); diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index 139a84ca5..c9b5cd49d 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -21,7 +21,7 @@ extern "C" { /** * ARP header IPv4 payload. */ -struct arp_ipv4 { +struct rte_arp_ipv4 { struct ether_addr arp_sha; /**< sender hardware address */ uint32_t arp_sip; /**< sender IP address */ struct ether_addr arp_tha; /**< target hardware address */ @@ -31,14 +31,14 @@ struct arp_ipv4 { /** * ARP header. */ -struct arp_hdr { - uint16_t arp_hrd; /* format of hardware address */ +struct rte_arp_hdr { + uint16_t arp_hardware; /* format of hardware address */ #define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ - uint16_t arp_pro; /* format of protocol address */ - uint8_t arp_hln; /* length of hardware address */ - uint8_t arp_pln; /* length of protocol address */ - uint16_t arp_op; /* ARP opcode (command) */ + uint16_t arp_protocol; /* format of protocol address */ + uint8_t arp_hlen; /* length of hardware address */ + uint8_t arp_plen; /* length of protocol address */ + uint16_t arp_opcode; /* ARP opcode (command) */ #define ARP_OP_REQUEST 1 /* request to resolve address */ #define ARP_OP_REPLY 2 /* response to previous request */ #define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ @@ -46,7 +46,7 @@ struct arp_hdr { #define ARP_OP_INVREQUEST 8 /* request to identify peer */ #define ARP_OP_INVREPLY 9 /* response identifying peer */ - struct arp_ipv4 arp_data; + struct rte_arp_ipv4 arp_data; } __attribute__((__packed__)); /** diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index e894dc76f..0b12058bb 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -74,15 +74,15 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, } void -initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { - arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hln = ETHER_ADDR_LEN; - arp_hdr->arp_pln = sizeof(uint32_t); - arp_hdr->arp_op = rte_cpu_to_be_16(opcode); + arp_hdr->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = src_ip; ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index c20cea6e9..b6e013a11 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -29,7 +29,7 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, uint8_t vlan_enabled, uint16_t van_id); void -initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index 0fe1d78eb..db437a9c2 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -4460,7 +4460,7 @@ test_alb_change_mac_in_reply_sent(void) struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; struct ether_hdr *eth_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; int slave_idx, nb_pkts, pkt_idx; int retval = 0; @@ -4495,7 +4495,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4505,7 +4505,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4515,7 +4515,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4525,7 +4525,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4546,7 +4546,7 @@ test_alb_change_mac_in_reply_sent(void) for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4571,7 +4571,7 @@ static int test_alb_reply_from_client(void) { struct ether_hdr *eth_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; @@ -4608,7 +4608,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4619,7 +4619,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4630,7 +4630,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4641,7 +4641,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4667,7 +4667,7 @@ test_alb_reply_from_client(void) for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4699,7 +4699,7 @@ test_alb_receive_vlan_reply(void) { struct ether_hdr *eth_pkt; struct vlan_hdr *vlan_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; @@ -4740,7 +4740,7 @@ test_alb_receive_vlan_reply(void) 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); - arp_pkt = (struct arp_hdr *)((char *)(vlan_pkt + 1)); + arp_pkt = (struct rte_arp_hdr *)((char *)(vlan_pkt + 1)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 02/14] net: add rte prefix to arp defines 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 01/14] net: add rte prefix to arp structures Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 14:53 ` Wiles, Keith 2018-10-24 8:18 ` [dpdk-dev] [RFC 03/14] net: add rte prefix to ether structures Olivier Matz ` (18 subsequent siblings) 20 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'RTE_' prefix to defines: - rename ARP_HRD_ETHER as RTE_ARP_HRD_ETHER. - rename ARP_OP_REQUEST as RTE_ARP_OP_REQUEST. - rename ARP_OP_REPLY as RTE_ARP_OP_REPLY. - rename ARP_OP_REVREQUEST as RTE_ARP_OP_REVREQUEST. - rename ARP_OP_REVREPLY as RTE_ARP_OP_REVREPLY. - rename ARP_OP_INVREQUEST as RTE_ARP_OP_INVREQUEST. - rename ARP_OP_INVREPLY as RTE_ARP_OP_INVREPLY. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 18 +++++++++--------- drivers/net/bonding/rte_eth_bond_alb.c | 8 ++++---- drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++++++------ examples/bond/main.c | 8 ++++---- lib/librte_net/rte_arp.c | 4 ++-- lib/librte_net/rte_arp.h | 14 +++++++------- test/test/packet_burst_generator.c | 2 +- test/test/test_link_bonding.c | 18 +++++++++--------- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 34f68d73b..062e3ea43 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -39,17 +39,17 @@ static const char * arp_opcode_name(uint16_t arp_opcode) { switch (arp_opcode ) { - case ARP_OP_REQUEST: + case RTE_ARP_OP_REQUEST: return "ARP Request"; - case ARP_OP_REPLY: + case RTE_ARP_OP_REPLY: return "ARP Reply"; - case ARP_OP_REVREQUEST: + case RTE_ARP_OP_REVREQUEST: return "Reverse ARP Request"; - case ARP_OP_REVREPLY: + case RTE_ARP_OP_REVREPLY: return "Reverse ARP Reply"; - case ARP_OP_INVREQUEST: + case RTE_ARP_OP_INVREQUEST: return "Peer Identify Request"; - case ARP_OP_INVREPLY: + case RTE_ARP_OP_INVREPLY: return "Peer Identify Reply"; default: break; @@ -359,7 +359,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) arp_opcode_name(arp_opcode)); } if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != - ARP_HRD_ETHER) || + RTE_ARP_HRD_ETHER) || (arp_protocol != ETHER_TYPE_IPv4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) @@ -381,7 +381,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ipv4_addr_dump(" tip=", ip_addr); printf("\n"); } - if (arp_opcode != ARP_OP_REQUEST) { + if (arp_opcode != RTE_ARP_OP_REQUEST) { rte_pktmbuf_free(pkt); continue; } @@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); - arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index b2aeb3ca9..7ae240345 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -84,7 +84,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, arp = (struct rte_arp_hdr *) ((char *) (eth_h + 1) + offset); /* ARP Requests are forwarded to the application with no changes */ - if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY)) + if (arp->arp_opcode != rte_cpu_to_be_16(RTE_ARP_OP_REPLY)) return; /* From now on, we analyze only ARP Reply packets */ @@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, client_info = &hash_table[hash_index]; rte_spinlock_lock(&internals->mode6.lock); - if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) { + if (arp->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REPLY)) { if (client_info->in_use) { if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { @@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; - arp_h->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); - arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); slave_idx = client_info->slave_idx; rte_spinlock_unlock(&internals->mode6.lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index a86a74a8d..52724640f 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -488,25 +488,25 @@ static void arp_opcode_name(uint16_t arp_opcode, char *buf) { switch (arp_opcode) { - case ARP_OP_REQUEST: + case RTE_ARP_OP_REQUEST: snprintf(buf, sizeof("ARP Request"), "%s", "ARP Request"); return; - case ARP_OP_REPLY: + case RTE_ARP_OP_REPLY: snprintf(buf, sizeof("ARP Reply"), "%s", "ARP Reply"); return; - case ARP_OP_REVREQUEST: + case RTE_ARP_OP_REVREQUEST: snprintf(buf, sizeof("Reverse ARP Request"), "%s", "Reverse ARP Request"); return; - case ARP_OP_REVREPLY: + case RTE_ARP_OP_REVREPLY: snprintf(buf, sizeof("Reverse ARP Reply"), "%s", "Reverse ARP Reply"); return; - case ARP_OP_INVREQUEST: + case RTE_ARP_OP_INVREQUEST: snprintf(buf, sizeof("Peer Identify Request"), "%s", "Peer Identify Request"); return; - case ARP_OP_INVREPLY: + case RTE_ARP_OP_INVREPLY: snprintf(buf, sizeof("Peer Identify Reply"), "%s", "Peer Identify Reply"); return; diff --git a/examples/bond/main.c b/examples/bond/main.c index d428c405f..2fe5a9319 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -369,8 +369,8 @@ static int lcore_main(__attribute__((unused)) void *arg1) } arp_hdr = (struct rte_arp_hdr *)((char *)(eth_hdr + 1) + offset); if (arp_hdr->arp_data.arp_tip == bond_ip) { - if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) { - arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) { + arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); @@ -464,11 +464,11 @@ static void cmd_obj_send_parsed(void *parsed_result, eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); - arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); - arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST); + 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; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index c80ebc7e1..877874a5e 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -35,11 +35,11 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, /* RARP header. */ rarp = (struct rte_arp_hdr *)(eth_hdr + 1); - rarp->arp_hardware = htons(ARP_HRD_ETHER); + rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER); rarp->arp_protocol = htons(ETHER_TYPE_IPv4); rarp->arp_hlen = ETHER_ADDR_LEN; rarp->arp_plen = 4; - rarp->arp_opcode = htons(ARP_OP_REVREQUEST); + rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); ether_addr_copy(mac, &rarp->arp_data.arp_sha); ether_addr_copy(mac, &rarp->arp_data.arp_tha); diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index c9b5cd49d..a94fa6a00 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -33,18 +33,18 @@ struct rte_arp_ipv4 { */ struct rte_arp_hdr { uint16_t arp_hardware; /* format of hardware address */ -#define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ +#define RTE_ARP_HRD_ETHER 1 /* ARP Ethernet address format */ uint16_t arp_protocol; /* format of protocol address */ uint8_t arp_hlen; /* length of hardware address */ uint8_t arp_plen; /* length of protocol address */ uint16_t arp_opcode; /* ARP opcode (command) */ -#define ARP_OP_REQUEST 1 /* request to resolve address */ -#define ARP_OP_REPLY 2 /* response to previous request */ -#define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ -#define ARP_OP_REVREPLY 4 /* response giving protocol address */ -#define ARP_OP_INVREQUEST 8 /* request to identify peer */ -#define ARP_OP_INVREPLY 9 /* response identifying peer */ +#define RTE_ARP_OP_REQUEST 1 /* request to resolve address */ +#define RTE_ARP_OP_REPLY 2 /* response to previous request */ +#define RTE_ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ +#define RTE_ARP_OP_REVREPLY 4 /* response giving protocol address */ +#define RTE_ARP_OP_INVREQUEST 8 /* request to identify peer */ +#define RTE_ARP_OP_INVREPLY 9 /* response identifying peer */ struct rte_arp_ipv4 arp_data; } __attribute__((__packed__)); diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index 0b12058bb..ccc0bd591 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -78,7 +78,7 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { - arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index db437a9c2..2c20f44ea 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -4497,7 +4497,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4507,7 +4507,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4517,7 +4517,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4527,7 +4527,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); slave_mac1 = @@ -4610,7 +4610,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4621,7 +4621,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4632,7 +4632,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4643,7 +4643,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4742,7 +4742,7 @@ test_alb_receive_vlan_reply(void) vlan_pkt->eth_proto = rte_cpu_to_be_16(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, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 02/14] net: add rte prefix to arp defines 2018-10-24 8:18 ` [dpdk-dev] [RFC 02/14] net: add rte prefix to arp defines Olivier Matz @ 2018-10-24 14:53 ` Wiles, Keith 2018-10-26 7:25 ` Olivier Matz 0 siblings, 1 reply; 107+ messages in thread From: Wiles, Keith @ 2018-10-24 14:53 UTC (permalink / raw) To: Olivier Matz; +Cc: dpdk-dev > On Oct 24, 2018, at 1:18 AM, Olivier Matz <olivier.matz@6wind.com> wrote: > > Add 'RTE_' prefix to defines: > - rename ARP_HRD_ETHER as RTE_ARP_HRD_ETHER. > - rename ARP_OP_REQUEST as RTE_ARP_OP_REQUEST. > - rename ARP_OP_REPLY as RTE_ARP_OP_REPLY. > - rename ARP_OP_REVREQUEST as RTE_ARP_OP_REVREQUEST. > - rename ARP_OP_REVREPLY as RTE_ARP_OP_REVREPLY. > - rename ARP_OP_INVREQUEST as RTE_ARP_OP_INVREQUEST. > - rename ARP_OP_INVREPLY as RTE_ARP_OP_INVREPLY. > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Were these conflicting with external headers ? If not it maybe reasonable to keep the old defines for a release or two and then deprecate the old ones by defining the old defines in terms of the new defines. This way we can support the old ones for a while then state they will be deprecated later. Trying to make it easier for developers to update code. What do you think Regards, Keith ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 02/14] net: add rte prefix to arp defines 2018-10-24 14:53 ` Wiles, Keith @ 2018-10-26 7:25 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-26 7:25 UTC (permalink / raw) To: Wiles, Keith; +Cc: dpdk-dev Hi, On Wed, Oct 24, 2018 at 02:53:25PM +0000, Wiles, Keith wrote: > > > > On Oct 24, 2018, at 1:18 AM, Olivier Matz <olivier.matz@6wind.com> wrote: > > > > Add 'RTE_' prefix to defines: > > - rename ARP_HRD_ETHER as RTE_ARP_HRD_ETHER. > > - rename ARP_OP_REQUEST as RTE_ARP_OP_REQUEST. > > - rename ARP_OP_REPLY as RTE_ARP_OP_REPLY. > > - rename ARP_OP_REVREQUEST as RTE_ARP_OP_REVREQUEST. > > - rename ARP_OP_REVREPLY as RTE_ARP_OP_REVREPLY. > > - rename ARP_OP_INVREQUEST as RTE_ARP_OP_INVREQUEST. > > - rename ARP_OP_INVREPLY as RTE_ARP_OP_INVREPLY. > > > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> > > Were these conflicting with external headers ? > > If not it maybe reasonable to keep the old defines for a release or two and then deprecate the old ones by defining the old defines in terms of the new defines. This way we can support the old ones for a while then state they will be deprecated later. > > Trying to make it easier for developers to update code. What do you think Providing a compat layer would be helpful for sure. But I don't think it is possible for everything. Please see my answer to Bruce: https://mails.dpdk.org/archives/dev/2018-October/117255.html Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 03/14] net: add rte prefix to ether structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 01/14] net: add rte prefix to arp structures Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 02/14] net: add rte prefix to arp defines Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-12-20 22:04 ` Ferruh Yigit 2018-10-24 8:18 ` [dpdk-dev] [RFC 04/14] net: add rte prefix to ether functions Olivier Matz ` (17 subsequent siblings) 20 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct ether_addr as struct rte_ether_addr. - rename struct ether_hdr as struct rte_ether_hdr. - rename struct vlan_hdr as struct rte_vlan_hdr. - rename struct vxlan_hdr as struct rte_vxlan_hdr. - rename struct vxlan_gpe_hdr as struct rte_vxlan_gpe_hdr. Additionally, adapt the command line library to use the rte structures and defines. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/pdump/main.c | 2 +- app/test-pmd/cmdline.c | 38 +++--- app/test-pmd/cmdline_flow.c | 2 +- app/test-pmd/config.c | 24 ++-- app/test-pmd/csumonly.c | 30 ++--- app/test-pmd/flowgen.c | 10 +- app/test-pmd/icmpecho.c | 18 +-- app/test-pmd/ieee1588fwd.c | 8 +- app/test-pmd/macfwd.c | 6 +- app/test-pmd/macswap.c | 8 +- app/test-pmd/testpmd.c | 4 +- app/test-pmd/testpmd.h | 10 +- app/test-pmd/txonly.c | 10 +- app/test-pmd/util.c | 12 +- doc/guides/prog_guide/bbdev.rst | 6 +- doc/guides/sample_app_ug/flow_classify.rst | 12 +- doc/guides/sample_app_ug/flow_filtering.rst | 6 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 8 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 4 +- .../sample_app_ug/l2_forward_real_virtual.rst | 4 +- doc/guides/sample_app_ug/l3_forward.rst | 8 +- doc/guides/sample_app_ug/link_status_intr.rst | 4 +- doc/guides/sample_app_ug/ptpclient.rst | 6 +- doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- doc/guides/sample_app_ug/server_node_efd.rst | 4 +- doc/guides/sample_app_ug/skeleton.rst | 2 +- doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- drivers/bus/dpaa/include/fman.h | 2 +- drivers/bus/dpaa/include/netcfg.h | 4 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/ark/ark_ethdev.c | 12 +- drivers/net/ark/ark_ext.h | 4 +- drivers/net/ark/ark_global.h | 4 +- drivers/net/atlantic/atl_ethdev.c | 12 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- drivers/net/avf/avf.h | 2 +- drivers/net/avf/avf_ethdev.c | 22 ++-- drivers/net/avf/avf_vchnl.c | 4 +- drivers/net/avp/avp_ethdev.c | 6 +- drivers/net/axgbe/axgbe_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x.c | 8 +- drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x_vfpf.c | 2 +- drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 6 +- drivers/net/bnxt/bnxt_hwrm.c | 4 +- drivers/net/bnxt/bnxt_hwrm.h | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 6 +- drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- drivers/net/bonding/rte_eth_bond.h | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 6 +- drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- drivers/net/bonding/rte_eth_bond_alb.c | 24 ++-- drivers/net/bonding/rte_eth_bond_alb.h | 10 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_args.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 80 +++++------ drivers/net/bonding/rte_eth_bond_private.h | 6 +- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 18 +-- drivers/net/e1000/em_ethdev.c | 14 +- drivers/net/e1000/igb_ethdev.c | 24 ++-- drivers/net/e1000/igb_pf.c | 4 +- drivers/net/ena/ena_ethdev.c | 8 +- drivers/net/enetc/enetc_ethdev.c | 2 +- drivers/net/enic/enic_ethdev.c | 4 +- drivers/net/enic/enic_flow.c | 34 ++--- drivers/net/enic/enic_main.c | 2 +- drivers/net/failsafe/failsafe.c | 2 +- drivers/net/failsafe/failsafe_args.c | 2 +- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/failsafe/failsafe_private.h | 4 +- drivers/net/fm10k/fm10k_ethdev.c | 8 +- drivers/net/i40e/i40e_ethdev.c | 58 ++++---- drivers/net/i40e/i40e_ethdev.h | 20 +-- drivers/net/i40e/i40e_ethdev_vf.c | 30 ++--- drivers/net/i40e/i40e_fdir.c | 8 +- drivers/net/i40e/i40e_flow.c | 8 +- drivers/net/i40e/i40e_pf.c | 10 +- drivers/net/i40e/i40e_vf_representor.c | 2 +- drivers/net/i40e/rte_pmd_i40e.c | 14 +- drivers/net/i40e/rte_pmd_i40e.h | 8 +- drivers/net/ixgbe/ixgbe_ethdev.c | 42 +++--- drivers/net/ixgbe/ixgbe_pf.c | 2 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4.h | 6 +- drivers/net/mlx4/mlx4_ethdev.c | 4 +- drivers/net/mlx4/mlx4_flow.c | 4 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mlx5/mlx5.h | 12 +- drivers/net/mlx5/mlx5_flow_tcf.c | 4 +- drivers/net/mlx5/mlx5_mac.c | 10 +- drivers/net/mlx5/mlx5_nl.c | 14 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mvneta/mvneta_ethdev.c | 4 +- drivers/net/mvpp2/mrvl_ethdev.c | 4 +- drivers/net/mvpp2/mrvl_flow.c | 2 +- drivers/net/netvsc/hn_ethdev.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 4 +- drivers/net/netvsc/hn_var.h | 4 +- drivers/net/netvsc/hn_vf.c | 6 +- drivers/net/nfp/nfp_net.c | 8 +- drivers/net/null/rte_eth_null.c | 4 +- drivers/net/octeontx/octeontx_ethdev.c | 2 +- drivers/net/pcap/rte_eth_pcap.c | 4 +- drivers/net/qede/qede_ethdev.c | 24 ++-- drivers/net/qede/qede_ethdev.h | 6 +- drivers/net/qede/qede_filter.c | 4 +- drivers/net/qede/qede_if.h | 2 +- drivers/net/qede/qede_rxtx.c | 14 +- drivers/net/ring/rte_eth_ring.c | 4 +- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ethdev.c | 10 +- drivers/net/sfc/sfc_port.c | 6 +- drivers/net/softnic/parser.c | 12 +- drivers/net/softnic/parser.h | 2 +- drivers/net/softnic/rte_eth_softnic.c | 2 +- drivers/net/szedata2/rte_eth_szedata2.c | 6 +- drivers/net/tap/rte_eth_tap.c | 18 +-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_bpf_program.c | 8 +- drivers/net/thunderx/base/nicvf_mbox.c | 4 +- drivers/net/thunderx/nicvf_ethdev.c | 4 +- drivers/net/vdev_netvsc/vdev_netvsc.c | 12 +- drivers/net/vhost/rte_eth_vhost.c | 8 +- drivers/net/virtio/virtio_ethdev.c | 18 +-- drivers/net/virtio/virtio_rxtx.c | 4 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 8 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 6 +- examples/bbdev_app/main.c | 38 +++--- examples/bond/main.c | 28 ++-- examples/distributor/main.c | 2 +- examples/ethtool/ethtool-app/ethapp.c | 4 +- examples/ethtool/ethtool-app/main.c | 6 +- examples/ethtool/lib/rte_ethtool.c | 6 +- examples/ethtool/lib/rte_ethtool.h | 6 +- examples/eventdev_pipeline/main.c | 2 +- examples/eventdev_pipeline/pipeline_common.h | 6 +- examples/flow_classify/flow_classify.c | 12 +- examples/flow_filtering/main.c | 6 +- examples/ip_fragmentation/main.c | 16 +-- examples/ip_pipeline/cli.c | 2 +- examples/ip_pipeline/parser.c | 12 +- examples/ip_pipeline/parser.h | 2 +- examples/ip_reassembly/main.c | 12 +- examples/ipsec-secgw/ipsec-secgw.c | 16 +-- examples/ipv4_multicast/main.c | 14 +- examples/kni/main.c | 8 +- examples/l2fwd-cat/l2fwd-cat.c | 2 +- examples/l2fwd-crypto/main.c | 12 +- examples/l2fwd-jobstats/main.c | 6 +- examples/l2fwd-keepalive/main.c | 6 +- examples/l2fwd/main.c | 6 +- examples/l3fwd-acl/main.c | 12 +- examples/l3fwd-power/main.c | 16 +-- examples/l3fwd-vf/main.c | 10 +- examples/l3fwd/l3fwd.h | 2 +- examples/l3fwd/l3fwd_altivec.h | 12 +- examples/l3fwd/l3fwd_em.c | 6 +- examples/l3fwd/l3fwd_em.h | 8 +- examples/l3fwd/l3fwd_em_hlm.h | 8 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 8 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 8 +- examples/l3fwd/l3fwd_em_sequential.h | 8 +- examples/l3fwd/l3fwd_lpm.c | 14 +- examples/l3fwd/l3fwd_lpm.h | 8 +- examples/l3fwd/l3fwd_lpm_altivec.h | 10 +- examples/l3fwd/l3fwd_lpm_neon.h | 20 +-- examples/l3fwd/l3fwd_lpm_sse.h | 10 +- examples/l3fwd/l3fwd_neon.h | 12 +- examples/l3fwd/l3fwd_sse.h | 12 +- examples/l3fwd/main.c | 8 +- examples/link_status_interrupt/main.c | 6 +- examples/load_balancer/runtime.c | 2 +- .../client_server_mp/mp_server/main.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 136 +++++++++---------- examples/ptpclient/ptpclient.c | 28 ++-- examples/qos_meter/main.c | 2 +- examples/quota_watermark/qw/main.c | 6 +- examples/rxtx_callbacks/main.c | 2 +- examples/server_node_efd/node/node.c | 2 +- examples/server_node_efd/server/main.c | 4 +- examples/skeleton/basicfwd.c | 2 +- examples/tep_termination/main.c | 2 +- examples/tep_termination/main.h | 2 +- examples/tep_termination/vxlan.c | 38 +++--- examples/tep_termination/vxlan.h | 6 +- examples/tep_termination/vxlan_setup.c | 6 +- examples/tep_termination/vxlan_setup.h | 2 +- examples/vhost/main.c | 24 ++-- examples/vhost/main.h | 2 +- examples/vm_power_manager/channel_monitor.c | 2 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/main.c | 4 +- examples/vmdq/main.c | 10 +- examples/vmdq_dcb/main.c | 10 +- lib/librte_cmdline/cmdline_parse_etheraddr.c | 28 ++-- lib/librte_ethdev/rte_eth_ctrl.h | 12 +- lib/librte_ethdev/rte_ethdev.c | 20 +-- lib/librte_ethdev/rte_ethdev.h | 12 +- lib/librte_ethdev/rte_ethdev_core.h | 12 +- lib/librte_ethdev/rte_flow.h | 12 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 6 +- lib/librte_gro/gro_tcp4.c | 4 +- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 12 +- lib/librte_gro/gro_vxlan_tcp4.h | 6 +- lib/librte_gso/rte_gso.h | 4 +- lib/librte_kni/rte_kni.c | 2 +- lib/librte_net/rte_arp.c | 6 +- lib/librte_net/rte_arp.h | 6 +- lib/librte_net/rte_ether.h | 64 ++++----- lib/librte_net/rte_net.c | 20 +-- lib/librte_pipeline/rte_table_action.c | 54 ++++---- lib/librte_pipeline/rte_table_action.h | 4 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/virtio_net.c | 10 +- test/test-pipeline/pipeline_acl.c | 10 +- test/test-pipeline/pipeline_hash.c | 4 +- test/test/packet_burst_generator.c | 26 ++-- test/test/packet_burst_generator.h | 12 +- test/test/test_cmdline_etheraddr.c | 14 +- test/test/test_event_eth_rx_adapter.c | 2 +- test/test/test_event_eth_tx_adapter.c | 2 +- test/test/test_flow_classify.c | 34 ++--- test/test/test_link_bonding.c | 146 ++++++++++----------- test/test/test_link_bonding_mode4.c | 52 ++++---- test/test/test_link_bonding_rssconf.c | 2 +- test/test/test_pmd_perf.c | 10 +- test/test/test_sched.c | 12 +- test/test/virtual_pmd.c | 4 +- test/test/virtual_pmd.h | 2 +- 246 files changed, 1265 insertions(+), 1271 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index ac2287124..0635ac0dd 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -527,7 +527,7 @@ signal_handler(int sig_num) static inline int configure_vdev(uint16_t port_id) { - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rxRings = 0, txRings = 1; int ret; uint16_t q; diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 3b469ac64..c866ffe32 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -5961,7 +5961,7 @@ struct cmd_set_bond_mac_addr_result { cmdline_fixed_string_t bonding; cmdline_fixed_string_t mac_addr; uint16_t port_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_set_bond_mac_addr_parsed(void *parsed_result, @@ -7691,7 +7691,7 @@ struct cmd_mac_addr_result { cmdline_fixed_string_t mac_addr_cmd; cmdline_fixed_string_t what; uint16_t port_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_mac_addr_parsed(void *parsed_result, @@ -7890,7 +7890,7 @@ struct cmd_set_uc_hash_table { cmdline_fixed_string_t port; portid_t port_id; cmdline_fixed_string_t what; - struct ether_addr address; + struct rte_ether_addr address; cmdline_fixed_string_t mode; }; @@ -8014,7 +8014,7 @@ struct cmd_set_vf_macvlan_filter { portid_t port_id; cmdline_fixed_string_t vf; uint8_t vf_id; - struct ether_addr address; + struct rte_ether_addr address; cmdline_fixed_string_t filter_type; cmdline_fixed_string_t mode; }; @@ -8273,7 +8273,7 @@ struct cmd_vf_mac_addr_result { uint16_t port_num; cmdline_fixed_string_t vf; uint8_t vf_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_vf_mac_addr_parsed(void *parsed_result, @@ -8586,8 +8586,8 @@ struct cmd_tunnel_filter_result { cmdline_fixed_string_t cmd; cmdline_fixed_string_t what; portid_t port_id; - struct ether_addr outer_mac; - struct ether_addr inner_mac; + struct rte_ether_addr outer_mac; + struct rte_ether_addr inner_mac; cmdline_ipaddr_t ip_value; uint16_t inner_vlan; cmdline_fixed_string_t tunnel_type; @@ -10373,7 +10373,7 @@ struct cmd_ethertype_filter_result { portid_t port_id; cmdline_fixed_string_t ops; cmdline_fixed_string_t mac; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; cmdline_fixed_string_t ethertype; uint16_t ethertype_value; cmdline_fixed_string_t drop; @@ -10433,7 +10433,7 @@ cmd_ethertype_filter_parsed(void *parsed_result, if (!strcmp(res->mac, "mac_addr")) { filter.flags |= RTE_ETHTYPE_FLAGS_MAC; rte_memcpy(&filter.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } if (!strcmp(res->drop, "drop")) filter.flags |= RTE_ETHTYPE_FLAGS_DROP; @@ -10512,7 +10512,7 @@ struct cmd_flow_director_result { cmdline_fixed_string_t fd_id; uint32_t fd_id_value; cmdline_fixed_string_t mac; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; cmdline_fixed_string_t tunnel; cmdline_fixed_string_t tunnel_type; cmdline_fixed_string_t tunnel_id; @@ -10815,12 +10815,12 @@ cmd_flow_director_filter_parsed(void *parsed_result, if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) { rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); entry.input.flow.tunnel_flow.tunnel_type = str2fdir_tunneltype(res->tunnel_type); entry.input.flow.tunnel_flow.tunnel_id = @@ -12252,7 +12252,7 @@ struct cmd_mcast_addr_result { cmdline_fixed_string_t mcast_addr_cmd; cmdline_fixed_string_t what; uint16_t port_num; - struct ether_addr mc_addr; + struct rte_ether_addr mc_addr; }; static void cmd_mcast_addr_parsed(void *parsed_result, @@ -13671,7 +13671,7 @@ struct cmd_set_vf_mac_addr_result { cmdline_fixed_string_t addr; portid_t port_id; uint16_t vf_id; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; @@ -13976,7 +13976,7 @@ struct cmd_macsec_sc_result { cmdline_fixed_string_t sc; cmdline_fixed_string_t tx_rx; portid_t port_id; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t pi; }; @@ -14975,8 +14975,8 @@ struct cmd_set_vxlan_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_vxlan_set = @@ -15144,8 +15144,8 @@ struct cmd_set_nvgre_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_nvgre_set = diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index a527b6bb4..6c5538d9c 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3831,7 +3831,7 @@ parse_mac_addr(struct context *ctx, const struct token *token, void *buf, unsigned int size) { const struct arg *arg = pop_args(ctx); - struct ether_addr tmp; + struct rte_ether_addr tmp; int ret; (void)token; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 169662321..614719ec0 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -104,7 +104,7 @@ const struct rss_type_info rss_type_table[] = { }; static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -387,7 +387,7 @@ void port_infos_display(portid_t port_id) { struct rte_port *port; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link link; struct rte_eth_dev_info dev_info; int vlan_offload; @@ -534,7 +534,7 @@ port_summary_header_display(void) void port_summary_display(portid_t port_id) { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link link; struct rte_eth_dev_info dev_info; char name[RTE_ETH_NAME_MAX_LEN]; @@ -2508,7 +2508,7 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) * Check that each segment length is greater or equal than * the mbuf data sise. * Check also that the total packet length is greater or equal than the - * size of an empty UDP/IP packet (sizeof(struct ether_hdr) + 20 + 8). + * size of an empty UDP/IP packet (sizeof(struct rte_ether_hdr) + 20 + 8). */ tx_pkt_len = 0; for (i = 0; i < nb_segs; i++) { @@ -2519,10 +2519,10 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) } tx_pkt_len = (uint16_t)(tx_pkt_len + seg_lengths[i]); } - if (tx_pkt_len < (sizeof(struct ether_hdr) + 20 + 8)) { + if (tx_pkt_len < (sizeof(struct rte_ether_hdr) + 20 + 8)) { printf("total packet length=%u < %d - give up\n", (unsigned) tx_pkt_len, - (int)(sizeof(struct ether_hdr) + 20 + 8)); + (int)(sizeof(struct rte_ether_hdr) + 20 + 8)); return; } @@ -3448,7 +3448,7 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) static int mcast_addr_pool_extend(struct rte_port *port) { - struct ether_addr *mc_pool; + struct rte_ether_addr *mc_pool; size_t mc_pool_size; /* @@ -3465,9 +3465,9 @@ mcast_addr_pool_extend(struct rte_port *port) * The previous test guarantees that port->mc_addr_nb is a multiple * of MCAST_POOL_INC. */ - mc_pool_size = sizeof(struct ether_addr) * (port->mc_addr_nb + + mc_pool_size = sizeof(struct rte_ether_addr) * (port->mc_addr_nb + MCAST_POOL_INC); - mc_pool = (struct ether_addr *) realloc(port->mc_addr_pool, + mc_pool = (struct rte_ether_addr *) realloc(port->mc_addr_pool, mc_pool_size); if (mc_pool == NULL) { printf("allocation of pool of %u multicast addresses failed\n", @@ -3496,7 +3496,7 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx) } memmove(&port->mc_addr_pool[addr_idx], &port->mc_addr_pool[addr_idx + 1], - sizeof(struct ether_addr) * (port->mc_addr_nb - addr_idx)); + sizeof(struct rte_ether_addr) * (port->mc_addr_nb - addr_idx)); } static void @@ -3515,7 +3515,7 @@ eth_port_multicast_addr_list_set(portid_t port_id) } void -mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr) +mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) { struct rte_port *port; uint32_t i; @@ -3543,7 +3543,7 @@ mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr) } void -mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr) +mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr) { struct rte_port *port; uint32_t i; diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index dce4b9be7..2c458693d 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -138,18 +138,18 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) * header. The l4_len argument is only set in case of TCP (useful for TSO). */ static void -parse_ethernet(struct ether_hdr *eth_hdr, struct testpmd_offload_info *info) +parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - info->l2_len = sizeof(struct ether_hdr); + info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; if (info->ethertype == _htons(ETHER_TYPE_VLAN)) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - info->l2_len += sizeof(struct vlan_hdr); + info->l2_len += sizeof(struct rte_vlan_hdr); info->ethertype = vlan_hdr->eth_proto; } @@ -176,7 +176,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info, uint32_t pkt_type) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; /* check udp destination port, 4789 is the default vxlan port * (rfc7348) or that the rx offload flag is set (i40e only @@ -191,9 +191,9 @@ parse_vxlan(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)udp_hdr + + eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr) + - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); info->l2_len += ETHER_VXLAN_HLEN; /* add udp + vxlan */ @@ -204,17 +204,17 @@ static void parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - struct vxlan_gpe_hdr *vxlan_gpe_hdr; + struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); /* Check udp destination port. */ if (udp_hdr->dst_port != _htons(vxlan_gpe_udp_port)) return; - vxlan_gpe_hdr = (struct vxlan_gpe_hdr *)((char *)udp_hdr + + vxlan_gpe_hdr = (struct rte_vxlan_gpe_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == @@ -253,7 +253,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)vxlan_gpe_hdr + + eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ethernet(eth_hdr, info); @@ -267,7 +267,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; @@ -314,7 +314,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)gre_hdr + gre_len); + eth_hdr = (struct rte_ether_hdr *)((char *)gre_hdr + gre_len); parse_ethernet(eth_hdr, info); } else @@ -687,7 +687,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) struct rte_mbuf **tx_pkts_burst; struct rte_port *txp; struct rte_mbuf *m, *p; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; void *l3_hdr = NULL, *outer_l3_hdr = NULL; /* can be IPv4 or IPv6 */ void **gro_ctx; uint16_t gro_pkts_num; @@ -761,7 +761,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* step 1: dissect packet, parsing optional vlan, ip4/ip6, vxlan * and inner headers */ - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 0531b5d27..574162cd4 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -76,9 +76,9 @@ static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; -static struct ether_addr cfg_ether_src = +static struct rte_ether_addr cfg_ether_src = {{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x00 }}; -static struct ether_addr cfg_ether_dst = +static struct rte_ether_addr cfg_ether_dst = {{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x01 }}; #define IP_DEFTTL 64 /* from RFC 1340. */ @@ -119,7 +119,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mempool *mbp; struct rte_mbuf *pkt; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; @@ -170,7 +170,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->next = NULL; /* Initialize Ethernet header. */ - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); @@ -205,7 +205,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; - pkt->l2_len = sizeof(struct ether_hdr); + pkt->l2_len = sizeof(struct rte_ether_hdr); pkt->l3_len = sizeof(struct ipv4_hdr); pkts_burst[nb_pkt] = pkt; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 062e3ea43..49720ad41 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -221,7 +221,7 @@ ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf) } static void -ether_addr_dump(const char *what, const struct ether_addr *ea) +ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { char buf[ETHER_ADDR_FMT_SIZE]; @@ -275,12 +275,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *pkt; - struct ether_hdr *eth_h; - struct vlan_hdr *vlan_h; + struct rte_ether_hdr *eth_h; + struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; struct icmp_hdr *icmp_h; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; uint16_t nb_rx; @@ -321,9 +321,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); pkt = pkts_burst[i]; - eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_h->ether_type); - l2_len = sizeof(struct ether_hdr); + l2_len = sizeof(struct rte_ether_hdr); if (verbose_level > 0) { printf("\nPort %d pkt-len=%u nb-segs=%u\n", fs->rx_port, pkt->pkt_len, pkt->nb_segs); @@ -331,9 +331,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_dump(" dst=", ð_h->d_addr); } if (eth_type == ETHER_TYPE_VLAN) { - vlan_h = (struct vlan_hdr *) - ((char *)eth_h + sizeof(struct ether_hdr)); - l2_len += sizeof(struct vlan_hdr); + vlan_h = (struct rte_vlan_hdr *) + ((char *)eth_h + sizeof(struct rte_ether_hdr)); + l2_len += sizeof(struct rte_vlan_hdr); eth_type = rte_be_to_cpu_16(vlan_h->eth_proto); if (verbose_level > 0) { vlan_id = rte_be_to_cpu_16(vlan_h->vlan_tci) diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index 6ae802c86..c6aa3c618 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -93,8 +93,8 @@ static void ieee1588_packet_fwd(struct fwd_stream *fs) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; - struct ether_addr addr; + struct rte_ether_hdr *eth_hdr; + struct rte_ether_addr addr; struct ptpv2_msg *ptp_hdr; uint16_t eth_type; uint32_t timesync_index; @@ -111,7 +111,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * Check that the received packet is a PTP packet that was detected * by the hardware. */ - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) { @@ -141,7 +141,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * PTP_SYNC_MESSAGE. */ ptp_hdr = (struct ptpv2_msg *) (rte_pktmbuf_mtod(mb, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (ptp_hdr->version != 0x02) { printf("Port %u Received PTP V2 Ethernet frame with wrong PTP" " protocol version 0x%x (should be 0x02)\n", diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 7cac757a0..631f86f3e 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -49,7 +49,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_port *txp; struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t retry; uint16_t nb_rx; uint16_t nb_tx; @@ -91,14 +91,14 @@ pkt_burst_mac_forward(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); mb = pkts_burst[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; - mb->l2_len = sizeof(struct ether_hdr); + mb->l2_len = sizeof(struct rte_ether_hdr); mb->l3_len = sizeof(struct ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index a8384d5b8..36d385728 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -77,8 +77,8 @@ pkt_burst_mac_swap(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_port *txp; struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; - struct ether_addr addr; + struct rte_ether_hdr *eth_hdr; + struct rte_ether_addr addr; uint16_t nb_rx; uint16_t nb_tx; uint16_t i; @@ -120,7 +120,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); mb = pkts_burst[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ ether_addr_copy(ð_hdr->d_addr, &addr); @@ -129,7 +129,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; - mb->l2_len = sizeof(struct ether_hdr); + mb->l2_len = sizeof(struct rte_ether_hdr); mb->l3_len = sizeof(struct ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index b057365d1..b8a99065c 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -137,7 +137,7 @@ uint8_t txring_numa[RTE_MAX_ETHPORTS]; * Must be instantiated with the ethernet addresses of peer traffic generator * ports. */ -struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; +struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; portid_t nb_peer_eth_addrs = 0; /* @@ -1969,7 +1969,7 @@ start_port(portid_t pid) portid_t pi; queueid_t qi; struct rte_port *port; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; enum rte_eth_event_type event_type; if (port_id_is_invalid(pid, ENABLED_WARN)) diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 3da728cad..cc8618cc8 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -160,7 +160,7 @@ struct softnic_port { struct rte_port { struct rte_eth_dev_info dev_info; /**< PCI info + driver name */ struct rte_eth_conf dev_conf; /**< Port configuration. */ - struct ether_addr eth_addr; /**< Port ethernet address */ + struct rte_ether_addr eth_addr; /**< Port ethernet address */ struct rte_eth_stats stats; /**< Last port statistics */ uint64_t tx_dropped; /**< If no descriptor in TX ring */ struct fwd_stream *rx_stream; /**< Port RX stream, if unique */ @@ -187,7 +187,7 @@ struct rte_port { uint16_t nb_tx_desc[MAX_QUEUE_ID+1]; /**< per queue tx desc number */ struct rte_eth_rxconf rx_conf[MAX_QUEUE_ID+1]; /**< per queue rx configuration */ struct rte_eth_txconf tx_conf[MAX_QUEUE_ID+1]; /**< per queue tx configuration */ - struct ether_addr *mc_addr_pool; /**< pool of multicast addrs */ + struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */ struct port_flow *flow_list; /**< Associated flows. */ @@ -451,7 +451,7 @@ extern struct fwd_stream **fwd_streams; extern uint16_t vxlan_gpe_udp_port; /**< UDP port of tunnel VXLAN-GPE. */ extern portid_t nb_peer_eth_addrs; /**< Number of peer ethernet addresses. */ -extern struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for mac-retry. */ extern uint32_t burst_tx_retry_num; /**< Burst tx retry number for mac-retry. */ @@ -743,8 +743,8 @@ void show_gro(portid_t port_id); void setup_gso(const char *mode, portid_t port_id); /* Functions to manage the set of filtered Multicast MAC addresses */ -void mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr); -void mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr); +void mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr); +void mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr); void port_dcb_info_display(portid_t port_id); uint8_t *open_file(const char *file_path, uint32_t *size); diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 1f08b6ed3..3aa5e2560 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -158,7 +158,7 @@ pkt_burst_transmit(struct fwd_stream *fs) struct rte_mbuf *pkt; struct rte_mbuf *pkt_seg; struct rte_mempool *mbp; - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; uint16_t nb_tx; uint16_t nb_pkt; uint16_t vlan_tci, vlan_tci_outer; @@ -236,9 +236,9 @@ pkt_burst_transmit(struct fwd_stream *fs) */ copy_buf_to_pkt(ð_hdr, sizeof(eth_hdr), pkt, 0); copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr)); /* @@ -250,7 +250,7 @@ pkt_burst_transmit(struct fwd_stream *fs) pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; - pkt->l2_len = sizeof(struct ether_hdr); + pkt->l2_len = sizeof(struct rte_ether_hdr); pkt->l3_len = sizeof(struct ipv4_hdr); pkts_burst[nb_pkt] = pkt; } @@ -296,7 +296,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) { uint16_t pkt_data_len; - pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct ether_hdr) + + pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index f4125df7a..31815292e 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -14,7 +14,7 @@ #include "testpmd.h" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -26,7 +26,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, int is_rx) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; uint64_t ol_flags; uint16_t i, packet_type; @@ -45,7 +45,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], (unsigned int) nb_pkts); for (i = 0; i < nb_pkts; i++) { mb = pkts[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type); ol_flags = mb->ol_flags; packet_type = mb->packet_type; @@ -109,9 +109,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint8_t l3_len; uint8_t l4_len; uint8_t l4_proto; - struct vxlan_hdr *vxlan_hdr; + struct rte_vxlan_hdr *vxlan_hdr; - l2_len = sizeof(struct ether_hdr); + l2_len = sizeof(struct rte_ether_hdr); /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { @@ -133,7 +133,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], l2_len + l3_len); l4_len = sizeof(struct udp_hdr); vxlan_hdr = rte_pktmbuf_mtod_offset(mb, - struct vxlan_hdr *, + struct rte_vxlan_hdr *, l2_len + l3_len + l4_len); udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port); vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni); diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst index 9de14443e..fc9003a8b 100644 --- a/doc/guides/prog_guide/bbdev.rst +++ b/doc/guides/prog_guide/bbdev.rst @@ -752,12 +752,12 @@ buffers using (**sw_trubo**) bbdev PMD. for (j = 0; j < op_num; j++) { /* Append the size of the ethernet header */ rte_pktmbuf_append(input_pkts_burst[j], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* set op */ ops_burst[j]->turbo_enc.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); ops_burst[j]->turbo_enc->input.length = rte_pktmbuf_pkt_len(bbdev_pkts[j]); @@ -766,7 +766,7 @@ buffers using (**sw_trubo**) bbdev PMD. input_pkts_burst[j]; ops_burst[j]->turbo_enc->output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); ops_burst[j]->turbo_enc->output.data = output_pkts_burst[j]; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 003ed0356..ae51c80eb 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -91,7 +91,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -101,7 +101,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -111,7 +111,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -124,7 +124,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -134,7 +134,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -275,7 +275,7 @@ Forwarding application is shown below: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst index 0d6fe2bb3..21f017096 100644 --- a/doc/guides/sample_app_ug/flow_filtering.rst +++ b/doc/guides/sample_app_ug/flow_filtering.rst @@ -304,7 +304,7 @@ looks like the following: main_loop(void) { struct rte_mbuf *mbufs[32]; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t nb_rx; uint16_t i; uint16_t j; @@ -318,7 +318,7 @@ looks like the following: struct rte_mbuf *m = mbufs[j]; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", @@ -348,7 +348,7 @@ queues and printing for each packet the destination queue: if (nb_rx) { for (j = 0; j < nb_rx; j++) { struct rte_mbuf *m = mbufs[j]; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", ð_hdr->d_addr); printf(" - queue=0x%x", (unsigned int)i); diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index ce1474ec7..8f2fb3930 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct ether_hdr)); + iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -216,14 +216,14 @@ The actual packet transmission is done in the mcast_send_pkt() function: .. code-block:: c - static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) + static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t) sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t) sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index ba73d8557..15ca6db20 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -451,13 +451,13 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index 2b2d5afa0..33f7ee7ee 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -367,13 +367,13 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index ddd0f9a86..58c4aae92 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -270,10 +270,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index 695c088e8..50baf3467 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -311,11 +311,11 @@ The processing is very simple: processes the TX port from the RX port and then r static void lsi_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port = lsi_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/ptpclient.rst b/doc/guides/sample_app_ug/ptpclient.rst index 53de50374..8c1666145 100644 --- a/doc/guides/sample_app_ug/ptpclient.rst +++ b/doc/guides/sample_app_ug/ptpclient.rst @@ -212,17 +212,17 @@ PTP IEEE1588 L2 functionality. void parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { struct ptp_header *ptp_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == PTP_PROTOCOL) { ptp_data.m = m; ptp_data.portid = portid; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); switch (ptp_hdr->msgtype) { case SYNC: diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst index 85d96d8a2..36369dcde 100644 --- a/doc/guides/sample_app_ug/rxtx_callbacks.rst +++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst @@ -79,7 +79,7 @@ comments: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index adf258c0d..f7dab9e98 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -197,7 +197,7 @@ which tells the node where the packet has to be distributed. for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } @@ -357,7 +357,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst index 959561716..a73af7528 100644 --- a/doc/guides/sample_app_ug/skeleton.rst +++ b/doc/guides/sample_app_ug/skeleton.rst @@ -115,7 +115,7 @@ Forwarding application is shown below: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst b/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst index 0e9da9707..eaf38500e 100644 --- a/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst +++ b/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst @@ -165,7 +165,7 @@ the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02. }; /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ - static struct ether_addr pool_addr_template = { + static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; @@ -225,7 +225,7 @@ the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02. /* Set mac for each pool.*/ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; mac.addr_bytes[5] = q; diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 15bf73a40..d6eebc877 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -314,7 +314,7 @@ struct fman_if { /* The index of this MAC (within the Fman it belongs to) */ uint8_t mac_idx; /* The MAC address */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; /* The Qman channel to schedule Tx FQs to */ u16 tx_channel_id; /* The hard-coded FQIDs for this interface. Note: this doesn't cover diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h index 7818de68b..bf7bfae8c 100644 --- a/drivers/bus/dpaa/include/netcfg.h +++ b/drivers/bus/dpaa/include/netcfg.h @@ -30,8 +30,8 @@ struct netcfg_info { struct interface_info { char *name; - struct ether_addr mac_addr; - struct ether_addr peer_mac; + struct rte_ether_addr mac_addr; + struct rte_ether_addr peer_mac; int mac_present; int fman_enabled_mac_interface; }; diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 376d76302..b38e8eecc 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -72,7 +72,7 @@ struct pmd_internals { int if_index; char *if_name; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct tpacket_req req; diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index c26f0769e..bc15add31 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -41,9 +41,9 @@ static int eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); static void eth_ark_dev_stats_reset(struct rte_eth_dev *dev); static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int eth_ark_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, @@ -220,14 +220,14 @@ check_for_ext(struct ark_adapter *ark) (void (*)(struct rte_eth_dev *, void *)) dlsym(ark->d_handle, "stats_reset"); ark->user_ext.mac_addr_add = - (void (*)(struct rte_eth_dev *, struct ether_addr *, uint32_t, + (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, uint32_t, uint32_t, void *)) dlsym(ark->d_handle, "mac_addr_add"); ark->user_ext.mac_addr_remove = (void (*)(struct rte_eth_dev *, uint32_t, void *)) dlsym(ark->d_handle, "mac_addr_remove"); ark->user_ext.mac_addr_set = - (void (*)(struct rte_eth_dev *, struct ether_addr *, + (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, void *)) dlsym(ark->d_handle, "mac_addr_set"); ark->user_ext.set_mtu = @@ -834,7 +834,7 @@ eth_ark_dev_stats_reset(struct rte_eth_dev *dev) static int eth_ark_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { @@ -865,7 +865,7 @@ eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private; diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h index f5af21538..5a987e4d6 100644 --- a/drivers/net/ark/ark_ext.h +++ b/drivers/net/ark/ark_ext.h @@ -70,7 +70,7 @@ void stats_reset(struct rte_eth_dev *dev, void *user_data); void mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *macadr, + struct rte_ether_addr *macadr, uint32_t index, uint32_t pool, void *user_data); @@ -80,7 +80,7 @@ void mac_addr_remove(struct rte_eth_dev *dev, void *user_data); void mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, void *user_data); int set_mtu(struct rte_eth_dev *dev, diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h index f820091d7..f6609054d 100644 --- a/drivers/net/ark/ark_global.h +++ b/drivers/net/ark/ark_global.h @@ -71,12 +71,12 @@ struct ark_user_ext { int (*stats_get)(struct rte_eth_dev *, struct rte_eth_stats *, void *); void (*stats_reset)(struct rte_eth_dev *, void *); void (*mac_addr_add)(struct rte_eth_dev *, - struct ether_addr *, + struct rte_ether_addr *, uint32_t, uint32_t, void *); void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *); - void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *); + void (*mac_addr_set)(struct rte_eth_dev *, struct rte_ether_addr *, void *); int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *); }; diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 5bc04f55c..5be9e528c 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -91,14 +91,14 @@ static void atl_dev_interrupt_handler(void *param); static int atl_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); static int atl_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* RSS */ @@ -1226,7 +1226,7 @@ atl_update_mac_addr(struct rte_eth_dev *dev, uint32_t index, } static int -atl_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index __rte_unused, uint32_t pool __rte_unused) { if (is_zero_ether_addr(mac_addr)) { @@ -1244,7 +1244,7 @@ atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } static int -atl_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +atl_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { atl_remove_mac_addr(dev, 0); atl_add_mac_addr(dev, addr, 0, 0); @@ -1411,7 +1411,7 @@ atl_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue_id, int on) static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c index f11093a50..401bd11cf 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c @@ -654,8 +654,8 @@ static int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self, mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct ether_addr *)mac_addr, - (struct ether_addr *)mac); + ether_addr_copy((struct rte_ether_addr *)mac_addr, + (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { /* chip revision */ @@ -865,8 +865,8 @@ static int aq_fw1x_set_wol(struct aq_hw_s *self, bool wol_enabled, u8 *mac) prpc->msg_wol.pattern_id = 1U; prpc->msg_wol.wol_packet_type = 2U; /* Magic Packet */ - ether_addr_copy((struct ether_addr *)mac, - (struct ether_addr *)&prpc->msg_wol.wol_pattern); + ether_addr_copy((struct rte_ether_addr *)mac, + (struct rte_ether_addr *)&prpc->msg_wol.wol_pattern); } else { rpc_size = sizeof(prpc->msg_id) + sizeof(prpc->msg_del_id); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c index 6841d9bce..1fc18bb27 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -218,8 +218,8 @@ int aq_fw2x_get_mac_permanent(struct aq_hw_s *self, u8 *mac) mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct ether_addr *)mac_addr, - (struct ether_addr *)mac); + ether_addr_copy((struct rte_ether_addr *)mac_addr, + (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { unsigned int rnd = (uint32_t)rte_rand(); diff --git a/drivers/net/avf/avf.h b/drivers/net/avf/avf.h index dcf8d1c72..be43f343d 100644 --- a/drivers/net/avf/avf.h +++ b/drivers/net/avf/avf.h @@ -211,6 +211,6 @@ int avf_query_stats(struct avf_adapter *adapter, int avf_config_promisc(struct avf_adapter *adapter, bool enable_unicast, bool enable_multicast); int avf_add_del_eth_addr(struct avf_adapter *adapter, - struct ether_addr *addr, bool add); + struct rte_ether_addr *addr, bool add); int avf_add_del_vlan(struct avf_adapter *adapter, uint16_t vlanid, bool add); #endif /* _AVF_ETHDEV_H_ */ diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c index e56d57c43..523911e17 100644 --- a/drivers/net/avf/avf_ethdev.c +++ b/drivers/net/avf/avf_ethdev.c @@ -47,7 +47,7 @@ static void avf_dev_promiscuous_disable(struct rte_eth_dev *dev); static void avf_dev_allmulticast_enable(struct rte_eth_dev *dev); static void avf_dev_allmulticast_disable(struct rte_eth_dev *dev); static int avf_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, uint32_t pool); static void avf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index); @@ -66,7 +66,7 @@ static int avf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int avf_dev_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int avf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int avf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, @@ -687,7 +687,7 @@ avf_dev_allmulticast_disable(struct rte_eth_dev *dev) } static int -avf_dev_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr, +avf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -718,7 +718,7 @@ avf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) struct avf_adapter *adapter = AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(adapter); - struct ether_addr *addr; + struct rte_ether_addr *addr; int err; addr = &dev->data->mac_addrs[index]; @@ -930,16 +930,16 @@ avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int avf_dev_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct avf_adapter *adapter = AVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct avf_hw *hw = AVF_DEV_PRIVATE_TO_HW(adapter); - struct ether_addr *perm_addr, *old_addr; + struct rte_ether_addr *perm_addr, *old_addr; int ret; - old_addr = (struct ether_addr *)hw->mac.addr; - perm_addr = (struct ether_addr *)hw->mac.perm_addr; + old_addr = (struct rte_ether_addr *)hw->mac.addr; + perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; if (is_same_ether_addr(mac_addr, old_addr)) return 0; @@ -973,7 +973,7 @@ avf_dev_set_default_mac_addr(struct rte_eth_dev *dev, if (ret) return -EIO; - ether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } @@ -1244,9 +1244,9 @@ avf_dev_init(struct rte_eth_dev *eth_dev) /* If the MAC address is not configured by host, * generate a random one. */ - if (!is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) + if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) eth_random_addr(hw->mac.addr); - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* register callback func to eal lib */ diff --git a/drivers/net/avf/avf_vchnl.c b/drivers/net/avf/avf_vchnl.c index fd90cc2c3..6ccd7a1c9 100644 --- a/drivers/net/avf/avf_vchnl.c +++ b/drivers/net/avf/avf_vchnl.c @@ -636,7 +636,7 @@ avf_add_del_all_mac_addr(struct avf_adapter *adapter, bool add) { struct virtchnl_ether_addr_list *list; struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(adapter); - struct ether_addr *addr; + struct rte_ether_addr *addr; struct avf_cmd_info args; int len, err, i, j; int next_begin = 0; @@ -753,7 +753,7 @@ avf_config_promisc(struct avf_adapter *adapter, } int -avf_add_del_eth_addr(struct avf_adapter *adapter, struct ether_addr *addr, +avf_add_del_eth_addr(struct avf_adapter *adapter, struct rte_ether_addr *addr, bool add) { struct virtchnl_ether_addr_list *list; diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 0f8ccb954..834b1f3e1 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -159,7 +159,7 @@ static const struct eth_dev_ops avp_eth_dev_ops = { struct avp_dev { uint32_t magic; /**< Memory validation marker */ uint64_t device_id; /**< Unique system identifier */ - struct ether_addr ethaddr; /**< Host specified MAC address */ + struct rte_ether_addr ethaddr; /**< Host specified MAC address */ struct rte_eth_dev_data *dev_data; /**< Back pointer to ethernet device data */ volatile uint32_t flags; /**< Device operational flags */ @@ -1204,7 +1204,7 @@ avp_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, } static inline int -_avp_cmp_ether_addr(struct ether_addr *a, struct ether_addr *b) +_avp_cmp_ether_addr(struct rte_ether_addr *a, struct rte_ether_addr *b) { uint16_t *_a = (uint16_t *)&a->addr_bytes[0]; uint16_t *_b = (uint16_t *)&b->addr_bytes[0]; @@ -1214,7 +1214,7 @@ _avp_cmp_ether_addr(struct ether_addr *a, struct ether_addr *b) static inline int _avp_mac_filter(struct avp_dev *avp, struct rte_mbuf *m) { - struct ether_hdr *eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (likely(_avp_cmp_ether_addr(&avp->ethaddr, ð->d_addr) == 0)) { /* allow all packets destined to our address */ diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index b1cd2980b..810ac4a74 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -539,7 +539,7 @@ struct axgbe_port { /* Hardware features of the device */ struct axgbe_hw_features hw_feat; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; /* Software Tx/Rx structure pointers*/ void **rx_queues; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 279759366..f3e235534 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2168,8 +2168,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(pkt_prod); else { - struct ether_hdr *eh = - rte_pktmbuf_mtod(m0, struct ether_hdr *); + struct rte_ether_hdr *eh = + rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type)); @@ -2179,8 +2179,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) bd_prod = NEXT_TX_BD(bd_prod); if (IS_VF(sc)) { struct eth_tx_parse_bd_e2 *tx_parse_bd; - const struct ether_hdr *eh = - rte_pktmbuf_mtod(m0, struct ether_hdr *); + const struct rte_ether_hdr *eh = + rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); uint8_t mac_type = UNICAST_ADDRESS; tx_parse_bd = diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 0057843b5..37fd770e0 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -498,7 +498,7 @@ bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) } static int -bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct bnx2x_softc *sc = dev->data->dev_private; @@ -643,7 +643,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) } } - eth_dev->data->mac_addrs = (struct ether_addr *)sc->link_params.mac_addr; + eth_dev->data->mac_addrs = (struct rte_ether_addr *)sc->link_params.mac_addr; PMD_DRV_LOG(INFO, sc, "pcie_bus=%d, pcie_device=%d", sc->pcie_bus, sc->pcie_device); diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h index 807ba1780..c09f2f531 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.h +++ b/drivers/net/bnx2x/bnx2x_ethdev.h @@ -74,7 +74,7 @@ /* MAC address operations */ struct bnx2x_mac_ops { - void (*mac_addr_add)(struct rte_eth_dev *dev, struct ether_addr *addr, + void (*mac_addr_add)(struct rte_eth_dev *dev, struct rte_ether_addr *addr, uint16_t index, uint32_t pool); /* not implemented yet */ void (*mac_addr_remove)(struct rte_eth_dev *dev, uint16_t index); /* not implemented yet */ }; diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index 048bf126f..a044e6eac 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -302,7 +302,7 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ if (is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) ether_addr_copy(&sc_resp.resc.current_mac_addr, - (struct ether_addr *)sc->link_params.mac_addr); + (struct rte_ether_addr *)sc->link_params.mac_addr); else eth_random_addr(sc->link_params.mac_addr); diff --git a/drivers/net/bnx2x/bnx2x_vfpf.h b/drivers/net/bnx2x/bnx2x_vfpf.h index cc6fef956..6964c9d98 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.h +++ b/drivers/net/bnx2x/bnx2x_vfpf.h @@ -115,7 +115,7 @@ struct vf_resc { uint8_t num_vlan_filters; uint8_t num_mc_filters; uint8_t permanent_mac_addr[ETH_ALEN]; - struct ether_addr current_mac_addr; + struct rte_ether_addr current_mac_addr; uint16_t pf_link_speed; uint32_t pf_link_supported; }; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index c11fe9c8c..3f2404a69 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -760,7 +760,7 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, } static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; @@ -1451,7 +1451,7 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) } static int -bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) +bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct bnxt *bp = (struct bnxt *)dev->data->dev_private; /* Default Filter is tied to VNIC 0 */ @@ -1489,7 +1489,7 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) static int bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 999976054..b6f76128f 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2578,7 +2578,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, struct hwrm_func_cfg_input *cfg_req, int vf) { - struct ether_addr mac; + struct rte_ether_addr mac; if (bnxt_hwrm_func_qcfg_vf_default_mac(bp, vf, &mac)) return; @@ -3112,7 +3112,7 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id, } int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac) + struct rte_ether_addr *mac) { struct hwrm_func_qcfg_input req = {0}; struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index ec9b3e007..53d79f046 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -130,7 +130,7 @@ int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf, uint16_t max_bw, uint16_t enables); int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf); int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac); + struct rte_ether_addr *mac); int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf); int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port, uint8_t tunnel_type); diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index c298de83c..5e3d1bfb1 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.c +++ b/drivers/net/bnxt/rte_pmd_bnxt.c @@ -132,7 +132,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on) } int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; @@ -647,7 +647,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, count); } -int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr, +int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, uint32_t vf_id) { struct rte_eth_dev *dev; @@ -655,7 +655,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr, struct bnxt *bp; struct bnxt_filter_info *filter; struct bnxt_vnic_info vnic; - struct ether_addr dflt_mac; + struct rte_ether_addr dflt_mac; int rc; dev = &rte_eth_devices[port]; diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h index 68fbe34d6..2e893cc7b 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.h +++ b/drivers/net/bnxt/rte_pmd_bnxt.h @@ -67,7 +67,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on); * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable vf vlan strip for all queues in a pool @@ -303,7 +303,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, * - (-ENOTSUP) Ethernet device is not a PF * - (-ENOMEM) on an allocation failure */ -int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *mac_addr, +int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *mac_addr, uint32_t vf_id); /** diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h index b668ff9ad..874aa91a5 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -225,7 +225,7 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], */ int rte_eth_bond_mac_address_set(uint16_t bonded_port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Reset bonded device to use MAC from primary slave on bonded device and it's diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index f8cea4b6d..608d754a4 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -126,7 +126,7 @@ bond_print_lacp(struct lacpdu *l) #define MODE4_DEBUG(fmt, ...) do { } while (0) #endif -static const struct ether_addr lacp_mac_addr = { +static const struct rte_ether_addr lacp_mac_addr = { .addr_bytes = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; @@ -803,7 +803,7 @@ bond_mode_8023ad_periodic_cb(void *arg) struct bond_dev_private *internals = bond_dev->data->dev_private; struct port *port; struct rte_eth_link link_info; - struct ether_addr slave_addr; + struct rte_ether_addr slave_addr; struct rte_mbuf *lacp_pkt = NULL; uint8_t i, slave_id; @@ -1037,7 +1037,7 @@ void bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) { struct bond_dev_private *internals = bond_dev->data->dev_private; - struct ether_addr slave_addr; + struct rte_ether_addr slave_addr; struct port *slave, *agg_slave; uint16_t slave_id, i, j; diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h index d8b5dbc21..cbad59aa7 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h @@ -58,14 +58,14 @@ struct slow_protocol { /** Generic slow protocol frame type structure */ struct slow_protocol_frame { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct slow_protocol slow_protocol; } __attribute__((__packed__)); struct port_params { uint16_t system_priority; /**< System priority (unused in current implementation) */ - struct ether_addr system; + struct rte_ether_addr system; /**< System ID - Slave MAC address, same as bonding MAC address */ uint16_t key; /**< Speed information (implementation dependednt) and duplex. */ @@ -103,7 +103,7 @@ struct lacpdu { /** LACPDU frame: Contains ethernet header and LACPDU. */ struct lacpdu_header { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct lacpdu lacpdu; } __attribute__((__packed__)); @@ -114,7 +114,7 @@ struct marker { uint8_t tlv_type_marker; uint8_t info_length; uint16_t requester_port; - struct ether_addr requester_system; + struct rte_ether_addr requester_system; uint32_t requester_transaction_id; uint8_t reserved_2[2]; @@ -124,7 +124,7 @@ struct marker { } __attribute__((__packed__)); struct marker_header { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct marker marker; } __attribute__((__packed__)); diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 7ae240345..24b2b505a 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -72,7 +72,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) return -ENOMEM; } -void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, +void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { struct rte_arp_hdr *arp; @@ -102,7 +102,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, client_info->app_ip != arp->arp_data.arp_tip || client_info->cli_ip != arp->arp_data.arp_sip || !is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || - client_info->vlan_count != offset / sizeof(struct vlan_hdr) || + client_info->vlan_count != offset / sizeof(struct rte_vlan_hdr) || memcmp(client_info->vlan, eth_h + 1, offset) != 0 ) { client_info->in_use = 1; @@ -113,14 +113,14 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); } internals->mode6.ntt = 1; rte_spinlock_unlock(&internals->mode6.lock); } uint16_t -bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { struct rte_arp_hdr *arp; @@ -130,7 +130,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, uint8_t hash_index; - struct ether_addr bonding_mac; + struct rte_ether_addr bonding_mac; arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); @@ -163,7 +163,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); return client_info->slave_idx; } @@ -179,7 +179,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); return client_info->slave_idx; } @@ -195,12 +195,12 @@ uint16_t bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals) { - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; struct rte_arp_hdr *arp_h; uint16_t slave_idx; rte_spinlock_lock(&internals->mode6.lock); - eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ether_addr_copy(&client_info->app_mac, ð_h->s_addr); ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); @@ -209,11 +209,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, else eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) - + client_info->vlan_count * sizeof(struct vlan_hdr)); + arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct rte_ether_hdr) + + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); memcpy(eth_h + 1, client_info->vlan, - client_info->vlan_count * sizeof(struct vlan_hdr)); + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); arp_h->arp_data.arp_sip = client_info->app_ip; diff --git a/drivers/net/bonding/rte_eth_bond_alb.h b/drivers/net/bonding/rte_eth_bond_alb.h index 4640fd24e..386e70c59 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.h +++ b/drivers/net/bonding/rte_eth_bond_alb.h @@ -13,11 +13,11 @@ struct client_data { /** ARP data of single client */ - struct ether_addr app_mac; + struct rte_ether_addr app_mac; /**< MAC address of application running DPDK */ uint32_t app_ip; /**< IP address of application running DPDK */ - struct ether_addr cli_mac; + struct rte_ether_addr cli_mac; /**< Client MAC address */ uint32_t cli_ip; /**< Client IP address */ @@ -29,7 +29,7 @@ struct client_data { uint8_t ntt; /**< Flag indicating if we need to send update to this client on next tx */ - struct vlan_hdr vlan[2]; + struct rte_vlan_hdr vlan[2]; /**< Content of vlan headers */ uint8_t vlan_count; /**< Number of nested vlan headers */ @@ -68,7 +68,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev); * @param internals Bonding data. */ void -bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** @@ -85,7 +85,7 @@ bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, * Index of slave on which packet should be sent. */ uint16_t -bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 21bcd5044..b64db79dd 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -835,7 +835,7 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], int rte_eth_bond_mac_address_set(uint16_t bonded_port_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index b60fde6a8..01bbb06c1 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -282,7 +282,7 @@ bond_ethdev_parse_bond_mac_addr_kvarg(const char *key __rte_unused, /* Parse MAC */ return cmdline_parse_etheraddr(NULL, value, extra_args, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } int diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 52724640f..2eda2f79f 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -33,21 +33,21 @@ static uint64_t tlb_last_obytets[RTE_MAX_ETHPORTS]; static inline size_t -get_vlan_offset(struct ether_hdr *eth_hdr, uint16_t *proto) +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) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - vlan_offset = sizeof(struct vlan_hdr); + vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; - vlan_offset += sizeof(struct vlan_hdr); + vlan_offset += sizeof(struct rte_vlan_hdr); } } return vlan_offset; @@ -392,9 +392,9 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, /* Cast to structure, containing bonded device's port id and queue id */ struct bond_rx_queue *bd_rx_q = (struct bond_rx_queue *)queue; struct bond_dev_private *internals = bd_rx_q->dev_private; - struct ether_addr bond_mac; + struct rte_ether_addr bond_mac; - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; const uint16_t ether_type_slow_be = rte_be_to_cpu_16(ETHER_TYPE_SLOW); uint16_t num_rx_total = 0; /* Total number of received packets */ @@ -442,7 +442,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, if (j + 3 < num_rx_total) rte_prefetch0(rte_pktmbuf_mtod(bufs[j + 3], void *)); - hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); subtype = ((struct slow_protocol_frame *)hdr)->slow_protocol.subtype; /* Remove packet from array if it is slow packet or slave is not @@ -584,7 +584,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) #endif static void -mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, +mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_h, uint16_t port, uint32_t __attribute__((unused)) *burstnumber) { struct ipv4_hdr *ipv4_h; @@ -629,7 +629,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; uint16_t ether_type, offset; uint16_t nb_recv_pkts; int i; @@ -637,7 +637,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) nb_recv_pkts = bond_ethdev_rx_burst(queue, bufs, nb_pkts); for (i = 0; i < nb_recv_pkts; i++) { - eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(bufs[i], struct rte_ether_hdr *); ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); @@ -737,7 +737,7 @@ bond_ethdev_tx_burst_active_backup(void *queue, } static inline uint16_t -ether_hash(struct ether_hdr *eth_hdr) +ether_hash(struct rte_ether_hdr *eth_hdr) { unaligned_uint16_t *word_src_addr = (unaligned_uint16_t *)eth_hdr->s_addr.addr_bytes; @@ -774,12 +774,12 @@ void burst_xmit_l2_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint8_t slave_count, uint16_t *slaves) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t hash; int i; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); hash = ether_hash(eth_hdr); @@ -792,13 +792,13 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint8_t slave_count, uint16_t *slaves) { uint16_t i; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t proto; size_t vlan_offset; uint32_t hash, l3hash; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); l3hash = 0; proto = eth_hdr->ether_type; @@ -829,7 +829,7 @@ void burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint8_t slave_count, uint16_t *slaves) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t proto; size_t vlan_offset; int i; @@ -839,7 +839,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); proto = eth_hdr->ether_type; vlan_offset = get_vlan_offset(eth_hdr, &proto); l3hash = 0; @@ -1001,9 +1001,9 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) uint16_t num_of_slaves = internals->active_slave_count; uint16_t slaves[RTE_MAX_ETHPORTS]; - struct ether_hdr *ether_hdr; - struct ether_addr primary_slave_addr; - struct ether_addr active_slave_addr; + struct rte_ether_hdr *ether_hdr; + struct rte_ether_addr primary_slave_addr; + struct rte_ether_addr active_slave_addr; if (num_of_slaves < 1) return num_tx_total; @@ -1025,7 +1025,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (j + 3 < nb_pkts) rte_prefetch0(rte_pktmbuf_mtod(bufs[j+3], void*)); - ether_hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *); + ether_hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); if (is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) @@ -1061,7 +1061,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; uint16_t ether_type, offset; struct client_data *client_info; @@ -1091,7 +1091,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) /* Search tx buffer for ARP packets and forward them to alb */ for (i = 0; i < nb_pkts; i++) { - eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(bufs[i], struct rte_ether_hdr *); ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); @@ -1125,8 +1125,8 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) "Failed to allocate ARP packet from pool"); continue; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr) - + client_info->vlan_count * sizeof(struct vlan_hdr); + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr) + + client_info->vlan_count * sizeof(struct rte_vlan_hdr); upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; @@ -1157,7 +1157,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) /* Print TX stats including update packets */ for (j = 0; j < slave_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct rte_ether_hdr *); mode6_debug("TX ARP:", eth_h, i, &burstnumberTX); } #endif @@ -1174,7 +1174,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) for (j = 0; j < update_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct rte_ether_hdr *); mode6_debug("TX ARPupd:", eth_h, i, &burstnumberTX); } #endif @@ -1491,9 +1491,9 @@ link_properties_valid(struct rte_eth_dev *ethdev, } int -mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) +mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr) { - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); @@ -1512,9 +1512,9 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) } int -mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) +mac_address_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *new_mac_addr) { - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); @@ -1535,7 +1535,7 @@ mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) return 0; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; /* * Add additional MAC addresses to the slave @@ -1545,7 +1545,7 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, uint16_t slave_port_id) { int i, ret; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; @@ -1573,7 +1573,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, uint16_t slave_port_id) { int i, rc, ret; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; rc = 0; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { @@ -1996,7 +1996,7 @@ slave_add(struct bond_dev_private *internals, slave_details->link_status_wait_to_complete = 0; /* clean tlb_last_obytes when adding port for bonding device */ memcpy(&(slave_details->persisted_mac_addr), slave_eth_dev->data->mac_addrs, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } void @@ -2042,7 +2042,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) } if (internals->user_defined_mac == 0) { - struct ether_addr *new_mac_addr = NULL; + struct rte_ether_addr *new_mac_addr = NULL; for (i = 0; i < internals->slave_count; i++) if (internals->slaves[i].port_id == internals->primary_port) @@ -2905,7 +2905,7 @@ bond_ethdev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } static int -bond_ethdev_mac_address_set(struct rte_eth_dev *dev, struct ether_addr *addr) +bond_ethdev_mac_address_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { if (mac_address_set(dev, addr)) { RTE_BOND_LOG(ERR, "Failed to update MAC address"); @@ -2927,7 +2927,7 @@ bond_filter_ctrl(struct rte_eth_dev *dev __rte_unused, } static int -bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t vmdq) { struct rte_eth_dev *slave_eth_dev; @@ -2978,7 +2978,7 @@ bond_ethdev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) goto end; } - struct ether_addr *mac_addr = &dev->data->mac_addrs[index]; + struct rte_ether_addr *mac_addr = &dev->data->mac_addrs[index]; for (i = 0; i < internals->slave_count; i++) rte_eth_dev_mac_addr_remove(internals->slaves[i].port_id, @@ -3361,7 +3361,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) /* Parse MAC address for bonded device */ arg_count = rte_kvargs_count(kvlist, PMD_BOND_MAC_ADDR_KVARG); if (arg_count == 1) { - struct ether_addr bond_mac; + struct rte_ether_addr bond_mac; if (rte_kvargs_process(kvlist, PMD_BOND_MAC_ADDR_KVARG, &bond_ethdev_parse_bond_mac_addr_kvarg, &bond_mac) < 0) { diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 3ea5d686b..aa8148938 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -85,7 +85,7 @@ struct bond_slave_details { uint8_t link_status_wait_to_complete; uint8_t last_link_status; /**< Port Id of slave eth_dev */ - struct ether_addr persisted_mac_addr; + struct rte_ether_addr persisted_mac_addr; uint16_t reta_size; }; @@ -230,10 +230,10 @@ link_properties_valid(struct rte_eth_dev *bonded_eth_dev, struct rte_eth_link *slave_dev_link); int -mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr); +mac_address_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *new_mac_addr); int -mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr); +mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr); int mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev); diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index 47cfc5f5f..fc0af49cf 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -671,7 +671,7 @@ static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx, { struct port_info *pi = adap2pinfo(adapter, port_idx); - ether_addr_copy((struct ether_addr *)hw_addr, + ether_addr_copy((struct rte_ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0]); } diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index b2f83ea37..17728af01 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1055,7 +1055,7 @@ static int cxgbe_get_regs(struct rte_eth_dev *eth_dev, return 0; } -int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct port_info *pi = (struct port_info *)(dev->data->dev_private); int ret; diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 8d0a105aa..03145cea6 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -16,7 +16,7 @@ void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev); -int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr); +int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr); int cxgbe_dev_configure(struct rte_eth_dev *eth_dev); int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 5c743c3c8..9aaabf493 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -930,7 +930,7 @@ dpaa_flow_ctrl_get(struct rte_eth_dev *dev, static int dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, __rte_unused uint32_t pool) { @@ -960,7 +960,7 @@ dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev, static int dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { int ret; struct dpaa_if *dpaa_intf = dev->data->dev_private; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index c4471c227..937388cfb 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -198,7 +198,7 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) static inline void dpaa_checksum(struct rte_mbuf *mbuf) { - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 3987d13df..dcfc1a964 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1054,7 +1054,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int dpaa2_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -1085,7 +1085,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev, struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; PMD_INIT_FUNC_TRACE(); @@ -1105,7 +1105,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev, static int dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { int ret; struct dpaa2_dev_priv *priv = dev->data->dev_private; @@ -1843,13 +1843,13 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { */ static int populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, - struct ether_addr *mac_entry) + struct rte_ether_addr *mac_entry) { int ret; - struct ether_addr phy_mac, prime_mac; + struct rte_ether_addr phy_mac, prime_mac; - memset(&phy_mac, 0, sizeof(struct ether_addr)); - memset(&prime_mac, 0, sizeof(struct ether_addr)); + memset(&phy_mac, 0, sizeof(struct rte_ether_addr)); + memset(&prime_mac, 0, sizeof(struct rte_ether_addr)); /* Get the physical device MAC address */ ret = dpni_get_port_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, @@ -1883,7 +1883,7 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, ret); goto cleanup; } - memcpy(&prime_mac, &phy_mac, sizeof(struct ether_addr)); + memcpy(&prime_mac, &phy_mac, sizeof(struct rte_ether_addr)); } } else if (is_zero_ether_addr(&prime_mac)) { /* In case phys and prime, both are zero, create random MAC */ @@ -1898,7 +1898,7 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, } /* prime_mac the final MAC address */ - memcpy(mac_entry, &prime_mac, sizeof(struct ether_addr)); + memcpy(mac_entry, &prime_mac, sizeof(struct rte_ether_addr)); return 0; cleanup: diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 28c153512..b4bb13572 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -89,14 +89,14 @@ static int eth_em_led_on(struct rte_eth_dev *dev); static int eth_em_led_off(struct rte_eth_dev *dev); static int em_get_rx_buffer_size(struct e1000_hw *hw); -static int eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +static int eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index); static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); #define EM_FC_PAUSE_TIME 0x0680 @@ -293,7 +293,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, eth_dev->data->mac_addrs); /* initialize the vfta */ @@ -1738,7 +1738,7 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) } static int -eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, __rte_unused uint32_t pool) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1759,7 +1759,7 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { eth_em_rar_clear(dev, 0); @@ -1809,7 +1809,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct e1000_hw *hw; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index e542ef572..210e5c3bd 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -141,11 +141,11 @@ static int eth_igb_led_off(struct rte_eth_dev *dev); static void igb_intr_disable(struct e1000_hw *hw); static int igb_get_rx_buffer_size(struct e1000_hw *hw); static int eth_igb_rar_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index); static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static void igbvf_intr_disable(struct e1000_hw *hw); static int igbvf_dev_configure(struct rte_eth_dev *dev); @@ -170,7 +170,7 @@ static int igbvf_vlan_filter_set(struct rte_eth_dev *dev, static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on); static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on); static int igbvf_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static int igbvf_get_reg_length(struct rte_eth_dev *dev); static int igbvf_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs); @@ -227,7 +227,7 @@ static int eth_igb_get_module_info(struct rte_eth_dev *dev, static int eth_igb_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); static int igb_timesync_enable(struct rte_eth_dev *dev); static int igb_timesync_disable(struct rte_eth_dev *dev); @@ -819,7 +819,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* initialize the vfta */ memset(shadow_vfta, 0, sizeof(*shadow_vfta)); @@ -965,7 +965,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); int diag; - struct ether_addr *perm_addr = (struct ether_addr *)hw->mac.perm_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; PMD_INIT_FUNC_TRACE(); @@ -1039,7 +1039,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) return diag; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x " @@ -3097,7 +3097,7 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) #define E1000_RAH_POOLSEL_SHIFT (18) static int -eth_igb_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -3123,7 +3123,7 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { eth_igb_rar_clear(dev, 0); eth_igb_rar_set(dev, (void *)addr, 0, 0); @@ -3336,7 +3336,7 @@ igbvf_dev_close(struct rte_eth_dev *dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct e1000_adapter *adapter = E1000_DEV_PRIVATE(dev->data->dev_private); - struct ether_addr addr; + struct rte_ether_addr addr; PMD_INIT_FUNC_TRACE(); @@ -3481,7 +3481,7 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) } static int -igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4884,7 +4884,7 @@ eth_igb_filter_ctrl(struct rte_eth_dev *dev, static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct e1000_hw *hw; diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index b9f2e5391..9f1521350 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -306,8 +306,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); int rah; - if (is_unicast_ether_addr((struct ether_addr *)new_mac)) { - if (!is_zero_ether_addr((struct ether_addr *)new_mac)) + if (is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { + if (!is_zero_ether_addr((struct rte_ether_addr *)new_mac)) rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index c29a581e8..165ff52e5 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1655,9 +1655,9 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) ENA_ADMIN_FEATURE_OFFLOAD_DESC_TSO_IPV4_MASK; /* Copy MAC address and point DPDK to it */ - eth_dev->data->mac_addrs = (struct ether_addr *)adapter->mac_addr; - ether_addr_copy((struct ether_addr *)get_feat_ctx.dev_attr.mac_addr, - (struct ether_addr *)adapter->mac_addr); + eth_dev->data->mac_addrs = (struct rte_ether_addr *)adapter->mac_addr; + ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, + (struct rte_ether_addr *)adapter->mac_addr); adapter->drv_stats = rte_zmalloc("adapter stats", sizeof(*adapter->drv_stats), @@ -1964,7 +1964,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, * length of the ethernet header. */ if (unlikely(m->l2_len == 0)) - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 3ee7bb446..1541368bc 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -98,7 +98,7 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x", diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 4d450fe0c..0d35a2027 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -579,7 +579,7 @@ static void enicpmd_dev_allmulticast_disable(struct rte_eth_dev *eth_dev) } static int enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct enic *enic = pmd_priv(eth_dev); @@ -604,7 +604,7 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index) } static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct enic *enic = pmd_priv(eth_dev); int ret; diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index bb9ed037a..dbd638da9 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -497,8 +497,8 @@ static int enic_copy_item_eth_v2(const struct rte_flow_item *item, struct filter_v2 *enic_filter, u8 *inner_ofst) { - struct ether_hdr enic_spec; - struct ether_hdr enic_mask; + struct rte_ether_hdr enic_spec; + struct rte_ether_hdr enic_mask; const struct rte_flow_item_eth *spec = item->spec; const struct rte_flow_item_eth *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; @@ -527,20 +527,20 @@ enic_copy_item_eth_v2(const struct rte_flow_item *item, if (*inner_ofst == 0) { /* outer header */ memcpy(gp->layer[FILTER_GENERIC_1_L2].mask, &enic_mask, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L2].val, &enic_spec, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); } else { /* inner header */ - if ((*inner_ofst + sizeof(struct ether_hdr)) > + if ((*inner_ofst + sizeof(struct rte_ether_hdr)) > FILTER_GENERIC_1_KEY_LEN) return ENOTSUP; /* Offset into L5 where inner Ethernet header goes */ memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst], - &enic_mask, sizeof(struct ether_hdr)); + &enic_mask, sizeof(struct rte_ether_hdr)); memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst], - &enic_spec, sizeof(struct ether_hdr)); - *inner_ofst += sizeof(struct ether_hdr); + &enic_spec, sizeof(struct rte_ether_hdr)); + *inner_ofst += sizeof(struct rte_ether_hdr); } return 0; } @@ -574,9 +574,9 @@ enic_copy_item_vlan_v2(const struct rte_flow_item *item, mask = &rte_flow_item_vlan_mask; if (*inner_ofst == 0) { - struct ether_hdr *eth_mask = + struct rte_ether_hdr *eth_mask = (void *)gp->layer[FILTER_GENERIC_1_L2].mask; - struct ether_hdr *eth_val = + struct rte_ether_hdr *eth_val = (void *)gp->layer[FILTER_GENERIC_1_L2].val; /* Outer TPID cannot be matched */ @@ -590,14 +590,14 @@ enic_copy_item_vlan_v2(const struct rte_flow_item *item, gp->val_vlan = spec->tci; } else { /* Inner header. Mask/Val start at *inner_ofst into L5 */ - if ((*inner_ofst + sizeof(struct vlan_hdr)) > + if ((*inner_ofst + sizeof(struct rte_vlan_hdr)) > FILTER_GENERIC_1_KEY_LEN) return ENOTSUP; memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst], - mask, sizeof(struct vlan_hdr)); + mask, sizeof(struct rte_vlan_hdr)); memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst], - spec, sizeof(struct vlan_hdr)); - *inner_ofst += sizeof(struct vlan_hdr); + spec, sizeof(struct rte_vlan_hdr)); + *inner_ofst += sizeof(struct rte_vlan_hdr); } return 0; } @@ -870,11 +870,11 @@ enic_copy_item_vxlan_v2(const struct rte_flow_item *item, mask = &rte_flow_item_vxlan_mask; memcpy(gp->layer[FILTER_GENERIC_1_L5].mask, mask, - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L5].val, spec, - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); - *inner_ofst = sizeof(struct vxlan_hdr); + *inner_ofst = sizeof(struct rte_vxlan_hdr); return 0; } diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index b2581322d..e362219a5 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1675,7 +1675,7 @@ static int enic_dev_init(struct enic *enic) dev_err(enic, "mac addr storage alloc failed, aborting.\n"); return -1; } - ether_addr_copy((struct ether_addr *) enic->mac_addr, + ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, eth_dev->data->mac_addrs); vnic_dev_set_reset_flag(enic->vdev, 0); diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index c3999f026..495f536c7 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -158,7 +158,7 @@ static int fs_eth_dev_create(struct rte_vdev_device *vdev) { struct rte_eth_dev *dev; - struct ether_addr *mac; + struct rte_ether_addr *mac; struct fs_priv *priv; struct sub_device *sdev; const char *params; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 626883ce2..d19f83e8f 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -367,7 +367,7 @@ static int fs_get_mac_addr_arg(const char *key __rte_unused, const char *value, void *out) { - struct ether_addr *ea = out; + struct rte_ether_addr *ea = out; int ret; if ((value == NULL) || (out == NULL)) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 178316521..a7f2b0e17 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -166,7 +166,7 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, DEBUG("Configure additional MAC address%s", (PRIV(dev)->nb_mac_addr > 2 ? "es" : "")); for (i = 1; i < PRIV(dev)->nb_mac_addr; i++) { - struct ether_addr *ea; + struct rte_ether_addr *ea; ea = &dev->data->mac_addrs[i]; ret = rte_eth_dev_mac_addr_add(PORT_ID(sdev), ea, diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 7f8bcd4c6..27131c4ac 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -1081,7 +1081,7 @@ fs_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) static int fs_mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { @@ -1110,7 +1110,7 @@ fs_mac_addr_add(struct rte_eth_dev *dev, } static int -fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +fs_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct sub_device *sdev; uint8_t i; @@ -1134,7 +1134,7 @@ fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) static int fs_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct sub_device *sdev; uint8_t i; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 442e6199f..d9bef61a3 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -144,10 +144,10 @@ struct fs_priv { TAILQ_HEAD(sub_flows, rte_flow) flow_list; /* current number of mac_addr slots allocated. */ uint32_t nb_mac_addr; - struct ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; + struct rte_ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; uint32_t mac_addr_pool[FAILSAFE_MAX_ETHADDR]; uint32_t nb_mcast_addr; - struct ether_addr *mcast_addrs; + struct rte_ether_addr *mcast_addrs; /* current capabilities */ struct rte_eth_dev_info infos; struct rte_eth_dev_owner my_owner; /* Unique owner. */ diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index 46983e5df..eb3e13061 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -619,7 +619,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); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); macvlan->nb_queue_pools = nb_queue_pools; @@ -1669,7 +1669,7 @@ static void fm10k_MAC_filter_set(struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int fm10k_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { @@ -3084,7 +3084,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_read_mac_addr(hw); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); if (diag != FM10K_SUCCESS || @@ -3093,7 +3093,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /* Generate a random addr */ eth_random_addr(hw->mac.addr); memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index f7a685c8c..fa2e39aa2 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -266,7 +266,7 @@ static int i40e_flow_ctrl_set(struct rte_eth_dev *dev, static int i40e_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf); static int i40e_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); @@ -380,7 +380,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); @@ -1457,8 +1457,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) goto err_get_mac_addr; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.addr, - (struct ether_addr *) hw->mac.perm_addr); + ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + (struct rte_ether_addr *) hw->mac.perm_addr); /* Disable flow control */ hw->fc.requested_mode = I40E_FC_NONE; @@ -1512,7 +1512,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) "Failed to allocated memory for storing mac address"); goto err_mac_alloc; } - ether_addr_copy((struct ether_addr *)hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, &dev->data->mac_addrs[0]); /* Init dcb to sw mode by default */ @@ -3944,7 +3944,7 @@ i40e_priority_flow_ctrl_set(__rte_unused struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int i40e_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t pool) { @@ -3995,7 +3995,7 @@ i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_vsi *vsi; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; int ret; uint32_t i; uint64_t pool_sel; @@ -4036,8 +4036,8 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, { struct i40e_hw *hw; struct i40e_mac_filter_info mac_filter; - struct ether_addr old_mac; - struct ether_addr *new_mac; + struct rte_ether_addr old_mac; + struct rte_ether_addr *new_mac; struct i40e_pf_vf *vf = NULL; uint16_t vf_id; int ret; @@ -4098,7 +4098,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, /* Clear device address as it has been removed */ if (is_same_ether_addr(&(pf->dev_addr), new_mac)) - memset(&pf->dev_addr, 0, sizeof(struct ether_addr)); + memset(&pf->dev_addr, 0, sizeof(struct rte_ether_addr)); } return 0; @@ -5271,7 +5271,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) ret = i40e_aq_remove_macvlan(hw, vsi->seid, &def_filter, 1, NULL); if (ret != I40E_SUCCESS) { struct i40e_mac_filter *f; - struct ether_addr *mac; + struct rte_ether_addr *mac; PMD_DRV_LOG(DEBUG, "Cannot remove the default macvlan filter"); @@ -5291,7 +5291,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) return ret; } rte_memcpy(&filter.mac_addr, - (struct ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); + (struct rte_ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; return i40e_vsi_add_mac(vsi, &filter); } @@ -5409,7 +5409,7 @@ i40e_vsi_setup(struct i40e_pf *pf, struct i40e_mac_filter_info filter; int ret; struct i40e_vsi_context ctxt; - struct ether_addr broadcast = + struct rte_ether_addr broadcast = {.addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; if (type != I40E_VSI_MAIN && type != I40E_VSI_SRIOV && @@ -6836,7 +6836,7 @@ i40e_remove_macvlan_filters(struct i40e_vsi *vsi, /* Find out specific MAC filter */ static struct i40e_mac_filter * i40e_find_mac_filter(struct i40e_vsi *vsi, - struct ether_addr *macaddr) + struct rte_ether_addr *macaddr) { struct i40e_mac_filter *f; @@ -6920,7 +6920,7 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, - int num, struct ether_addr *addr) + int num, struct rte_ether_addr *addr) { int i; uint32_t j, k; @@ -7214,7 +7214,7 @@ i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *mac_filter) } int -i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr) +i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr) { struct i40e_mac_filter *f; struct i40e_macvlan_filter *mv_f; @@ -7508,10 +7508,10 @@ i40e_tunnel_filter_convert( struct i40e_aqc_cloud_filters_element_bb *cld_filter, struct i40e_tunnel_filter *tunnel_filter) { - ether_addr_copy((struct ether_addr *)&cld_filter->element.outer_mac, - (struct ether_addr *)&tunnel_filter->input.outer_mac); - ether_addr_copy((struct ether_addr *)&cld_filter->element.inner_mac, - (struct ether_addr *)&tunnel_filter->input.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, + (struct rte_ether_addr *)&tunnel_filter->input.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, + (struct rte_ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->element.inner_vlan; if ((rte_le_to_cpu_16(cld_filter->element.flags) & I40E_AQC_ADD_CLOUD_FLAGS_IPV6) == @@ -7620,9 +7620,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, pfilter = cld_filter; ether_addr_copy(&tunnel_filter->outer_mac, - (struct ether_addr *)&pfilter->element.outer_mac); + (struct rte_ether_addr *)&pfilter->element.outer_mac); ether_addr_copy(&tunnel_filter->inner_mac, - (struct ether_addr *)&pfilter->element.inner_mac); + (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); @@ -8064,9 +8064,9 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, pfilter = cld_filter; ether_addr_copy(&tunnel_filter->outer_mac, - (struct ether_addr *)&pfilter->element.outer_mac); + (struct rte_ether_addr *)&pfilter->element.outer_mac); ether_addr_copy(&tunnel_filter->inner_mac, - (struct ether_addr *)&pfilter->element.inner_mac); + (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); @@ -11835,7 +11835,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, } static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -11968,10 +11968,10 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) vsi = vf->vsi; } memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct ether_addr *)&f->input.outer_mac, - (struct ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct ether_addr *)&f->input.inner_mac, - (struct ether_addr *)&cld_filter.element.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, + (struct rte_ether_addr *)&cld_filter.element.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, + (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = f->input.inner_vlan; cld_filter.element.flags = f->input.flags; cld_filter.element.tenant_id = f->input.tenant_id; diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 11ecfc30d..09ee61d45 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -278,7 +278,7 @@ struct i40e_adapter; */ struct i40e_mac_filter_info { enum rte_mac_filter_type filter_type; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; TAILQ_HEAD(i40e_mac_filter_list, i40e_mac_filter); @@ -331,7 +331,7 @@ struct i40e_veb { /* i40e MACVLAN filter structure */ struct i40e_macvlan_filter { - struct ether_addr macaddr; + struct rte_ether_addr macaddr; enum rte_mac_filter_type filter_type; uint16_t vlan_id; }; @@ -422,7 +422,7 @@ struct i40e_pf_vf { uint16_t vf_idx; /* VF index in pf->vfs */ uint16_t lan_nb_qps; /* Actual queues allocated */ uint16_t reset_cnt; /* Total vf reset times */ - struct ether_addr mac_addr; /* Default MAC address */ + struct rte_ether_addr mac_addr; /* Default MAC address */ /* version of the virtchnl from VF */ struct virtchnl_version_info version; uint32_t request_caps; /* offload caps requested from VF */ @@ -642,7 +642,7 @@ struct i40e_fdir_info { /* Ethertype filter struct */ struct i40e_ethertype_filter_input { - struct ether_addr mac_addr; /* Mac address to match */ + struct rte_ether_addr mac_addr; /* Mac address to match */ uint16_t ether_type; /* Ether type to match */ }; @@ -760,8 +760,8 @@ enum i40e_tunnel_type { * Tunneling Packet filter configuration. */ struct i40e_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ uint32_t outer_vlan; /**< Outer VLAN to match */ enum i40e_tunnel_iptype ip_type; /**< IP address type. */ @@ -920,7 +920,7 @@ struct i40e_pf { bool offset_loaded; struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ - struct ether_addr dev_addr; /* PF device mac address */ + struct rte_ether_addr dev_addr; /* PF device mac address */ uint64_t flags; /* PF feature flags */ /* All kinds of queue pair setting for different VSIs */ struct i40e_pf_vf *vfs; @@ -1024,7 +1024,7 @@ struct i40e_vf { uint16_t promisc_flags; /* Promiscuous setting */ uint32_t vlan[I40E_VFTA_SIZE]; /* VLAN bit map */ - struct ether_addr mc_addrs[I40E_NUM_MACADDR_MAX]; /* Multicast addrs */ + struct rte_ether_addr mc_addrs[I40E_NUM_MACADDR_MAX]; /* Multicast addrs */ uint16_t mc_addrs_num; /* Multicast mac addresses number */ /* Event from pf */ @@ -1129,7 +1129,7 @@ int i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on); int i40e_vsi_add_vlan(struct i40e_vsi *vsi, uint16_t vlan); int i40e_vsi_delete_vlan(struct i40e_vsi *vsi, uint16_t vlan); int i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *filter); -int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr); +int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr); void i40e_update_vsi_stats(struct i40e_vsi *vsi); void i40e_pf_disable_irq0(struct i40e_hw *hw); void i40e_pf_enable_irq0(struct i40e_hw *hw); @@ -1204,7 +1204,7 @@ int i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, int i40e_fdir_flush(struct rte_eth_dev *dev); int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, - int num, struct ether_addr *addr); + int num, struct rte_ether_addr *addr); int i40e_remove_macvlan_filters(struct i40e_vsi *vsi, struct i40e_macvlan_filter *filter, int total); diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index baa6cc58f..601ffdc7c 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -106,7 +106,7 @@ static int i40evf_dev_tx_queue_start(struct rte_eth_dev *dev, static int i40evf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); static int i40evf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, uint32_t pool); static void i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index); @@ -123,7 +123,7 @@ static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int @@ -134,10 +134,10 @@ static void i40evf_handle_pf_event(struct rte_eth_dev *dev, static int i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr, bool add); static int -i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, +i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* Default hash key buffer for RSS */ @@ -754,7 +754,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev) static int i40evf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -796,7 +796,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev, static void i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct virtchnl_ether_addr_list *list; struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); @@ -837,7 +837,7 @@ static void i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) { struct rte_eth_dev_data *data = dev->data; - struct ether_addr *addr; + struct rte_ether_addr *addr; addr = &data->mac_addrs[index]; @@ -1223,7 +1223,7 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - if (is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; else eth_random_addr(hw->mac.addr); /* Generate a random one */ @@ -1460,7 +1460,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); return 0; @@ -1865,7 +1865,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) int next_begin = 0; int begin = 0; uint32_t len; - struct ether_addr *addr; + struct rte_ether_addr *addr; struct vf_cmd_info args; do { @@ -2634,7 +2634,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2647,18 +2647,18 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, if (vf->flags & I40E_FLAG_VF_MAC_BY_PF) return -EPERM; - i40evf_del_mac_addr_by_addr(dev, (struct ether_addr *)hw->mac.addr); + i40evf_del_mac_addr_by_addr(dev, (struct rte_ether_addr *)hw->mac.addr); if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0) return -EIO; - ether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } static int i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addrs, + struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num, bool add) { struct virtchnl_ether_addr_list *list; @@ -2712,7 +2712,7 @@ i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, } static int -i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addrs, +i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4b32fee1e..dd940cecb 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -685,7 +685,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, { static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; - uint8_t len = 2 * sizeof(struct ether_addr); + uint8_t len = 2 * sizeof(struct rte_ether_addr); struct ipv4_hdr *ip; struct ipv6_hdr *ip6; static const uint8_t next_proto[] = { @@ -701,7 +701,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, [RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), @@ -959,7 +959,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, struct i40e_customized_pctype *cus_pctype = NULL; static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; - uint8_t len = 2 * sizeof(struct ether_addr); + uint8_t len = 2 * sizeof(struct rte_ether_addr); struct ipv4_hdr *ip; struct ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; @@ -977,7 +977,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 7d787c173..210552e36 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -4803,10 +4803,10 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, int ret = 0; memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct ether_addr *)&filter->input.outer_mac, - (struct ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct ether_addr *)&filter->input.inner_mac, - (struct ether_addr *)&cld_filter.element.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, + (struct rte_ether_addr *)&cld_filter.element.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, + (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = filter->input.inner_vlan; cld_filter.element.flags = filter->input.flags; cld_filter.element.tenant_id = filter->input.tenant_id; diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index dd3962d38..5b77fa7fd 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -349,7 +349,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; ether_addr_copy(&vf->mac_addr, - (struct ether_addr *)vf_res->vsi_res[0].default_mac_addr); + (struct rte_ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_VF_RESOURCES, @@ -823,7 +823,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, (struct virtchnl_ether_addr_list *)msg; struct i40e_mac_filter_info filter; int i; - struct ether_addr *mac; + struct rte_ether_addr *mac; if (!b_op) { i40e_pf_host_send_msg_to_vf( @@ -842,7 +842,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 ether_addr *)(addr_list->list[i].addr); + mac = (struct rte_ether_addr *)(addr_list->list[i].addr); rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; if (is_zero_ether_addr(mac) || @@ -869,7 +869,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf, struct virtchnl_ether_addr_list *addr_list = (struct virtchnl_ether_addr_list *)msg; int i; - struct ether_addr *mac; + struct rte_ether_addr *mac; if (!b_op) { i40e_pf_host_send_msg_to_vf( @@ -886,7 +886,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf, } for (i = 0; i < addr_list->num_elements; i++) { - mac = (struct ether_addr *)(addr_list->list[i].addr); + mac = (struct rte_ether_addr *)(addr_list->list[i].addr); if(is_zero_ether_addr(mac) || i40e_vsi_delete_mac(vf->vsi, mac)) { ret = I40E_ERR_INVALID_MAC_ADDR; diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index 24751d13c..91de07603 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -324,7 +324,7 @@ i40e_vf_representor_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index) static int i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_vf_representor *representor = ethdev->data->dev_private; diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index bba62b1c5..e7b333655 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -528,7 +528,7 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on) int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_mac_filter *f; struct rte_eth_dev *dev; @@ -570,11 +570,11 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, return 0; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct i40e_pf_vf *vf; @@ -723,7 +723,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, struct i40e_vsi *vsi; struct i40e_hw *hw; struct i40e_mac_filter_info filter; - struct ether_addr broadcast = { + struct rte_ether_addr broadcast = { .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; int ret; @@ -2354,7 +2354,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct i40e_pf_vf *vf; @@ -2491,10 +2491,10 @@ rte_pmd_i40e_flow_type_mapping_update( } int -rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct ether_addr *vf_mac) +rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct rte_ether_addr *vf_mac) { struct rte_eth_dev *dev; - struct ether_addr *mac; + struct rte_ether_addr *mac; struct i40e_pf *pf; int vf_id; struct i40e_pf_vf *vf; diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h index be4a6024a..55e7fa9f9 100644 --- a/drivers/net/i40e/rte_pmd_i40e.h +++ b/drivers/net/i40e/rte_pmd_i40e.h @@ -453,7 +453,7 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Remove the VF MAC address. @@ -471,7 +471,7 @@ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, */ int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable vf vlan strip for all queues in a pool @@ -854,7 +854,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); #define RTE_PMD_I40E_PCTYPE_MAX 64 #define RTE_PMD_I40E_FLOW_TYPE_MAX 64 @@ -924,7 +924,7 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port); * -ENOTSUP: i40e not supported for this port. */ int rte_pmd_i40e_query_vfid_by_mac(uint16_t port, - const struct ether_addr *vf_mac); + const struct rte_ether_addr *vf_mac); /** * Do RSS queue region configuration for that port as diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index c458bffc0..e7e1bae26 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -220,11 +220,11 @@ static int ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev); static int ixgbe_dev_interrupt_action(struct rte_eth_dev *dev); static void ixgbe_dev_interrupt_handler(void *param); static void ixgbe_dev_interrupt_delayed_handler(void *param); -static int ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +static int ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index); static int ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config); static bool is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv); @@ -263,7 +263,7 @@ static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev); /* For Eth VMDQ APIs support */ static int ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct - ether_addr * mac_addr, uint8_t on); + rte_ether_addr * mac_addr, uint8_t on); static int ixgbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on); static int ixgbe_mirror_rule_set(struct rte_eth_dev *dev, struct rte_eth_mirror_conf *mirror_conf, @@ -279,11 +279,11 @@ static void ixgbe_set_ivar_map(struct ixgbe_hw *hw, int8_t direction, static void ixgbe_configure_msix(struct rte_eth_dev *dev); static int ixgbevf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); static int ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int ixgbe_syn_filter_get(struct rte_eth_dev *dev, struct rte_eth_syn_filter *filter); static int ixgbe_syn_filter_handle(struct rte_eth_dev *dev, @@ -310,7 +310,7 @@ static int ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu); static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); static int ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info); @@ -1215,7 +1215,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ @@ -1525,7 +1525,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw) } static void -generate_random_mac_addr(struct ether_addr *mac_addr) +generate_random_mac_addr(struct rte_ether_addr *mac_addr) { uint64_t random; @@ -1556,7 +1556,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) IXGBE_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private); struct ixgbe_hwstrip *hwstrip = IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private); - struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *) hw->mac.perm_addr; PMD_INIT_FUNC_TRACE(); @@ -4863,7 +4863,7 @@ ixgbe_dev_rss_reta_query(struct rte_eth_dev *dev, } static int -ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4882,7 +4882,7 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) } static int -ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -5319,7 +5319,7 @@ ixgbe_vt_check(struct ixgbe_hw *hw) } static uint32_t -ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr) +ixgbe_uta_vector(struct ixgbe_hw *hw, struct rte_ether_addr *uc_addr) { uint32_t vector = 0; @@ -5350,7 +5350,7 @@ ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr) } static int -ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint8_t on) { uint32_t vector; @@ -5982,7 +5982,7 @@ ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev, } static int -ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __attribute__((unused)) uint32_t index, __attribute__((unused)) uint32_t pool) { @@ -5994,7 +5994,7 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * operation. Trap this case to avoid exhausting the [very limited] * set of PF resources used to store VF MAC addresses. */ - if (memcmp(hw->mac.perm_addr, mac_addr, sizeof(struct ether_addr)) == 0) + if (memcmp(hw->mac.perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) return -1; diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes); if (diag != 0) @@ -6014,8 +6014,8 @@ static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr; - struct ether_addr *mac_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *) hw->mac.perm_addr; + struct rte_ether_addr *mac_addr; uint32_t i; int diag; @@ -6040,7 +6040,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) if (is_zero_ether_addr(mac_addr)) continue; /* Skip the permanent MAC address */ - if (memcmp(perm_addr, mac_addr, sizeof(struct ether_addr)) == 0) + if (memcmp(perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) continue; diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes); if (diag != 0) @@ -6059,7 +6059,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } static int -ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -6786,13 +6786,13 @@ ixgbe_dev_addr_list_itr(__attribute__((unused)) struct ixgbe_hw *hw, *vmdq = 0; mc_addr = *mc_addr_ptr; - *mc_addr_ptr = (mc_addr + sizeof(struct ether_addr)); + *mc_addr_ptr = (mc_addr + sizeof(struct rte_ether_addr)); return mc_addr; } static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct ixgbe_hw *hw; diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 4b833ffab..0840e14f3 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -480,7 +480,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) { + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c index b0fbbc49f..2836bae11 100644 --- a/drivers/net/ixgbe/ixgbe_vf_representor.c +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c @@ -25,7 +25,7 @@ ixgbe_vf_representor_link_update(struct rte_eth_dev *ethdev, static int ixgbe_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ixgbe_vf_representor *representor = ethdev->data->dev_private; @@ -210,7 +210,7 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) vf_data = *IXGBE_DEV_PRIVATE_TO_P_VFDATA( representor->pf_ethdev->data->dev_private); - ethdev->data->mac_addrs = (struct ether_addr *) + ethdev->data->mac_addrs = (struct rte_ether_addr *) vf_data[representor->vf_id].vf_mac_addresses; /* Link state. Inherited from PF */ diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 3a874f9a9..3defba175 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -11,7 +11,7 @@ int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ixgbe_hw *hw; struct ixgbe_vf_info *vfinfo; @@ -35,7 +35,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); rar_entry = hw->mac.num_rar_entries - (vf + 1); - if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) { + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, ETHER_ADDR_LEN); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h index 72a941f9d..84c688472 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h @@ -42,7 +42,7 @@ int rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf); * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable VF VLAN anti spoofing. diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 72f3c16c1..a78059c60 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -51,7 +51,7 @@ struct pmd_internals { int stop_thread; int no_request_thread; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct pmd_queue rx_queues[KNI_MAX_QUEUE_PER_PORT]; struct pmd_queue tx_queues[KNI_MAX_QUEUE_PER_PORT]; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 0f59e4475..ddf6bf6e6 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1834,7 +1834,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) 2 + i)); /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)mac, ð_dev->data->mac_addrs[0]); + ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); /* enable firmware checksum support for tunnel packets */ lio_enable_hw_tunnel_rx_checksum(eth_dev); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 3de7bc53e..b942eeebd 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -601,7 +601,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) struct ibv_pd *pd = NULL; struct priv *priv = NULL; struct rte_eth_dev *eth_dev = NULL; - struct ether_addr mac; + struct rte_ether_addr mac; /* If port is not enabled, skip. */ if (!(conf.ports.enabled & (1 << i))) diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index e6fb934fa..b843032cc 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -108,7 +108,7 @@ struct priv { } mr; LIST_HEAD(, mlx4_rss) rss; /**< Shared targets for Rx flow rules. */ LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */ - struct ether_addr mac[MLX4_MAX_MAC_ADDRESSES]; + struct rte_ether_addr mac[MLX4_MAX_MAC_ADDRESSES]; /**< Configured MAC addresses. Unused entries are zeroed. */ }; @@ -125,9 +125,9 @@ void mlx4_promiscuous_disable(struct rte_eth_dev *dev); void mlx4_allmulticast_enable(struct rte_eth_dev *dev); void mlx4_allmulticast_disable(struct rte_eth_dev *dev); void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); -int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); -int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); +int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); void mlx4_stats_reset(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 30deb3ef0..350271dc8 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -461,7 +461,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { struct priv *priv = dev->data->dev_private; @@ -539,7 +539,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { return mlx4_mac_addr_add(dev, mac_addr, 0, 0); } diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index b40e7e5c3..087725d7b 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -1349,7 +1349,7 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error) .type = RTE_FLOW_ACTION_TYPE_END, }, }; - struct ether_addr *rule_mac = ð_spec.dst; + struct rte_ether_addr *rule_mac = ð_spec.dst; rte_be16_t *rule_vlan = (priv->dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_VLAN_FILTER) && @@ -1386,7 +1386,7 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error) } } for (i = 0; i != RTE_DIM(priv->mac) + 1; ++i) { - const struct ether_addr *mac; + const struct rte_ether_addr *mac; /* Broadcasts are handled by an extra iteration. */ if (i < RTE_DIM(priv->mac)) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 8cbfee1ba..6f124dd24 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -742,7 +742,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, #ifdef HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT struct ibv_counter_set_description cs_desc = { .counter_type = 0 }; #endif - struct ether_addr mac; + struct rte_ether_addr mac; char name[RTE_ETH_NAME_MAX_LEN]; int own_domain_id = 0; unsigned int i; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 2dec88aef..47b9d9136 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -179,7 +179,7 @@ struct priv { struct ibv_pd *pd; /* Protection Domain. */ char ibdev_name[IBV_SYSFS_NAME_MAX]; /* IB device name. */ char ibdev_path[IBV_SYSFS_PATH_MAX]; /* IB device path for secondary */ - struct ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */ + struct rte_ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */ BITFIELD_DECLARE(mac_own, uint64_t, MLX5_MAX_MAC_ADDRESSES); /* Bit-field of MAC addresses owned by the PMD. */ uint16_t vlan_filter[MLX5_MAX_VLAN_IDS]; /* VLAN filters table. */ @@ -285,11 +285,11 @@ int mlx5_sysfs_switch_info(unsigned int ifindex, int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[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 ether_addr *mac, +int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq); -int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); +int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr); + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* mlx5_rss.c */ @@ -389,9 +389,9 @@ int mlx5_socket_connect(struct rte_eth_dev *priv); /* mlx5_nl.c */ int mlx5_nl_init(int protocol); -int mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +int mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); -int mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +int mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev); void mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 131b62b12..9b2b127fd 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -365,8 +365,8 @@ flow_tcf_pedit_key_set_mac(const struct rte_flow_action *actions, { int idx = p_parser->sel.nkeys; uint32_t off = actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_SRC ? - offsetof(struct ether_hdr, s_addr) : - offsetof(struct ether_hdr, d_addr); + offsetof(struct rte_ether_hdr, s_addr) : + offsetof(struct rte_ether_hdr, d_addr); const struct rte_flow_action_set_mac *conf = (const struct rte_flow_action_set_mac *)actions->conf; diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 672a47619..cee52a503 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -76,7 +76,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], index); - memset(&dev->data->mac_addrs[index], 0, sizeof(struct ether_addr)); + memset(&dev->data->mac_addrs[index], 0, sizeof(struct rte_ether_addr)); } /** @@ -93,7 +93,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct priv *priv = dev->data->dev_private; @@ -166,7 +166,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq __rte_unused) { int ret; @@ -195,7 +195,7 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { DRV_LOG(DEBUG, "port %u setting primary MAC address", dev->data->port_id); @@ -209,7 +209,7 @@ mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) */ int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { uint32_t i; int ret; diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index d61826aea..a82c0cc86 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -74,7 +74,7 @@ /* Add/remove MAC address through Netlink */ struct mlx5_nl_mac_addr { - struct ether_addr (*mac)[]; + struct rte_ether_addr (*mac)[]; /**< MAC address handled by the device. */ int mac_n; /**< Number of addresses in the array. */ }; @@ -358,7 +358,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], +mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr (*mac)[], int *mac_n) { struct priv *priv = dev->data->dev_private; @@ -417,7 +417,7 @@ mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, int add) { struct priv *priv = dev->data->dev_private; @@ -489,7 +489,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct priv *priv = dev->data->dev_private; @@ -517,7 +517,7 @@ mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct priv *priv = dev->data->dev_private; @@ -535,7 +535,7 @@ mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) { - struct ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; + struct rte_ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; int macs_n = 0; int i; int ret; @@ -576,7 +576,7 @@ mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev) int i; for (i = MLX5_MAX_MAC_ADDRESSES - 1; i >= 0; --i) { - struct ether_addr *m = &dev->data->mac_addrs[i]; + struct rte_ether_addr *m = &dev->data->mac_addrs[i]; if (BITFIELD_ISSET(priv->mac_own, i)) mlx5_nl_mac_addr_remove(dev, m, i); diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 1db468c3b..9aea61dc2 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -791,7 +791,7 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, * in if any of SWP offsets is set. Therefore, all of the L3 offsets * should be set regardless of HW offload. */ - off = buf->outer_l2_len + (vlan ? sizeof(struct vlan_hdr) : 0); + off = buf->outer_l2_len + (vlan ? sizeof(struct rte_vlan_hdr) : 0); offsets[1] = off >> 1; /* Outer L3 offset. */ off += buf->outer_l3_len; if (tunnel == PKT_TX_TUNNEL_UDP) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index e2a9bb703..686b9ec63 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -269,7 +269,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", }; const unsigned int vlan_filter_n = priv->vlan_filter_n; - const struct ether_addr cmp = { + const struct rte_ether_addr cmp = { .addr_bytes = "\x00\x00\x00\x00\x00\x00", }; unsigned int i; @@ -332,7 +332,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) } /* Add MAC address flows. */ for (i = 0; i != MLX5_MAX_MAC_ADDRESSES; ++i) { - struct ether_addr *mac = &dev->data->mac_addrs[i]; + struct rte_ether_addr *mac = &dev->data->mac_addrs[i]; if (!memcmp(mac, &cmp, sizeof(*mac))) continue; diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index f7071bc2e..8fd344165 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -616,7 +616,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative error value otherwise. */ static int -mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +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; @@ -649,7 +649,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * MAC address to register. */ static int -mvneta_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mvneta_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct mvneta_priv *priv = dev->data->dev_private; int ret; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 0682c635a..bffad9ca1 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1101,7 +1101,7 @@ mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative error value otherwise. */ static int -mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +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; @@ -1153,7 +1153,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * 0 on success, negative error value otherwise. */ static int -mrvl_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mrvl_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct mrvl_priv *priv = dev->data->dev_private; int ret; diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index ffd1dab9b..738986575 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -989,7 +989,7 @@ mrvl_parse_eth(const struct rte_flow_item *item, struct rte_flow *flow, struct rte_flow_error *error) { const struct rte_flow_item_eth *spec = NULL, *mask = NULL; - struct ether_addr zero; + struct rte_ether_addr zero; int ret; ret = mrvl_parse_init(item, (const void **)&spec, (const void **)&mask, diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 8e728d639..8e409eb7e 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -298,7 +298,7 @@ hn_dev_allmulticast_disable(struct rte_eth_dev *dev) static int hn_dev_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { /* No filtering on the synthetic path, but can do it on VF */ diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index f4a36641b..a5cc95231 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -108,7 +108,7 @@ static void hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) { uint32_t s = m->pkt_len; - const struct ether_addr *ea; + const struct rte_ether_addr *ea; if (s == 64) { stats->size_bins[1]++; @@ -127,7 +127,7 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) stats->size_bins[7]++; } - ea = rte_pktmbuf_mtod(m, const struct ether_addr *); + ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) stats->broadcast++; diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index e1072c7cf..269510aa9 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -126,7 +126,7 @@ struct hn_data { rte_atomic32_t rndis_req_id; uint8_t rndis_resp[256]; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_dev_owner owner; struct rte_intr_handle vf_intr; @@ -184,7 +184,7 @@ void hn_vf_allmulticast_disable(struct rte_eth_dev *dev); void hn_vf_promiscuous_enable(struct rte_eth_dev *dev); void hn_vf_promiscuous_disable(struct rte_eth_dev *dev); int hn_vf_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); int hn_vf_link_update(struct rte_eth_dev *dev, diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index 7a84ad8c9..96f9e5484 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -32,14 +32,14 @@ /* Search for VF with matching MAC address, return port id */ static int hn_vf_match(const struct rte_eth_dev *dev) { - const struct ether_addr *mac = dev->data->mac_addrs; + const struct rte_ether_addr *mac = dev->data->mac_addrs; char buf[32]; int i; ether_format_addr(buf, sizeof(buf), mac); RTE_ETH_FOREACH_DEV(i) { const struct rte_eth_dev *vf_dev = &rte_eth_devices[i]; - const struct ether_addr *vf_mac = vf_dev->data->mac_addrs; + const struct rte_ether_addr *vf_mac = vf_dev->data->mac_addrs; if (vf_dev == dev) continue; @@ -394,7 +394,7 @@ void hn_vf_promiscuous_disable(struct rte_eth_dev *dev) } int hn_vf_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct hn_data *hv = dev->data->dev_private; diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 4d6a797b0..56628b5b6 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -110,7 +110,7 @@ static int nfp_net_rss_reta_write(struct rte_eth_dev *dev, static int nfp_net_rss_hash_write(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int nfp_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE(_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) @@ -544,7 +544,7 @@ nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) } int -nfp_set_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct nfp_net_hw *hw; uint32_t update, ctrl; @@ -2888,7 +2888,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_vf_read_mac(hw); } - if (!is_valid_assigned_ether_addr((struct ether_addr *)&hw->mac_addr)) { + if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { PMD_INIT_LOG(INFO, "Using random mac address for port %d", port); /* Using random mac addresses for VFs */ @@ -2897,7 +2897,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) } /* Copying mac address to DPDK eth_dev struct */ - ether_addr_copy((struct ether_addr *)hw->mac_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 1e8237a41..b7975933c 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -73,7 +73,7 @@ struct pmd_internals { struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT]; struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT]; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; /** Bit mask of RSS offloads, the bit offset also means flow type */ uint64_t flow_type_rss_offloads; @@ -467,7 +467,7 @@ eth_rss_hash_conf_get(struct rte_eth_dev *dev, static int eth_mac_address_set(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct ether_addr *addr) + __rte_unused struct rte_ether_addr *addr) { return 0; } diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 5431b44dc..e4dbdc098 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -555,7 +555,7 @@ octeontx_dev_stats_reset(struct rte_eth_dev *dev) static int octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct octeontx_nic *nic = octeontx_pmd_priv(dev); int ret; diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index ede5ebb45..e0ac16c33 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -77,7 +77,7 @@ struct pcap_tx_queue { struct pmd_internals { struct pcap_rx_queue rx_queue[RTE_PMD_PCAP_MAX_QUEUES]; struct pcap_tx_queue tx_queue[RTE_PMD_PCAP_MAX_QUEUES]; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; int if_index; int single_iface; int phy_mac; @@ -918,7 +918,7 @@ pmd_init_internals(struct rte_vdev_device *vdev, * derived from: 'locally administered':'p':'c':'a':'p':'iface_idx' * where the middle 4 characters are converted to hex. */ - (*internals)->eth_addr = (struct ether_addr) { + (*internals)->eth_addr = (struct rte_ether_addr) { .addr_bytes = { 0x02, 0x70, 0x63, 0x61, 0x70, iface_idx++ } }; (*internals)->phy_mac = 0; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 5745832b9..57b02cea5 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -558,9 +558,9 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); struct qede_ucast_entry *tmp = NULL; struct qede_ucast_entry *u; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; - mac_addr = (struct ether_addr *)ucast->mac; + mac_addr = (struct rte_ether_addr *)ucast->mac; if (add) { SLIST_FOREACH(tmp, &qdev->uc_list_head, list) { if ((memcmp(mac_addr, &tmp->mac, @@ -604,7 +604,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } static int -qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, +qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); @@ -628,7 +628,7 @@ qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, mcast.num_mc_addrs = mc_addrs_num; mcast.opcode = ECORE_FILTER_ADD; for (i = 0; i < mc_addrs_num; i++) - ether_addr_copy(&mc_addrs[i], (struct ether_addr *) + ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) &mcast.mac[i]); rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { @@ -653,7 +653,7 @@ static int qede_del_mcast_filters(struct rte_eth_dev *eth_dev) mcast.opcode = ECORE_FILTER_REMOVE; j = 0; SLIST_FOREACH(tmp, &qdev->mc_list_head, list) { - ether_addr_copy(&tmp->mac, (struct ether_addr *)&mcast.mac[j]); + ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); j++; } rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); @@ -700,7 +700,7 @@ qede_mac_int_ops(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } static int -qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, +qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct ecore_filter_ucast ucast; @@ -712,7 +712,7 @@ qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, qede_set_ucast_cmn_params(&ucast); ucast.opcode = ECORE_FILTER_ADD; ucast.type = ECORE_FILTER_MAC; - ether_addr_copy(mac_addr, (struct ether_addr *)&ucast.mac); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); re = (int)qede_mac_int_ops(eth_dev, &ucast, 1); return re; } @@ -741,13 +741,13 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) /* Use the index maintained by rte */ ether_addr_copy(ð_dev->data->mac_addrs[index], - (struct ether_addr *)&ucast.mac); + (struct rte_ether_addr *)&ucast.mac); qede_mac_int_ops(eth_dev, &ucast, false); } static int -qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr) +qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); @@ -1759,7 +1759,7 @@ static void qede_allmulticast_disable(struct rte_eth_dev *eth_dev) } static int -qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, +qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); @@ -2551,7 +2551,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) } if (!is_vf) { - ether_addr_copy((struct ether_addr *)edev->hwfns[0]. + ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. hw_info.hw_mac_addr, ð_dev->data->mac_addrs[0]); ether_addr_copy(ð_dev->data->mac_addrs[0], @@ -2567,7 +2567,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) &is_mac_forced); if (is_mac_exist) { DP_INFO(edev, "VF macaddr received from PF\n"); - ether_addr_copy((struct ether_addr *)&vf_mac, + ether_addr_copy((struct rte_ether_addr *)&vf_mac, ð_dev->data->mac_addrs[0]); ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index 622bd011a..8d3364209 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -140,12 +140,12 @@ struct qede_vlan_entry { }; struct qede_mcast_entry { - struct ether_addr mac; + struct rte_ether_addr mac; SLIST_ENTRY(qede_mcast_entry) list; }; struct qede_ucast_entry { - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t vlan; uint16_t vni; SLIST_ENTRY(qede_ucast_entry) list; @@ -228,7 +228,7 @@ struct qede_dev { SLIST_HEAD(vlan_list_head, qede_vlan_entry)vlan_list_head; uint16_t configured_vlans; bool accept_any_vlan; - struct ether_addr primary_mac; + struct rte_ether_addr primary_mac; SLIST_HEAD(mc_list_head, qede_mcast_entry) mc_list_head; uint16_t num_mc_addr; SLIST_HEAD(uc_list_head, qede_ucast_entry) uc_list_head; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 5e6571ca6..27fbe538a 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -465,8 +465,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; - len = 2 * sizeof(struct ether_addr); - raw_pkt += 2 * sizeof(struct ether_addr); + len = 2 * sizeof(struct rte_ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); ether_type = (uint16_t *)raw_pkt; raw_pkt += sizeof(uint16_t); len += sizeof(uint16_t); diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h index ee5e54c19..b840c743c 100644 --- a/drivers/net/qede/qede_if.h +++ b/drivers/net/qede/qede_if.h @@ -59,7 +59,7 @@ struct qed_dev_eth_info { uint8_t num_queues; uint8_t num_tc; - struct ether_addr port_mac; + struct rte_ether_addr port_mac; uint16_t num_vlan_filters; uint32_t num_mac_filters; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 8a4772f46..93f9e54a5 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -902,23 +902,23 @@ static inline uint8_t qede_check_notunn_csum_l4(uint16_t flag) static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - struct vlan_hdr *vlan_hdr; + struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; uint16_t len; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); - len = sizeof(struct ether_hdr); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); + len = sizeof(struct rte_ether_hdr); ethertype = rte_cpu_to_be_16(eth_hdr->ether_type); /* Note: Valid only if VLAN stripping is disabled */ if (ethertype == ETHER_TYPE_VLAN) { vlan_tagged = 1; - vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - len += sizeof(struct vlan_hdr); + 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); } @@ -1105,7 +1105,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; calc_csum = rte_ipv4_cksum(ip); diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index bfe2f1780..937c54e6a 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -51,7 +51,7 @@ struct pmd_internals { struct ring_queue rx_ring_queues[RTE_PMD_RING_MAX_RX_RINGS]; struct ring_queue tx_ring_queues[RTE_PMD_RING_MAX_TX_RINGS]; - struct ether_addr address; + struct rte_ether_addr address; enum dev_action action; }; @@ -215,7 +215,7 @@ eth_mac_addr_remove(struct rte_eth_dev *dev __rte_unused, static int eth_mac_addr_add(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mac_addr __rte_unused, + struct rte_ether_addr *mac_addr __rte_unused, uint32_t index __rte_unused, uint32_t vmdq __rte_unused) { diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index 51be44037..af8d94f5e 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -132,7 +132,7 @@ struct sfc_port { boolean_t promisc; boolean_t allmulti; - struct ether_addr default_mac_addr; + struct rte_ether_addr default_mac_addr; unsigned int max_mcast_addrs; unsigned int nb_mcast_addrs; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index b2e17f26e..761958d56 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -901,12 +901,12 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) return -rc; } static int -sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct sfc_adapter *sa = dev->data->dev_private; const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); struct sfc_port *port = &sa->port; - struct ether_addr *old_addr = &dev->data->mac_addrs[0]; + struct rte_ether_addr *old_addr = &dev->data->mac_addrs[0]; int rc = 0; sfc_adapter_lock(sa); @@ -985,7 +985,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) static int -sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, +sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct sfc_adapter *sa = dev->data->dev_private; @@ -1931,7 +1931,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); int rc; const efx_nic_cfg_t *encp; - const struct ether_addr *from; + const struct rte_ether_addr *from; sfc_register_dp(); @@ -1986,7 +1986,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) * The arguments are really reverse order in comparison to * Linux kernel. Copy from NIC config to Ethernet device data. */ - from = (const struct ether_addr *)(encp->enc_mac_addr); + from = (const struct rte_ether_addr *)(encp->enc_mac_addr); ether_addr_copy(from, &dev->data->mac_addrs[0]); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 5384dbbdb..c6f403d2a 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -213,7 +213,7 @@ sfc_port_start(struct sfc_adapter *sa) goto fail_mac_pdu_set; if (!port->isolated) { - struct ether_addr *addr = &port->default_mac_addr; + struct rte_ether_addr *addr = &port->default_mac_addr; sfc_log_init(sa, "set MAC address"); rc = efx_mac_addr_set(sa->nic, addr->addr_bytes); @@ -372,7 +372,7 @@ sfc_port_attach(struct sfc_adapter *sa) { struct sfc_port *port = &sa->port; const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); - const struct ether_addr *from; + const struct rte_ether_addr *from; uint32_t mac_nstats; size_t mac_stats_size; long kvarg_stats_update_period_ms; @@ -387,7 +387,7 @@ sfc_port_attach(struct sfc_adapter *sa) port->flow_ctrl_autoneg = B_TRUE; RTE_BUILD_BUG_ON(sizeof(encp->enc_mac_addr) != sizeof(*from)); - from = (const struct ether_addr *)(encp->enc_mac_addr); + from = (const struct rte_ether_addr *)(encp->enc_mac_addr); ether_addr_copy(from, &port->default_mac_addr); port->max_mcast_addrs = EFX_MAC_MULTICAST_LIST_MAX; diff --git a/drivers/net/softnic/parser.c b/drivers/net/softnic/parser.c index a8688a21e..7ea6eb4fa 100644 --- a/drivers/net/softnic/parser.c +++ b/drivers/net/softnic/parser.c @@ -528,13 +528,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -568,7 +568,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -596,15 +596,15 @@ softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -softnic_parse_mac_addr(const char *token, struct ether_addr *addr) +softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; } diff --git a/drivers/net/softnic/parser.h b/drivers/net/softnic/parser.h index 1ee3f82a7..6f408b248 100644 --- a/drivers/net/softnic/parser.h +++ b/drivers/net/softnic/parser.h @@ -49,7 +49,7 @@ int softnic_parse_hex_string(char *src, uint8_t *dst, uint32_t *size); int softnic_parse_ipv4_addr(const char *token, struct in_addr *ipv4); int softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6); -int softnic_parse_mac_addr(const char *token, struct ether_addr *addr); +int softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr); int softnic_parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 0fd264e25..cac5a4828 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -351,7 +351,7 @@ pmd_free(struct pmd_internals *p) rte_free(p); } -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = {0}, }; diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 4e5e01cf1..4857fb57a 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -105,7 +105,7 @@ struct szedata2_tx_queue { int szedata2_logtype_init; int szedata2_logtype_driver; -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 } }; @@ -1332,7 +1332,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, static int eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mac_addr __rte_unused) + struct rte_ether_addr *mac_addr __rte_unused) { return 0; } @@ -1514,7 +1514,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi) eth_link_update(dev, 0); /* Allocate space for one mac address */ - data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr), + data->mac_addrs = rte_zmalloc(data->name, sizeof(struct rte_ether_addr), RTE_CACHE_LINE_SIZE); if (data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Could not alloc space for MAC address!"); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 77f26940b..473dcdbf5 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -242,7 +242,7 @@ tap_verify_csum(struct rte_mbuf *mbuf) uint32_t l2 = mbuf->packet_type & RTE_PTYPE_L2_MASK; uint32_t l3 = mbuf->packet_type & RTE_PTYPE_L3_MASK; uint32_t l4 = mbuf->packet_type & RTE_PTYPE_L4_MASK; - unsigned int l2_len = sizeof(struct ether_hdr); + unsigned int l2_len = sizeof(struct rte_ether_hdr); unsigned int l3_len; uint16_t cksum = 0; void *l3_hdr; @@ -1100,7 +1100,7 @@ tap_allmulti_disable(struct rte_eth_dev *dev) } static int -tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct pmd_internals *pmd = dev->data->dev_private; enum ioctl_mode mode = LOCAL_ONLY; @@ -1122,14 +1122,14 @@ tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY); if (ret < 0) return ret; - if (is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) return 0; /* Check the current MAC address on the remote */ ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY); if (ret < 0) return ret; - if (!is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (!is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; @@ -1393,7 +1393,7 @@ tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int tap_set_mc_addr_list(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mc_addr_set __rte_unused, + struct rte_ether_addr *mc_addr_set __rte_unused, uint32_t nb_mc_addr __rte_unused) { /* @@ -1613,7 +1613,7 @@ static const struct eth_dev_ops ops = { static int eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name, - char *remote_iface, struct ether_addr *mac_addr, + char *remote_iface, struct rte_ether_addr *mac_addr, enum rte_tuntap_type type) { int numa_node = rte_socket_id(); @@ -1846,7 +1846,7 @@ set_remote_iface(const char *key __rte_unused, return 0; } -static int parse_user_mac(struct ether_addr *user_mac, +static int parse_user_mac(struct rte_ether_addr *user_mac, const char *value) { unsigned int index = 0; @@ -1874,7 +1874,7 @@ set_mac_type(const char *key __rte_unused, const char *value, void *extra_args) { - struct ether_addr *user_mac = extra_args; + struct rte_ether_addr *user_mac = extra_args; if (!value) return 0; @@ -1984,7 +1984,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) int speed; char tap_name[RTE_ETH_NAME_MAX_LEN]; char remote_iface[RTE_ETH_NAME_MAX_LEN]; - struct ether_addr user_mac = { .addr_bytes = {0} }; + struct rte_ether_addr user_mac = { .addr_bytes = {0} }; struct rte_eth_dev *eth_dev; strcpy(tuntap_name, "TAP"); diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h index 44e2773f8..db42fa514 100644 --- a/drivers/net/tap/rte_eth_tap.h +++ b/drivers/net/tap/rte_eth_tap.h @@ -69,7 +69,7 @@ struct pmd_internals { char remote_iface[RTE_ETH_NAME_MAX_LEN]; /* Remote netdevice name */ char name[RTE_ETH_NAME_MAX_LEN]; /* Internal Tap device name */ int type; /* Type field - TUN|TAP */ - struct ether_addr eth_addr; /* Mac address of the device port */ + struct rte_ether_addr eth_addr; /* Mac address of the device port */ struct ifreq remote_initial_flags; /* Remote netdevice flags on init */ int remote_if_index; /* remote netdevice IF_INDEX */ int if_index; /* IF_INDEX for the port */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index 1cb73822f..db3ed8798 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -37,7 +37,7 @@ #define KEY_IDX 0 #define BPF_MAP_ID_KEY 1 -struct vlan_hdr { +struct rte_vlan_hdr { __be16 proto; __be16 tci; }; @@ -141,12 +141,12 @@ rss_l3_l4(struct __sk_buff *skb) /* Get correct proto for 802.1ad */ if (skb->vlan_present && skb->vlan_proto == htons(ETH_P_8021AD)) { - if (data + ETH_ALEN * 2 + sizeof(struct vlan_hdr) + + if (data + ETH_ALEN * 2 + sizeof(struct rte_vlan_hdr) + sizeof(proto) > data_end) return TC_ACT_OK; proto = *(__u16 *)(data + ETH_ALEN * 2 + - sizeof(struct vlan_hdr)); - off += sizeof(struct vlan_hdr); + sizeof(struct rte_vlan_hdr)); + off += sizeof(struct rte_vlan_hdr); } if (proto == htons(ETH_P_IP)) { diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c index 8f83d41dd..2a793a4b1 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.c +++ b/drivers/net/thunderx/base/nicvf_mbox.c @@ -135,8 +135,8 @@ nicvf_handle_mbx_intr(struct nicvf *nic) nic->node = mbx.nic_cfg.node_id; nic->sqs_mode = mbx.nic_cfg.sqs_mode; nic->loopback_supported = mbx.nic_cfg.loopback_supported; - ether_addr_copy((struct ether_addr *)mbx.nic_cfg.mac_addr, - (struct ether_addr *)nic->mac_addr); + ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, + (struct rte_ether_addr *)nic->mac_addr); nic->pf_acked = true; break; case NIC_MBOX_MSG_ACK: diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 879d88998..ec2087924 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2179,10 +2179,10 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) ret = -ENOMEM; goto alarm_fail; } - if (is_zero_ether_addr((struct ether_addr *)nic->mac_addr)) + if (is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) eth_random_addr(&nic->mac_addr[0]); - ether_addr_copy((struct ether_addr *)nic->mac_addr, + ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, ð_dev->data->mac_addrs[0]); ret = nicvf_mbox_set_mac_addr(nic, nic->mac_addr); diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index 16303ef5e..3124c1a07 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -68,7 +68,7 @@ struct vdev_netvsc_ctx { char devargs[256]; /**< Fail-safe device arguments. */ char if_name[IF_NAMESIZE]; /**< NetVSC netdevice name. */ unsigned int if_index; /**< NetVSC netdevice index. */ - struct ether_addr if_addr; /**< NetVSC MAC address. */ + struct rte_ether_addr if_addr; /**< NetVSC MAC address. */ int pipe[2]; /**< Fail-safe communication pipe. */ char yield[256]; /**< PCI sub-device arguments. */ }; @@ -157,7 +157,7 @@ vdev_netvsc_iface_is_netvsc(const struct if_nameindex *iface) */ static int vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap), int is_netvsc, ...) { struct if_nameindex *iface = if_nameindex(); @@ -178,7 +178,7 @@ vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface, for (i = 0; iface[i].if_name; ++i) { int is_netvsc_ret; struct ifreq req; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; va_list ap; is_netvsc_ret = vdev_netvsc_iface_is_netvsc(&iface[i]) ? 1 : 0; @@ -371,7 +371,7 @@ vdev_netvsc_sysfs_readlink(char *buf, size_t size, const char *if_name, */ static int vdev_netvsc_device_probe(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap) { struct vdev_netvsc_ctx *ctx = va_arg(ap, struct vdev_netvsc_ctx *); @@ -510,7 +510,7 @@ vdev_netvsc_alarm(__rte_unused void *arg) */ static int vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap) { const char *name = va_arg(ap, const char *); @@ -530,7 +530,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, if (!strcmp(pair->value, iface->if_name)) break; } else if (!strcmp(pair->key, VDEV_NETVSC_ARG_MAC)) { - struct ether_addr tmp; + struct rte_ether_addr tmp; if (sscanf(pair->value, "%" SCNx8 ":%" SCNx8 ":%" SCNx8 ":" diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 55e51c89a..4c8d0ca92 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -43,7 +43,7 @@ static const char *valid_arguments[] = { NULL }; -static struct ether_addr base_eth_addr = { +static struct rte_ether_addr base_eth_addr = { .addr_bytes = { 0x56 /* V */, 0x48 /* H */, @@ -325,10 +325,10 @@ static inline void vhost_count_multicast_broadcast(struct vhost_queue *vq, struct rte_mbuf *mbuf) { - struct ether_addr *ea = NULL; + struct rte_ether_addr *ea = NULL; struct vhost_stats *pstats = &vq->stats; - ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *); + ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) pstats->xstats[VHOST_BROADCAST_PKT]++; @@ -1207,7 +1207,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name, struct rte_eth_dev_data *data; struct pmd_internal *internal = NULL; struct rte_eth_dev *eth_dev = NULL; - struct ether_addr *eth_addr = NULL; + struct rte_ether_addr *eth_addr = NULL; struct rte_vhost_vring_state *vring_state = NULL; struct internal_list *list = NULL; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 730c41707..645b03c81 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -65,11 +65,11 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev); static int virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int virtio_mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); static int virtio_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int virtio_intr_enable(struct rte_eth_dev *dev); static int virtio_intr_disable(struct rte_eth_dev *dev); @@ -996,11 +996,11 @@ virtio_mac_table_set(struct virtio_hw *hw, } static int -virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq __rte_unused) { struct virtio_hw *hw = dev->data->dev_private; - const struct ether_addr *addrs = dev->data->mac_addrs; + const struct rte_ether_addr *addrs = dev->data->mac_addrs; unsigned int i; struct virtio_net_ctrl_mac *uc, *mc; @@ -1015,7 +1015,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, mc->entries = 0; for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { - const struct ether_addr *addr + const struct rte_ether_addr *addr = (i == index) ? mac_addr : addrs + i; struct virtio_net_ctrl_mac *tbl = is_multicast_ether_addr(addr) ? mc : uc; @@ -1030,7 +1030,7 @@ static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct virtio_hw *hw = dev->data->dev_private; - struct ether_addr *addrs = dev->data->mac_addrs; + struct rte_ether_addr *addrs = dev->data->mac_addrs; struct virtio_net_ctrl_mac *uc, *mc; unsigned int i; @@ -1058,7 +1058,7 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) } static int -virtio_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct virtio_hw *hw = dev->data->dev_private; @@ -1249,7 +1249,7 @@ virtio_notify_peers(struct rte_eth_dev *dev) return; rarp_mbuf = rte_net_make_rarp_packet(rxvq->mpool, - (struct ether_addr *)hw->mac_addr); + (struct rte_ether_addr *)hw->mac_addr); if (rarp_mbuf == NULL) { PMD_DRV_LOG(ERR, "failed to make RARP packet."); return; @@ -1483,7 +1483,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Copy the permanent MAC address to: virtio_hw */ virtio_get_hwaddr(hw); - ether_addr_copy((struct ether_addr *) hw->mac_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index eb891433e..ef8936a75 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -773,7 +773,7 @@ static void virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) { uint32_t s = mbuf->pkt_len; - struct ether_addr *ea; + struct rte_ether_addr *ea; if (s == 64) { stats->size_bins[1]++; @@ -792,7 +792,7 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) stats->size_bins[7]++; } - ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *); + ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) stats->broadcast++; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 78e5b7680..b1cbeefcd 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -91,7 +91,7 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on); static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); static int vmxnet3_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static void vmxnet3_interrupt_handler(void *param); int vmxnet3_logtype_init; @@ -311,7 +311,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -1162,11 +1162,11 @@ vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev) } static int -vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct vmxnet3_hw *hw = dev->data->dev_private; - ether_addr_copy(mac_addr, (struct ether_addr *)(hw->perm_addr)); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); vmxnet3_write_mac(hw, mac_addr->addr_bytes); return 0; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index cf85f3d61..ca3b1ef33 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -674,7 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, ptr = rte_pktmbuf_mtod(rxm, char *); slen = rte_pktmbuf_data_len(rxm); - hlen = sizeof(struct ether_hdr); + hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) @@ -701,7 +701,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) return hw->mtu - hlen - sizeof(struct tcp_hdr) + - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); tcp_hdr = (struct tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; @@ -710,7 +710,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, return (rte_pktmbuf_pkt_len(rxm) - hlen + rxm->udata64 - 1) / rxm->udata64; else - return hw->mtu - hlen + sizeof(struct ether_hdr); + return hw->mtu - hlen + sizeof(struct rte_ether_hdr); } /* Receive side checksum and other offloads */ diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index d68c06aef..9fa492978 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -273,7 +273,7 @@ signal_handler(int signum) } static void -print_mac(unsigned int portid, struct ether_addr *bbdev_ports_eth_address) +print_mac(unsigned int portid, struct rte_ether_addr *bbdev_ports_eth_address) { printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", (unsigned int) portid, @@ -341,14 +341,14 @@ check_port_link_status(uint16_t port_id) static inline void add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst) { - struct ether_hdr *eth_from; - struct ether_hdr *eth_to; + struct rte_ether_hdr *eth_from; + struct rte_ether_hdr *eth_to; - eth_from = rte_pktmbuf_mtod(pkt_src, struct ether_hdr *); - eth_to = rte_pktmbuf_mtod(pkt_dst, struct ether_hdr *); + eth_from = rte_pktmbuf_mtod(pkt_src, struct rte_ether_hdr *); + eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *); /* copy header */ - rte_memcpy(eth_to, eth_from, sizeof(struct ether_hdr)); + rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); } static inline void @@ -377,7 +377,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, for (i = 0; i < num_pkts; ++i) { uint16_t pkt_data_len = rte_pktmbuf_data_len(mbufs[i]) - - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* Resize the packet if needed */ if (pkt_data_len < ncb) { @@ -395,7 +395,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, for (l = start_bit_idx; l < start_bit_idx + d; ++l) { uint8_t *data = rte_pktmbuf_mtod_offset( mbufs[i], uint8_t *, - sizeof(struct ether_hdr) + (l >> 3)); + sizeof(struct rte_ether_hdr) + (l >> 3)); if (*data & (0x80 >> (l & 7))) temp_buf[out_idx] = LLR_1_BIT; else @@ -410,7 +410,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, } rte_memcpy(rte_pktmbuf_mtod_offset(mbufs[i], uint8_t *, - sizeof(struct ether_hdr)), temp_buf, ncb); + sizeof(struct rte_ether_hdr)), temp_buf, ncb); } } @@ -423,9 +423,9 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts) struct rte_mbuf *in = out->userdata; if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *, - sizeof(struct ether_hdr)), + sizeof(struct rte_ether_hdr)), rte_pktmbuf_mtod_offset(out, uint8_t *, - sizeof(struct ether_hdr)), + sizeof(struct rte_ether_hdr)), K / 8 - CRC_24B_LEN)) printf("Input and output buffers are not equal!\n"); } @@ -439,7 +439,7 @@ initialize_ports(struct app_config_params *app_params, uint16_t port_id = app_params->port_id; uint16_t q; /* ethernet addresses of ports */ - struct ether_addr bbdev_port_eth_addr; + struct rte_ether_addr bbdev_port_eth_addr; /* initialize ports */ printf("\nInitializing port %u...\n", app_params->port_id); @@ -707,14 +707,14 @@ run_encoding(struct lcore_conf *lcore_conf) char *data; const uint16_t pkt_data_len = rte_pktmbuf_data_len(rx_pkts_burst[i]) - - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* save input mbuf pointer for later comparison */ enc_out_pkts[i]->userdata = rx_pkts_burst[i]; /* copy ethernet header */ rte_pktmbuf_reset(enc_out_pkts[i]); data = rte_pktmbuf_append(enc_out_pkts[i], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (data == NULL) { printf( "Not enough space for ethernet header in encoder output mbuf\n"); @@ -728,7 +728,7 @@ run_encoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_enc.input.data = rx_pkts_burst[i]; bbdev_ops_burst[i]->turbo_enc.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* Encoder will attach the CRC24B, adjust the length */ bbdev_ops_burst[i]->turbo_enc.input.length = in_data_len; @@ -746,7 +746,7 @@ run_encoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_enc.output.data = enc_out_pkts[i]; bbdev_ops_burst[i]->turbo_enc.output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); } /* Enqueue packets on BBDevice */ @@ -834,15 +834,15 @@ run_decoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_dec.input.data = recv_pkts_burst[i]; bbdev_ops_burst[i]->turbo_dec.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); bbdev_ops_burst[i]->turbo_dec.input.length = rte_pktmbuf_data_len(recv_pkts_burst[i]) - - sizeof(struct ether_hdr); + - sizeof(struct rte_ether_hdr); bbdev_ops_burst[i]->turbo_dec.hard_output.data = recv_pkts_burst[i]; bbdev_ops_burst[i]->turbo_dec.hard_output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); } /* Enqueue packets on BBDevice */ diff --git a/examples/bond/main.c b/examples/bond/main.c index 2fe5a9319..fe17936b9 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -201,7 +201,7 @@ slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) "Start port %d failed (res=%d)", portid, retval); - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(portid, &addr); printf("Port %u MAC: ", portid); @@ -276,7 +276,7 @@ bond_port_init(struct rte_mempool *mbuf_pool) rte_eth_promiscuous_enable(BOND_PORT); - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(BOND_PORT, &addr); printf("Port %u MAC: ", (unsigned)BOND_PORT); @@ -285,21 +285,21 @@ bond_port_init(struct rte_mempool *mbuf_pool) } static inline size_t -get_vlan_offset(struct ether_hdr *eth_hdr, uint16_t *proto) +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) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - vlan_offset = sizeof(struct vlan_hdr); + vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; - vlan_offset += sizeof(struct vlan_hdr); + vlan_offset += sizeof(struct rte_vlan_hdr); } } return vlan_offset; @@ -321,9 +321,9 @@ struct global_flag_stru_t *global_flag_stru_p = &global_flag_stru; static int lcore_main(__attribute__((unused)) void *arg1) { struct rte_mbuf *pkts[MAX_PKT_BURST] __rte_cache_aligned; - struct ether_addr d_addr; + struct rte_ether_addr d_addr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; @@ -355,7 +355,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[0]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - eth_hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + 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)) printf("VLAN taged frame, offset:"); @@ -434,7 +434,7 @@ static void cmd_obj_send_parsed(void *parsed_result, char ip_str[INET6_ADDRSTRLEN]; struct rte_mbuf *created_pkt; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; @@ -454,16 +454,16 @@ static void cmd_obj_send_parsed(void *parsed_result, return; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr); + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; - eth_hdr = rte_pktmbuf_mtod(created_pkt, struct ether_hdr *); + 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); - arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); + 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; @@ -683,7 +683,7 @@ static void cmd_show_parsed(__attribute__((unused)) void *parsed_result, { uint16_t slaves[16] = {0}; uint8_t len = 16; - struct ether_addr addr; + struct rte_ether_addr addr; uint16_t i = 0; while (i < slaves_count) { diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 03a05e3d9..5a2bbec4b 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -177,7 +177,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return 0; } - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index a4e64b354..ce7f715f8 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -30,7 +30,7 @@ struct pcmd_intstr_params { struct pcmd_intmac_params { cmdline_fixed_string_t cmd; uint16_t port; - struct ether_addr mac; + struct rte_ether_addr mac; }; struct pcmd_str_params { cmdline_fixed_string_t cmd; @@ -475,7 +475,7 @@ pcmd_macaddr_callback(void *ptr_params, void *ptr_data) { struct pcmd_intmac_params *params = ptr_params; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; int stat; stat = 0; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index dc93adfe3..ae61e7363 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -32,7 +32,7 @@ struct txq_port { }; struct app_port { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct txq_port txq; rte_spinlock_t lock; int port_active; @@ -160,9 +160,9 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports) static void process_frame(struct app_port *ptr_port, struct rte_mbuf *ptr_frame) { - struct ether_hdr *ptr_mac_hdr; + struct rte_ether_hdr *ptr_mac_hdr; - ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct ether_hdr *); + ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *); ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); } diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index e6a2e88c7..35984cf00 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -303,7 +303,7 @@ rte_ethtool_net_stop(uint16_t port_id) } int -rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr) +rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); if (addr == NULL) @@ -314,7 +314,7 @@ rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr) } int -rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr) +rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { if (addr == NULL) return -EINVAL; @@ -323,7 +323,7 @@ rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr) int rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused, - struct ether_addr *addr) + struct rte_ether_addr *addr) { if (addr == NULL) return -EINVAL; diff --git a/examples/ethtool/lib/rte_ethtool.h b/examples/ethtool/lib/rte_ethtool.h index 43adc97a3..da61430d1 100644 --- a/examples/ethtool/lib/rte_ethtool.h +++ b/examples/ethtool/lib/rte_ethtool.h @@ -260,7 +260,7 @@ int rte_ethtool_net_stop(uint16_t port_id); * - (0) if successful. * - (-ENODEV) if *port_id* invalid. */ -int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Setting the Ethernet device MAC address. @@ -276,7 +276,7 @@ int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr); * - (-EINVAL) if parameters invalid. * - others depends on the specific operations implementation. */ -int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Validate if the provided MAC address is valid unicast address @@ -292,7 +292,7 @@ int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr); * - (-EINVAL) if parameters invalid. * - others depends on the specific operations implementation. */ -int rte_ethtool_net_validate_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_validate_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Setting the Ethernet device maximum Tx unit. diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index 92e08bc0c..ee65b3ef2 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -322,7 +322,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index a6cc912fb..ef23d963a 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -99,11 +99,11 @@ struct config_data cdata; static __rte_always_inline void exchange_mac(struct rte_mbuf *m) { - struct ether_hdr *eth; - struct ether_addr addr; + struct rte_ether_hdr *eth; + struct rte_ether_addr addr; /* change mac addresses on packet (to use mbuf data) */ - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_addr_copy(ð->d_addr, &addr); ether_addr_copy(&addr, ð->d_addr); } diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index 199612926..5ae81fab1 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -98,7 +98,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -108,7 +108,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -118,7 +118,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -131,7 +131,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -141,7 +141,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -192,7 +192,7 @@ static inline int port_init(uint8_t port, struct rte_mempool *mbuf_pool) { struct rte_eth_conf port_conf = port_conf_default; - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rx_rings = 1, tx_rings = 1; int retval; uint16_t q; diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index a73d120e3..dad8bccbf 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -45,7 +45,7 @@ struct rte_flow *flow; #include "flow_blocks.c" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -56,7 +56,7 @@ static void main_loop(void) { struct rte_mbuf *mbufs[32]; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_flow_error error; uint16_t nb_rx; uint16_t i; @@ -71,7 +71,7 @@ main_loop(void) struct rte_mbuf *m = mbufs[j]; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 17a877da2..ccde72cc0 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -83,7 +83,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #ifndef IPv4_BYTES #define IPv4_BYTES_FMT "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 @@ -244,7 +244,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, port_out = port_in; /* Remove the Ethernet header and trailer from the input packet */ - rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); /* Build transmission burst */ len = qconf->tx_mbufs[port_out].len; @@ -332,13 +332,13 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, void *d_addr_bytes; m = qconf->tx_mbufs[port_out].m_table[i]; - struct ether_hdr *eth_hdr = (struct ether_hdr *) - rte_pktmbuf_prepend(m, (uint16_t)sizeof(struct ether_hdr)); + struct rte_ether_hdr *eth_hdr = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(m, (uint16_t)sizeof(struct rte_ether_hdr)); if (eth_hdr == NULL) { rte_panic("No headroom in mbuf.\n"); } - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); /* 02:00:00:00:00:xx */ d_addr_bytes = ð_hdr->d_addr.addr_bytes[0]; @@ -560,7 +560,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -661,11 +661,11 @@ check_ptype(int portid) static inline void parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index d1e554072..463c30cdf 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -245,7 +245,7 @@ static void print_link_info(struct link *link, char *out, size_t out_size) { struct rte_eth_stats stats; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link eth_link; uint16_t mtu; diff --git a/examples/ip_pipeline/parser.c b/examples/ip_pipeline/parser.c index ffcdeb3a6..4777f9ffd 100644 --- a/examples/ip_pipeline/parser.c +++ b/examples/ip_pipeline/parser.c @@ -513,13 +513,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -553,7 +553,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -581,15 +581,15 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -parse_mac_addr(const char *token, struct ether_addr *addr) +parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; } diff --git a/examples/ip_pipeline/parser.h b/examples/ip_pipeline/parser.h index 261a8c858..4538f675d 100644 --- a/examples/ip_pipeline/parser.h +++ b/examples/ip_pipeline/parser.h @@ -47,7 +47,7 @@ int parse_hex_string(char *src, uint8_t *dst, uint32_t *size); int parse_ipv4_addr(const char *token, struct in_addr *ipv4); int parse_ipv6_addr(const char *token, struct in6_addr *ipv6); -int parse_mac_addr(const char *token, struct ether_addr *addr); +int parse_mac_addr(const char *token, struct rte_ether_addr *addr); int parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); struct cpu_core_params { diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 17b55d4c7..226153968 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -95,7 +95,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #ifndef IPv4_BYTES #define IPv4_BYTES_FMT "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 @@ -308,7 +308,7 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, struct lcore_queue_conf *qconf, uint64_t tms) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_ip_frag_tbl *tbl; struct rte_ip_frag_death_row *dr; struct rx_queue *rxq; @@ -318,7 +318,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, rxq = &qconf->rx_queue_list[queue]; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_port = portid; @@ -350,7 +350,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); } } @@ -388,7 +388,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); } } @@ -691,7 +691,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 1bc0b5b50..abddc6f24 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -232,9 +232,9 @@ static inline void prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) { uint8_t *nlp; - struct ether_hdr *eth; + struct rte_ether_hdr *eth; - eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + 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); nlp = RTE_PTR_ADD(nlp, offsetof(struct ip, ip_p)); @@ -318,11 +318,11 @@ static inline void prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port) { struct ip *ip; - struct ether_hdr *ethhdr; + struct rte_ether_hdr *ethhdr; ip = rte_pktmbuf_mtod(pkt, struct ip *); - ethhdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); + ethhdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); if (ip->ip_v == IPVERSION) { pkt->ol_flags |= PKT_TX_IP_CKSUM | PKT_TX_IPV4; @@ -340,9 +340,9 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port) } memcpy(ðhdr->s_addr, ðaddr_tbl[port].src, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); memcpy(ðhdr->d_addr, ðaddr_tbl[port].dst, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } static inline void @@ -1176,7 +1176,7 @@ parse_args(int32_t argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -1551,7 +1551,7 @@ port_init(uint16_t portid) uint16_t tx_queueid, rx_queueid, queue, lcore_id; int32_t ret, socket_id; struct lcore_conf *qconf; - struct ether_addr ethaddr; + struct rte_ether_addr ethaddr; struct rte_eth_conf local_port_conf = port_conf; rte_eth_dev_info_get(portid, &dev_info); diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 6530d4830..297bf1152 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -80,7 +80,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[MAX_PORTS]; +static struct rte_ether_addr ports_eth_addr[MAX_PORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -277,14 +277,14 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone) * and put it into the outgoing queue for the given port. */ static inline void -mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, +mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); ether_addr_copy(dest_addr, ðdr->d_addr); @@ -312,11 +312,11 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) uint16_t port; union { uint64_t as_int; - struct ether_addr as_addr; + struct rte_ether_addr as_addr; } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -545,7 +545,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/kni/main.c b/examples/kni/main.c index 80c401c51..9ad30566e 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -764,7 +764,7 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) } static void -print_ethaddr(const char *name, struct ether_addr *mac_addr) +print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); @@ -783,10 +783,10 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) } RTE_LOG(INFO, APP, "Configure mac address of %d\n", port_id); - print_ethaddr("Address:", (struct ether_addr *)mac_addr); + print_ethaddr("Address:", (struct rte_ether_addr *)mac_addr); ret = rte_eth_dev_default_mac_addr_set(port_id, - (struct ether_addr *)mac_addr); + (struct rte_ether_addr *)mac_addr); if (ret < 0) RTE_LOG(ERR, APP, "Failed to config mac_addr for port %d\n", port_id); @@ -844,7 +844,7 @@ kni_alloc(uint16_t port_id) } /* Get the interface default mac address */ rte_eth_macaddr_get(port_id, - (struct ether_addr *)&conf.mac_addr); + (struct rte_ether_addr *)&conf.mac_addr); rte_eth_dev_get_mtu(port_id, &conf.mtu); diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c index 0e6078aad..1a8af28e2 100644 --- a/examples/l2fwd-cat/l2fwd-cat.c +++ b/examples/l2fwd-cat/l2fwd-cat.c @@ -73,7 +73,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index f12fd266e..05fef7daf 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -78,7 +78,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint64_t l2fwd_enabled_port_mask; @@ -383,19 +383,19 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct rte_crypto_op *op, struct l2fwd_crypto_params *cparams) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; char *padding; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (eth_hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_IPv4)) return -1; - ipdata_offset = sizeof(struct ether_hdr); + ipdata_offset = sizeof(struct rte_ether_hdr); ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); @@ -589,10 +589,10 @@ l2fwd_send_packet(struct rte_mbuf *m, uint16_t port) static void l2fwd_mac_updating(struct rte_mbuf *m, uint16_t dest_portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index a4d28e178..033104d63 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -52,7 +52,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask; @@ -335,14 +335,14 @@ show_stats_cb(__rte_unused void *param) static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; int sent; unsigned dst_port; struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 0bf2b5336..21d19932d 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -58,7 +58,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask; @@ -165,14 +165,14 @@ print_stats(__attribute__((unused)) struct rte_timer *ptr_timer, static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; int sent; unsigned dst_port; struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 6c23215a5..c1d6797b0 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -59,7 +59,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask = 0; @@ -151,10 +151,10 @@ print_stats(void) static void l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index a322ce4f2..ed25f75d8 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -82,7 +82,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask; @@ -173,7 +173,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *c = (unsigned char)(ip >> 8 & 0xff);\ *d = (unsigned char)(ip & 0xff);\ } while (0) -#define OFF_ETHHEAD (sizeof(struct ether_hdr)) +#define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) #define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) #define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ @@ -544,7 +544,7 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) unsigned char a, b, c, d; struct ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); printf("Packet Src:%hhu.%hhu.%hhu.%hhu ", a, b, c, d); @@ -568,7 +568,7 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) uint32_t offset = sig & ~ACL_DENY_SIGNATURE; struct ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); printf("Packet Src"); for (i = 0; i < RTE_DIM(ipv6_hdr->src_addr); i += sizeof(uint16_t)) @@ -625,7 +625,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt_len) >= 0) { @@ -1754,7 +1754,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 68527d26f..c36cafb22 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -121,7 +121,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* ethernet addresses of ports */ static rte_spinlock_t locks[RTE_MAX_ETHPORTS]; @@ -576,11 +576,11 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, static inline void parse_ptype_one(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -619,18 +619,18 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -668,7 +668,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -1355,7 +1355,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 41137f978..2c0c89e21 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -112,7 +112,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -417,15 +417,15 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -788,7 +788,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index c962deac3..1893f8c3a 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -73,7 +73,7 @@ extern volatile bool force_quit; /* ethernet addresses of ports */ extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ extern uint32_t enabled_port_mask; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 5ec99f961..0c68aa01c 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,13 +68,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -121,10 +121,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, vector unsigned short dp1, static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; vector unsigned int te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index fa8f82be6..64e79b946 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -561,7 +561,7 @@ em_check_ptype(int portid) static inline void em_parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; void *l3; @@ -569,9 +569,9 @@ em_parse_ptype(struct rte_mbuf *m) struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - l3 = (uint8_t *)eth_hdr + sizeof(struct ether_hdr); + l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { ipv4_hdr = (struct ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 228164e26..5612ef378 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -9,20 +9,20 @@ static __rte_always_inline void l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); tcp_or_udp = m->packet_type & (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP); l3_ptypes = m->packet_type & RTE_PTYPE_L3_MASK; if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -55,7 +55,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 22c26dce3..5afe77591 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -92,7 +92,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); @@ -107,7 +107,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv6 headers.*/ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -142,7 +142,7 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, for (j = 0; j < EM_HASH_LOOKUP_COUNT && j < nb_rx; j++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (j = 0; j < n; j += EM_HASH_LOOKUP_COUNT) { @@ -160,7 +160,7 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, for (i = 0, pos = j + EM_HASH_LOOKUP_COUNT; i < EM_HASH_LOOKUP_COUNT && pos < nb_rx; i++, pos++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[pos], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } if (tcp_or_udp && (l3_type == RTE_PTYPE_L3_IPV4)) { diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 16c8b04ac..3ee2304b5 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -13,7 +13,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, union ipv4_5tuple_host *key) { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); @@ -25,17 +25,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 41e2be958..8156bbb90 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -13,7 +13,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); @@ -25,18 +25,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 35cf5eac0..6e7096c01 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -37,7 +37,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); @@ -52,7 +52,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv6 headers.*/ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -81,13 +81,13 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (nb_rx > 0) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[0], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (i = 1, j = 0; j < nb_rx; i++, j++) { if (i < nb_rx) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } dst_port[j] = em_get_dst_port(qconf, pkts_burst[j], portid); } diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index b1dc195ad..d7e1aef86 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -104,18 +104,18 @@ lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, { struct ipv6_hdr *ipv6_hdr; struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, @@ -136,7 +136,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, { uint32_t next_hop; struct ipv6_hdr *ipv6_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { return (uint16_t) ((rte_lpm_lookup(qconf->ipv4_lookup_struct, @@ -145,7 +145,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, @@ -372,11 +372,11 @@ lpm_check_ptype(int portid) static inline void lpm_parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index b68868f44..28635bf03 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -9,16 +9,16 @@ static __rte_always_inline void l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -51,7 +51,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index 4c9e2438b..b36e991ac 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -18,28 +18,28 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index 02ec0d802..a3e42cfa7 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -19,25 +19,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -98,14 +98,14 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (k) { for (i = 0; i < FWDSTEP; i++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (j = 0; j != k - FWDSTEP; j += FWDSTEP) { for (i = 0; i < FWDSTEP; i++) { rte_prefetch0(rte_pktmbuf_mtod( pkts_burst[j + i + FWDSTEP], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } processx4_step1(&pkts_burst[j], &dip, &ipv4_flag); @@ -125,17 +125,17 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, switch (m) { case 3: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 2: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 1: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; } diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 1d1615906..4603e0749 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -16,25 +16,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index 76ccdfa73..af2dc47ac 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -104,10 +104,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32x4_t te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = vld1q_u32((uint32_t *)eth_hdr); ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index ed5267c11..3349f2747 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -101,10 +101,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2) static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; __m128i te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index e4b99efe0..a91a0a16c 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -79,7 +79,7 @@ volatile bool force_quit; /* ethernet addresses of ports */ uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; xmm_t val_eth[RTE_MAX_ETHPORTS]; @@ -634,7 +634,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -889,14 +889,14 @@ main(int argc, char **argv) print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", - (const struct ether_addr *)&dest_eth_addr[portid]); + (const struct rte_ether_addr *)&dest_eth_addr[portid]); printf(", "); /* * prepare src MACs for each port. */ ether_addr_copy(&ports_eth_addr[portid], - (struct ether_addr *)(val_eth + portid) + 1); + (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ ret = init_mem(NB_MBUF); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index f3346d23b..9997c58f4 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -53,7 +53,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t lsi_enabled_port_mask = 0; @@ -163,13 +163,13 @@ print_stats(void) static void lsi_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port = lsi_dst_ports[portid]; int sent; struct rte_eth_dev_tx_buffer *buffer; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index 39a846a56..c4e6b4ac8 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -509,7 +509,7 @@ app_lcore_worker( pkt = lp->mbuf_in.array[j]; ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) { diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index 93a9a0892..7be2bebf6 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -65,7 +65,7 @@ get_printable_mac_addr(uint16_t port) if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; if (unlikely(addresses[port][0]=='\0')){ - struct ether_addr mac; + struct rte_ether_addr mac; rte_eth_macaddr_get(port, &mac); snprintf(addresses[port], sizeof(addresses[port]), "%02x:%02x:%02x:%02x:%02x:%02x\n", diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index 149bfdd02..ca312029e 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -255,7 +255,7 @@ configure_tx_buffers(struct rte_eth_dev_tx_buffer *tx_buffer[]) static inline int configure_eth_port(uint16_t port_id) { - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rxRings = 1, txRings = 1; int ret; uint16_t q; diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 4f8747bc3..b29ed9e97 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -92,11 +92,11 @@ check_ptype(int portid) static inline void parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -186,7 +186,7 @@ static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ static uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static xmm_t val_eth[RTE_MAX_ETHPORTS]; @@ -884,39 +884,39 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { - struct ether_hdr *eth_hdr[8]; + struct rte_ether_hdr *eth_hdr[8]; struct ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; __m128i data[8]; - eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct ether_hdr *); - eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct ether_hdr *); - eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct ether_hdr *); - eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct ether_hdr *); - eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct ether_hdr *); - eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct ether_hdr *); - eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct ether_hdr *); - eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct rte_ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct rte_ether_hdr *); + eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct rte_ether_hdr *); + eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct rte_ether_hdr *); + eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct rte_ether_hdr *); + eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -967,28 +967,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) #endif /* End of #ifdef DO_RFC_1812_CHECKS */ data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); @@ -1094,13 +1094,13 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i mask1, union ipv6_5tuple_host *key) { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); @@ -1113,37 +1113,37 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { int32_t ret[8]; uint16_t dst_port[8]; - struct ether_hdr *eth_hdr[8]; + struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; - eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct ether_hdr *); - eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct ether_hdr *); - eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct ether_hdr *); - eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct ether_hdr *); - eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct ether_hdr *); - eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct ether_hdr *); - eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct ether_hdr *); - eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct rte_ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct rte_ether_hdr *); + eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct rte_ether_hdr *); + eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct rte_ether_hdr *); + eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct rte_ether_hdr *); + eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); get_ipv6_5tuple(m[1], mask1, mask2, &key[1]); @@ -1228,16 +1228,16 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -1270,7 +1270,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct); @@ -1346,7 +1346,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; struct ipv6_hdr *ipv6_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { return (uint16_t) ((rte_lpm_lookup( @@ -1355,7 +1355,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( @@ -1371,13 +1371,13 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; @@ -1403,25 +1403,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1503,13 +1503,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -3020,7 +3020,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; @@ -3576,14 +3576,14 @@ main(int argc, char **argv) print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", - (const struct ether_addr *)&dest_eth_addr[portid]); + (const struct rte_ether_addr *)&dest_eth_addr[portid]); printf(", "); /* * prepare src MACs for each port. */ ether_addr_copy(&ports_eth_addr[portid], - (struct ether_addr *)(val_eth + portid) + 1); + (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ ret = init_mem(NB_MBUF); diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 82ae71c19..7d28f59ce 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -53,7 +53,7 @@ static const struct rte_eth_conf port_conf_default = { }, }; -static const struct ether_addr ether_multicast = { +static const struct rte_ether_addr ether_multicast = { .addr_bytes = {0x01, 0x1b, 0x19, 0x0, 0x0, 0x0} }; @@ -334,7 +334,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) struct ptp_header *ptp_hdr; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(ptp_data->m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id); if (ptp_data->ptpset == 0) { @@ -361,20 +361,20 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) static void parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ptp_header *ptp_hdr; struct clock_id *client_clkid; struct ptp_message *ptp_msg; struct rte_mbuf *created_pkt; struct tstamp *origin_tstamp; - struct ether_addr eth_multicast = ether_multicast; + struct rte_ether_addr eth_multicast = ether_multicast; size_t pkt_size; int wait_us; struct rte_mbuf *m = ptp_data->m; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); if (memcmp(&ptp_data->master_clock_id, &ptp_hdr->source_port_id.clock_id, sizeof(struct clock_id)) != 0) @@ -382,7 +382,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) ptp_data->seqID_FOLLOWUP = rte_be_to_cpu_16(ptp_hdr->seq_id); ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(m, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); origin_tstamp = &ptp_msg->follow_up.precise_origin_tstamp; ptp_data->tstamp1.tv_nsec = ntohl(origin_tstamp->ns); @@ -393,11 +393,11 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) if (ptp_data->seqID_FOLLOWUP == ptp_data->seqID_SYNC) { created_pkt = rte_pktmbuf_alloc(mbuf_pool); - pkt_size = sizeof(struct ether_hdr) + + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct ptp_message); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; - eth_hdr = rte_pktmbuf_mtod(created_pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ @@ -406,7 +406,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) eth_hdr->ether_type = htons(PTP_PROTOCOL); ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(created_pkt, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ptp_msg->delay_req.hdr.seq_id = htons(ptp_data->seqID_SYNC); ptp_msg->delay_req.hdr.msg_type = DELAY_REQ; @@ -499,7 +499,7 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) uint16_t seq_id; ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(m, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); seq_id = rte_be_to_cpu_16(ptp_msg->delay_resp.hdr.seq_id); if (memcmp(&ptp_data->client_clock_id, &ptp_msg->delay_resp.req_port_id.clock_id, @@ -535,17 +535,17 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) static void parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { struct ptp_header *ptp_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == PTP_PROTOCOL) { ptp_data.m = m; ptp_data.portid = portid; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); switch (ptp_hdr->msg_type) { case SYNC: diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 9b0112449..9f3344bf1 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -145,7 +145,7 @@ app_pkt_handle(struct rte_mbuf *pkt, uint64_t time) { uint8_t input_color, output_color; uint8_t *pkt_data = rte_pktmbuf_mtod(pkt, uint8_t *); - uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct ether_hdr); + uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct rte_ether_hdr); uint8_t flow_id = (uint8_t)(pkt_data[APP_PKT_FLOW_POS] & (APP_FLOWS_MAX - 1)); input_color = pkt_data[APP_PKT_COLOR_POS]; enum policer_action action; diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index c55d38744..61e92a820 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -50,8 +50,8 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) { struct rte_mbuf *mbuf; struct ether_fc_frame *pause_frame; - struct ether_hdr *hdr; - struct ether_addr mac_addr; + struct rte_ether_hdr *hdr; + struct rte_ether_addr mac_addr; RTE_LOG_DP(DEBUG, USER1, "Sending PAUSE frame (duration=%d) on port %d\n", @@ -63,7 +63,7 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) return; /* Prepare a PAUSE frame */ - hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); pause_frame = (struct ether_fc_frame *) &hdr[1]; rte_eth_macaddr_get(port_id, &mac_addr); diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 2058be627..a277519f5 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -115,7 +115,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) if (retval < 0) return retval; - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 3b97fbd45..8bec351ec 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -275,7 +275,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index 404f1f165..a086c5a77 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -68,7 +68,7 @@ get_printable_mac_addr(uint16_t port) { static const char err_address[] = "00:00:00:00:00:00"; static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)]; - struct ether_addr mac; + struct rte_ether_addr mac; if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; @@ -253,7 +253,7 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index 4aba1dc38..7e3cd8715 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -82,7 +82,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c index 7795d0894..64d687cd0 100644 --- a/examples/tep_termination/main.c +++ b/examples/tep_termination/main.c @@ -160,7 +160,7 @@ uint16_t ports[RTE_MAX_ETHPORTS]; static unsigned nb_ports; /**< The number of ports specified in command line */ /* ethernet addresses of ports */ -struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* heads for the main used and free linked lists for the data path. */ static struct virtio_net_data_ll *ll_root_used; diff --git a/examples/tep_termination/main.h b/examples/tep_termination/main.h index 966c63a51..7a70f7396 100644 --- a/examples/tep_termination/main.h +++ b/examples/tep_termination/main.h @@ -50,7 +50,7 @@ struct vhost_dev { /**< Memory region information for gpa to hpa translation. */ struct virtio_memory_regions_hpa *regions_hpa; /**< Device MAC address (Obtained on first TX packet). */ - struct ether_addr mac_address; + struct rte_ether_addr mac_address; /**< RX queue number. */ uint16_t rx_q; /**< Data core that the device is added to. */ diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 7732821d9..ed2a405d5 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -28,19 +28,19 @@ get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags) * header. */ static void -parse_ethernet(struct ether_hdr *eth_hdr, union tunnel_offload_info *info, +parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; uint16_t ethertype; - info->outer_l2_len = sizeof(struct ether_hdr); + info->outer_l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - info->outer_l2_len += sizeof(struct vlan_hdr); + 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); } @@ -68,7 +68,7 @@ parse_ethernet(struct ether_hdr *eth_hdr, union tunnel_offload_info *info, * Calculate the checksum of a packet in hardware */ static uint64_t -process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info) +process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info) { void *l3_hdr = NULL; uint8_t l4_proto; @@ -80,12 +80,12 @@ process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info) struct sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; - info->l2_len = sizeof(struct ether_hdr); + info->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - info->l2_len += sizeof(struct vlan_hdr); + 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); } @@ -141,7 +141,7 @@ decapsulation(struct rte_mbuf *pkt) uint16_t outer_header_len; struct udp_hdr *udp_hdr; union tunnel_offload_info info = { .data = 0 }; - struct ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); parse_ethernet(phdr, &info, &l4_proto); @@ -158,7 +158,7 @@ decapsulation(struct rte_mbuf *pkt) (pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0) return -1; outer_header_len = info.outer_l2_len + info.outer_l3_len - + sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr); + + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr); rte_pktmbuf_adj(pkt, outer_header_len); @@ -172,29 +172,29 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) uint64_t ol_flags = 0; uint32_t old_len = m->pkt_len, hash; union tunnel_offload_info tx_offload = { .data = 0 }; - struct ether_hdr *phdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ - struct ether_hdr *pneth = (struct ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) - + sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr)); + struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, + sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; - struct vxlan_hdr *vxlan = (struct vxlan_hdr *) &udp[1]; + struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; /* convert TX queue ID to vport ID */ vport_id = queue_id - 1; /* replace original Ethernet header with ours */ pneth = rte_memcpy(pneth, &app_l2_hdr[vport_id], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], sizeof(struct ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - - sizeof(struct ether_hdr)); + - sizeof(struct rte_ether_hdr)); /* outer IP checksum */ ol_flags |= PKT_TX_OUTER_IP_CKSUM; @@ -209,7 +209,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) m->l2_len += ETHER_VXLAN_HLEN; } - m->outer_l2_len = sizeof(struct ether_hdr); + m->outer_l2_len = sizeof(struct rte_ether_hdr); m->outer_l3_len = sizeof(struct ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; @@ -225,7 +225,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) udp->dgram_cksum = 0; udp->dgram_len = rte_cpu_to_be_16(old_len + sizeof(struct udp_hdr) - + sizeof(struct vxlan_hdr)); + + 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); diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index bff786a2a..780ae73cc 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -17,15 +17,15 @@ #define DEFAULT_VXLAN_PORT 4789 extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; -extern struct ether_hdr app_l2_hdr[VXLAN_N_PORTS]; +extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; struct vxlan_port { uint32_t vport_id; /**< VirtIO port id */ uint32_t peer_ip; /**< remote VTEP IP address */ - struct ether_addr peer_mac; /**< remote VTEP MAC address */ - struct ether_addr vport_mac; /**< VirtIO port MAC address */ + struct rte_ether_addr peer_mac; /**< remote VTEP MAC address */ + struct rte_ether_addr vport_mac; /**< VirtIO port MAC address */ } __rte_cache_aligned; struct vxlan_conf { diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index ad7fbe9c6..e4af7bc4d 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -49,7 +49,7 @@ struct vxlan_conf vxdev; struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; -struct ether_hdr app_l2_hdr[VXLAN_N_PORTS]; +struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ uint8_t vxlan_multicast_ips[2][4] = { {239, 1, 1, 1 }, {239, 1, 2, 1 } }; @@ -227,7 +227,7 @@ int vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) { int i, ret; - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; struct ipv4_hdr *ip; @@ -242,7 +242,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) } /* Learn MAC address of guest device from packet */ - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: This device is using an existing" diff --git a/examples/tep_termination/vxlan_setup.h b/examples/tep_termination/vxlan_setup.h index 2c20e2e39..4dc37d673 100644 --- a/examples/tep_termination/vxlan_setup.h +++ b/examples/tep_termination/vxlan_setup.h @@ -9,7 +9,7 @@ extern uint16_t nb_devices; extern uint16_t udp_port; extern uint8_t filter_idx; extern uint16_t ports[RTE_MAX_ETHPORTS]; -extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; extern uint32_t enable_stats; extern struct device_statistics dev_statistics[MAX_DEVICES]; extern uint8_t rx_decap; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index dc9ea1018..bea6b975a 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -164,7 +164,7 @@ const uint16_t vlan_tags[] = { }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; static struct vhost_dev_tailq_list vhost_dev_list = TAILQ_HEAD_INITIALIZER(vhost_dev_list); @@ -674,7 +674,7 @@ static unsigned check_ports_num(unsigned nb_ports) } static __rte_always_inline struct vhost_dev * -find_vhost_dev(struct ether_addr *mac) +find_vhost_dev(struct rte_ether_addr *mac) { struct vhost_dev *vdev; @@ -694,11 +694,11 @@ find_vhost_dev(struct ether_addr *mac) static int link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m) { - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; int i, ret; /* Learn MAC address of guest device from packet */ - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (find_vhost_dev(&pkt_hdr->s_addr)) { RTE_LOG(ERR, VHOST_DATA, @@ -800,10 +800,10 @@ virtio_xmit(struct vhost_dev *dst_vdev, struct vhost_dev *src_vdev, static __rte_always_inline int virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m) { - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; struct vhost_dev *dst_vdev; - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_vdev = find_vhost_dev(&pkt_hdr->d_addr); if (!dst_vdev) @@ -838,7 +838,7 @@ find_local_dest(struct vhost_dev *vdev, struct rte_mbuf *m, uint32_t *offset, uint16_t *vlan_tag) { struct vhost_dev *dst_vdev; - struct ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_vdev = find_vhost_dev(&pkt_hdr->d_addr); if (!dst_vdev) @@ -880,7 +880,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) void *l3_hdr; struct ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); l3_hdr = (char *)eth_hdr + m->l2_len; @@ -924,10 +924,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) struct mbuf_table *tx_q; unsigned offset = 0; const uint16_t lcore_id = rte_lcore_id(); - struct ether_hdr *nh; + struct rte_ether_hdr *nh; - nh = rte_pktmbuf_mtod(m, struct ether_hdr *); + nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) { struct vhost_dev *vdev2; @@ -960,10 +960,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) /*Add packet to the port tx queue*/ tx_q = &lcore_tx_queue[lcore_id]; - nh = rte_pktmbuf_mtod(m, struct ether_hdr *); + nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (unlikely(nh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN))) { /* Guest has inserted the vlan tag. */ - struct vlan_hdr *vh = (struct vlan_hdr *) (nh + 1); + struct rte_vlan_hdr *vh = (struct rte_vlan_hdr *) (nh + 1); uint16_t vlan_tag_be = rte_cpu_to_be_16(vlan_tag); if ((vm2vm_mode == VM2VM_HARDWARE) && (vh->vlan_tci != vlan_tag_be)) diff --git a/examples/vhost/main.h b/examples/vhost/main.h index 764c33afe..7cba0edbf 100644 --- a/examples/vhost/main.h +++ b/examples/vhost/main.h @@ -35,7 +35,7 @@ struct vhost_dev { /**< Number of memory regions for gpa to hpa translation. */ uint32_t nregions_hpa; /**< Device MAC address (Obtained on first TX packet). */ - struct ether_addr mac_address; + struct rte_ether_addr mac_address; /**< RX VMDQ queue number. */ uint16_t vmdq_rx_q; /**< Vlan tag assigned to the pool */ diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 7fa47ba97..d3713db93 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -135,7 +135,7 @@ get_pfid(struct policy *pol) RTE_ETH_FOREACH_DEV(x) { ret = rte_pmd_i40e_query_vfid_by_mac(x, - (struct ether_addr *)&(pol->pkt.vfid[i])); + (struct rte_ether_addr *)&(pol->pkt.vfid[i])); if (ret != -EINVAL) { pol->port[i] = x; break; diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c index 0db1b804f..f359ba001 100644 --- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c @@ -34,7 +34,7 @@ struct cmd_quit_result { }; union PFID { - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t pfid; }; diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 58c5fa45c..cfbb99189 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -99,7 +99,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", @@ -348,7 +348,7 @@ main(int argc, char **argv) /* Initialize ports. */ RTE_ETH_FOREACH_DEV(portid) { - struct ether_addr eth; + struct rte_ether_addr eth; int w, j; int ret; diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 627a5da48..5195a515a 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -106,12 +106,12 @@ const uint16_t num_vlans = RTE_DIM(vlan_tags); static uint16_t num_pf_queues, num_vmdq_queues; static uint16_t vmdq_pool_base, vmdq_queue_base; /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ -static struct ether_addr pool_addr_template = { +static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; #define MAX_QUEUE_NUM_10G 128 #define MAX_QUEUE_NUM_1G 8 @@ -281,7 +281,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) * Removes this after i40e fixes this issue. */ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; mac.addr_bytes[5] = q; @@ -407,10 +407,10 @@ vmdq_parse_args(int argc, char **argv) static void update_mac_address(struct rte_mbuf *m, unsigned dst_port) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 646368395..75cf31a10 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -121,12 +121,12 @@ const uint16_t vlan_tags[] = { const uint16_t num_vlans = RTE_DIM(vlan_tags); /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ -static struct ether_addr pool_addr_template = { +static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; /* Builds up the correct configuration for vmdq+dcb based on the vlan tags array * given above, and the number of traffic classes available for use. */ @@ -332,7 +332,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) /* Set mac for each pool.*/ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; @@ -494,10 +494,10 @@ vmdq_parse_args(int argc, char **argv) static void update_mac_address(struct rte_mbuf *m, unsigned dst_port) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/lib/librte_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c index 24e04755c..c9cf33f19 100644 --- a/lib/librte_cmdline/cmdline_parse_etheraddr.c +++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c @@ -12,9 +12,9 @@ #include <ctype.h> #include <string.h> #include <sys/types.h> -#include <net/ethernet.h> #include <rte_string_fns.h> +#include <rte_ether.h> #include "cmdline_parse.h" #include "cmdline_parse_etheraddr.h" @@ -29,21 +29,15 @@ struct cmdline_token_ops cmdline_token_etheraddr_ops = { /* the format can be either XX:XX:XX:XX:XX:XX or XXXX:XXXX:XXXX */ #define ETHER_ADDRSTRLENLONG 18 #define ETHER_ADDRSTRLENSHORT 15 +#define ETHER_ADDR_LEN 6 -#ifdef __linux__ -#define ea_oct ether_addr_octet -#else -#define ea_oct octet -#endif - - -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -63,21 +57,21 @@ my_ether_aton(const char *a) while (i-- != 0) { if (o[i] > UINT8_MAX) return NULL; - ether_addr.ea_oct[i] = (uint8_t)o[i]; + ether_addr.addr_bytes[i] = (uint8_t)o[i]; } /* Support the format XXXX:XXXX:XXXX */ } else if (i == ETHER_ADDR_LEN / 2) { while (i-- != 0) { if (o[i] > UINT16_MAX) return NULL; - ether_addr.ea_oct[i * 2] = (uint8_t)(o[i] >> 8); - ether_addr.ea_oct[i * 2 + 1] = (uint8_t)(o[i] & 0xff); + ether_addr.addr_bytes[i * 2] = (uint8_t)(o[i] >> 8); + ether_addr.addr_bytes[i * 2 + 1] = (uint8_t)(o[i] & 0xff); } /* unknown format */ } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -86,9 +80,9 @@ cmdline_parse_etheraddr(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, { unsigned int token_len = 0; char ether_str[ETHER_ADDRSTRLENLONG+1]; - struct ether_addr *tmp; + struct rte_ether_addr *tmp; - if (res && ressize < sizeof(struct ether_addr)) + if (res && ressize < sizeof(struct rte_ether_addr)) return -1; if (!buf || ! *buf) @@ -108,7 +102,7 @@ cmdline_parse_etheraddr(__attribute__((unused)) cmdline_parse_token_hdr_t *tk, if (tmp == NULL) return -1; if (res) - memcpy(res, tmp, sizeof(struct ether_addr)); + memcpy(res, tmp, sizeof(struct rte_ether_addr)); return token_len; } diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h index 5ea8ae24c..821d971cd 100644 --- a/lib/librte_ethdev/rte_eth_ctrl.h +++ b/lib/librte_ethdev/rte_eth_ctrl.h @@ -110,7 +110,7 @@ struct rte_eth_mac_filter { uint8_t is_vf; /**< 1 for VF, 0 for port dev */ uint16_t dst_id; /**< VF ID, available when is_vf is 1*/ enum rte_mac_filter_type filter_type; /**< MAC filter type */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; /** @@ -126,7 +126,7 @@ struct rte_eth_mac_filter { * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. */ struct rte_eth_ethertype_filter { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ uint16_t ether_type; /**< Ether type to match */ uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ uint16_t queue; /**< Queue assigned to when match*/ @@ -265,8 +265,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ /** Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP @@ -473,7 +473,7 @@ struct rte_eth_sctpv6_flow { * A structure used to define the input for MAC VLAN flow */ struct rte_eth_mac_vlan_flow { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** @@ -493,7 +493,7 @@ struct rte_eth_tunnel_flow { enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */ /** Tunnel ID to match. TNI, VNI... in big endian. */ uint32_t tunnel_id; - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 571f0e850..08e226c3a 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1235,7 +1235,7 @@ static void rte_eth_dev_mac_restore(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { - struct ether_addr *addr; + struct rte_ether_addr *addr; uint16_t i; uint32_t pool = 0; uint64_t pool_mask; @@ -2468,7 +2468,7 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask, } void -rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr) +rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; @@ -2942,7 +2942,7 @@ rte_eth_led_off(uint16_t port_id) * an empty spot. */ static int -get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) +get_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -2958,10 +2958,10 @@ get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) return -1; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; int -rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr, +rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, uint32_t pool) { struct rte_eth_dev *dev; @@ -3014,7 +3014,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr, } int -rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr) +rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr) { struct rte_eth_dev *dev; int index; @@ -3045,7 +3045,7 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr) } int -rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) +rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) { struct rte_eth_dev *dev; int ret; @@ -3074,7 +3074,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) * an empty spot. */ static int -get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) +get_hash_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3093,7 +3093,7 @@ get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) } int -rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on) { int index; @@ -3936,7 +3936,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct rte_eth_dev *dev; diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index fb40c89e0..5deb4e38e 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2159,7 +2159,7 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, * A pointer to a structure of type *ether_addr* to be filled with * the Ethernet address of the Ethernet device. */ -void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr); +void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Retrieve the contextual information of an Ethernet device. @@ -2843,7 +2843,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, * - (-ENOSPC) if no more MAC addresses can be added. * - (-EINVAL) if MAC address is invalid. */ -int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, +int rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool); /** @@ -2859,7 +2859,7 @@ int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, * - (-ENODEV) if *port* invalid. * - (-EADDRINUSE) if attempting to remove the default MAC address */ -int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); +int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Set the default MAC address. @@ -2875,7 +2875,7 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); * - (-EINVAL) if MAC address is invalid. */ int rte_eth_dev_default_mac_addr_set(uint16_t port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device. @@ -2936,7 +2936,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port_id, * - (-EIO) if device is removed. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on); /** @@ -3479,7 +3479,7 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id, * - (-ENOSPC) if *port_id* has not enough multicast filtering resources. */ int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /** diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 0d28fd902..fa518620e 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -250,17 +250,17 @@ typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); /**< @internal Remove MAC address from receive address register */ typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint8_t on); /**< @internal Set a Unicast Hash bitmap */ @@ -292,7 +292,7 @@ typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, /**< @internal Delete tunneling UDP port */ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /**< @internal set the list of multicast addresses on an Ethernet device */ @@ -597,10 +597,10 @@ struct rte_eth_dev_data { /**< Common rx buffer size handled by all queues */ uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */ - struct ether_addr* mac_addrs;/**< Device Ethernet Link address. */ + struct rte_ether_addr* mac_addrs;/**< Device Ethernet Link address. */ uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR]; /** bitmap array of associating Ethernet MAC addresses to pools */ - struct ether_addr* hash_mac_addrs; + struct rte_ether_addr* hash_mac_addrs; /** Device Ethernet MAC addresses of hash filtering. */ uint16_t port_id; /**< Device [external] port identifier. */ __extension__ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 26e2fcfa0..89e5e2278 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -577,8 +577,8 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = { * same order as on the wire. */ struct rte_flow_item_eth { - struct ether_addr dst; /**< Destination MAC. */ - struct ether_addr src; /**< Source MAC. */ + struct rte_ether_addr dst; /**< Destination MAC. */ + struct rte_ether_addr src; /**< Source MAC. */ rte_be16_t type; /**< EtherType or TPID. */ }; @@ -974,9 +974,9 @@ struct rte_flow_item_arp_eth_ipv4 { uint8_t hln; /**< Hardware address length, normally 6. */ uint8_t pln; /**< Protocol address length, normally 4. */ rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ - struct ether_addr sha; /**< Sender hardware address. */ + struct rte_ether_addr sha; /**< Sender hardware address. */ rte_be32_t spa; /**< Sender IPv4 address. */ - struct ether_addr tha; /**< Target hardware address. */ + struct rte_ether_addr tha; /**< Target hardware address. */ rte_be32_t tpa; /**< Target IPv4 address. */ }; @@ -1120,7 +1120,7 @@ rte_flow_item_icmp6_nd_opt_mask = { struct rte_flow_item_icmp6_nd_opt_sla_eth { uint8_t type; /**< ND option type, normally 1. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr sla; /**< Source Ethernet LLA. */ + struct rte_ether_addr sla; /**< Source Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */ @@ -1145,7 +1145,7 @@ rte_flow_item_icmp6_nd_opt_sla_eth_mask = { struct rte_flow_item_icmp6_nd_opt_tla_eth { uint8_t type; /**< ND option type, normally 2. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr tla; /**< Target Ethernet LLA. */ + struct rte_ether_addr tla; /**< Target Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index 870ac8c3b..168786079 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -614,8 +614,8 @@ static inline void rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, struct ipv6_hdr **ipv6_hdr) { - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); - struct vlan_hdr *vlan_hdr; + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); + struct rte_vlan_hdr *vlan_hdr; *ipv4_hdr = NULL; *ipv6_hdr = NULL; @@ -630,7 +630,7 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, break; case RTE_BE16(ETHER_TYPE_VLAN): - vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(ETHER_TYPE_IPv4): *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 2c0f35c6d..552db8f35 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -194,7 +194,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, struct gro_tcp4_tbl *tbl, uint64_t start_time) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; @@ -207,7 +207,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, int cmp; uint8_t find; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 6bb30cdb9..439f9a8c4 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -19,8 +19,8 @@ /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { - struct ether_addr eth_saddr; - struct ether_addr eth_daddr; + struct rte_ether_addr eth_saddr; + struct rte_ether_addr eth_daddr; uint32_t ip_src_addr; uint32_t ip_dst_addr; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index ca86f010c..4985b0124 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -289,11 +289,11 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, struct gro_vxlan_tcp4_tbl *tbl, uint64_t start_time) { - struct ether_hdr *outer_eth_hdr, *eth_hdr; + struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; - struct vxlan_hdr *vxlan_hdr; + struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; uint16_t tcp_dl, frag_off, outer_ip_id, ip_id; uint8_t outer_is_atomic, is_atomic; @@ -305,15 +305,15 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, uint16_t hdr_len; uint8_t find; - outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); - vxlan_hdr = (struct vxlan_hdr *)((char *)udp_hdr + + vxlan_hdr = (struct rte_vxlan_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr)); - eth_hdr = (struct ether_hdr *)((char *)vxlan_hdr + - sizeof(struct vxlan_hdr)); + eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); diff --git a/lib/librte_gro/gro_vxlan_tcp4.h b/lib/librte_gro/gro_vxlan_tcp4.h index 0cafb9211..7832942a6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.h +++ b/lib/librte_gro/gro_vxlan_tcp4.h @@ -12,10 +12,10 @@ /* Header fields representing a VxLAN flow */ struct vxlan_tcp4_flow_key { struct tcp4_flow_key inner_key; - struct vxlan_hdr vxlan_hdr; + struct rte_vxlan_hdr vxlan_hdr; - struct ether_addr outer_eth_saddr; - struct ether_addr outer_eth_daddr; + struct rte_ether_addr outer_eth_saddr; + struct rte_ether_addr outer_eth_daddr; uint32_t outer_ip_src_addr; uint32_t outer_ip_dst_addr; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index a626a11e3..433f2c8bb 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -18,11 +18,11 @@ extern "C" { #include <rte_mbuf.h> /* Minimum GSO segment size for TCP based packets. */ -#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ +#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ -#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ +#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index b8edd40f4..251698e87 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -451,7 +451,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) RTE_LOG(INFO, KNI, "Configure mac address of %d", port_id); ret = rte_eth_dev_default_mac_addr_set(port_id, - (struct ether_addr *)mac_addr); + (struct rte_ether_addr *)mac_addr); if (ret < 0) RTE_LOG(ERR, KNI, "Failed to config mac_addr for port %d\n", port_id); diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 877874a5e..921adb4cf 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -9,9 +9,9 @@ #define RARP_PKT_SIZE 64 struct rte_mbuf * __rte_experimental rte_net_make_rarp_packet(struct rte_mempool *mpool, - const struct ether_addr *mac) + const struct rte_ether_addr *mac) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *rarp; struct rte_mbuf *mbuf; @@ -22,7 +22,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, if (mbuf == NULL) return NULL; - eth_hdr = (struct ether_hdr *)rte_pktmbuf_append(mbuf, RARP_PKT_SIZE); + eth_hdr = (struct rte_ether_hdr *)rte_pktmbuf_append(mbuf, RARP_PKT_SIZE); if (eth_hdr == NULL) { rte_pktmbuf_free(mbuf); return NULL; diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index a94fa6a00..f17c52972 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -22,9 +22,9 @@ extern "C" { * ARP header IPv4 payload. */ struct rte_arp_ipv4 { - struct ether_addr arp_sha; /**< sender hardware address */ + struct rte_ether_addr arp_sha; /**< sender hardware address */ uint32_t arp_sip; /**< sender IP address */ - struct ether_addr arp_tha; /**< target hardware address */ + struct rte_ether_addr arp_tha; /**< target hardware address */ uint32_t arp_tip; /**< target IP address */ } __attribute__((__packed__)); @@ -65,7 +65,7 @@ struct rte_arp_hdr { */ struct rte_mbuf * __rte_experimental rte_net_make_rarp_packet(struct rte_mempool *mpool, - const struct ether_addr *mac); + const struct rte_ether_addr *mac); #ifdef __cplusplus } diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index bee2b34f0..ddb531845 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -54,7 +54,7 @@ extern "C" { * administrator and does not contain OUIs. * See http://standards.ieee.org/regauth/groupmac/tutorial.html */ -struct ether_addr { +struct rte_ether_addr { uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ } __attribute__((__packed__)); @@ -75,8 +75,8 @@ struct ether_addr { * True (1) if the given two ethernet address are the same; * False (0) otherwise. */ -static inline int is_same_ether_addr(const struct ether_addr *ea1, - const struct ether_addr *ea2) +static inline int 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++) @@ -95,7 +95,7 @@ static inline int is_same_ether_addr(const struct ether_addr *ea1, * True (1) if the given ethernet address is filled with zeros; * false (0) otherwise. */ -static inline int is_zero_ether_addr(const struct ether_addr *ea) +static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -114,7 +114,7 @@ static inline int is_zero_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a unicast address; * false (0) otherwise. */ -static inline int is_unicast_ether_addr(const struct ether_addr *ea) +static inline int is_unicast_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_GROUP_ADDR) == 0; } @@ -129,7 +129,7 @@ static inline int is_unicast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a multicast address; * false (0) otherwise. */ -static inline int is_multicast_ether_addr(const struct ether_addr *ea) +static inline int is_multicast_ether_addr(const struct rte_ether_addr *ea) { return ea->addr_bytes[0] & ETHER_GROUP_ADDR; } @@ -144,7 +144,7 @@ static inline int is_multicast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a broadcast address; * false (0) otherwise. */ -static inline int is_broadcast_ether_addr(const struct ether_addr *ea) +static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) { const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; @@ -162,7 +162,7 @@ static inline int is_broadcast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a universally assigned address; * false (0) otherwise. */ -static inline int is_universal_ether_addr(const struct ether_addr *ea) +static inline int is_universal_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) == 0; } @@ -177,7 +177,7 @@ static inline int is_universal_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a locally assigned address; * false (0) otherwise. */ -static inline int is_local_admin_ether_addr(const struct ether_addr *ea) +static inline int is_local_admin_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) != 0; } @@ -193,7 +193,7 @@ static inline int is_local_admin_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is valid; * false (0) otherwise. */ -static inline int is_valid_assigned_ether_addr(const struct ether_addr *ea) +static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) { return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); } @@ -222,8 +222,8 @@ static inline void eth_random_addr(uint8_t *addr) * @param ea_to * A pointer to a ether_addr structure where to copy the Ethernet address. */ -static inline void ether_addr_copy(const struct ether_addr *ea_from, - struct ether_addr *ea_to) +static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { #ifdef __INTEL_COMPILER uint16_t *from_words = (uint16_t *)(ea_from->addr_bytes); @@ -253,7 +253,7 @@ static inline void ether_addr_copy(const struct ether_addr *ea_from, */ static inline void ether_format_addr(char *buf, uint16_t size, - const struct ether_addr *eth_addr) + const struct rte_ether_addr *eth_addr) { snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", eth_addr->addr_bytes[0], @@ -268,9 +268,9 @@ ether_format_addr(char *buf, uint16_t size, * Ethernet header: Contains the destination address, source address * and frame type. */ -struct ether_hdr { - struct ether_addr d_addr; /**< Destination address. */ - struct ether_addr s_addr; /**< Source address. */ +struct rte_ether_hdr { + struct rte_ether_addr d_addr; /**< Destination address. */ + struct rte_ether_addr s_addr; /**< Source address. */ uint16_t ether_type; /**< Frame type. */ } __attribute__((__packed__)); @@ -279,7 +279,7 @@ struct ether_hdr { * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type * of the encapsulated frame. */ -struct vlan_hdr { +struct rte_vlan_hdr { uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */ uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */ } __attribute__((__packed__)); @@ -289,7 +289,7 @@ struct vlan_hdr { * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and * Reserved fields (24 bits and 8 bits) */ -struct vxlan_hdr { +struct rte_vxlan_hdr { uint32_t vx_flags; /**< flag (8) + Reserved (24). */ uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ } __attribute__((__packed__)); @@ -307,7 +307,7 @@ struct vxlan_hdr { #define ETHER_TYPE_TEB 0x6558 /**< Transparent Ethernet Bridging. */ #define ETHER_TYPE_LLDP 0x88CC /**< LLDP Protocol. */ -#define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr)) +#define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -315,7 +315,7 @@ struct vxlan_hdr { * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network * Identifier and Reserved fields (16 bits and 8 bits). */ -struct vxlan_gpe_hdr { +struct rte_vxlan_gpe_hdr { uint8_t vx_flags; /**< flag (8). */ uint8_t reserved[2]; /**< Reserved (16). */ uint8_t proto; /**< next-protocol (8). */ @@ -332,7 +332,7 @@ struct vxlan_gpe_hdr { #define VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ #define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \ - sizeof(struct vxlan_gpe_hdr)) + sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ /** @@ -348,19 +348,19 @@ struct vxlan_gpe_hdr { */ static inline int rte_vlan_strip(struct rte_mbuf *m) { - struct ether_hdr *eh - = rte_pktmbuf_mtod(m, struct ether_hdr *); - struct vlan_hdr *vh; + struct rte_ether_hdr *eh + = 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)) return -1; - vh = (struct vlan_hdr *)(eh + 1); + vh = (struct rte_vlan_hdr *)(eh + 1); m->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci); /* Copy ether header over rather than moving whole packet */ - memmove(rte_pktmbuf_adj(m, sizeof(struct vlan_hdr)), + memmove(rte_pktmbuf_adj(m, sizeof(struct rte_vlan_hdr)), eh, 2 * ETHER_ADDR_LEN); return 0; @@ -380,8 +380,8 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) */ static inline int rte_vlan_insert(struct rte_mbuf **m) { - struct ether_hdr *oh, *nh; - struct vlan_hdr *vh; + struct rte_ether_hdr *oh, *nh; + struct rte_vlan_hdr *vh; /* Can't insert header if mbuf is shared */ if (rte_mbuf_refcnt_read(*m) > 1) { @@ -394,16 +394,16 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) *m = copy; } - oh = rte_pktmbuf_mtod(*m, struct ether_hdr *); - nh = (struct ether_hdr *) - rte_pktmbuf_prepend(*m, sizeof(struct vlan_hdr)); + oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *); + nh = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(*m, sizeof(struct rte_vlan_hdr)); if (nh == NULL) return -ENOSPC; memmove(nh, oh, 2 * ETHER_ADDR_LEN); nh->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); - vh = (struct vlan_hdr *) (nh + 1); + vh = (struct rte_vlan_hdr *) (nh + 1); vh->vlan_tci = rte_cpu_to_be_16((*m)->vlan_tci); (*m)->ol_flags &= ~PKT_RX_VLAN_STRIPPED; diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 9eb7c7438..75fb66616 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -228,8 +228,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, struct rte_net_hdr_lens *hdr_lens, uint32_t layers) { struct rte_net_hdr_lens local_hdr_lens; - const struct ether_hdr *eh; - struct ether_hdr eh_copy; + const struct rte_ether_hdr *eh; + struct rte_ether_hdr eh_copy; uint32_t pkt_type = RTE_PTYPE_L2_ETHER; uint32_t off = 0; uint16_t proto; @@ -252,8 +252,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, goto l3; /* fast path if packet is IPv4 */ if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type = RTE_PTYPE_L2_ETHER_VLAN; vh = rte_pktmbuf_read(m, off, sizeof(*vh), &vh_copy); @@ -263,8 +263,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l2_len += sizeof(*vh); proto = vh->eth_proto; } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type = RTE_PTYPE_L2_ETHER_QINQ; vh = rte_pktmbuf_read(m, off + sizeof(*vh), sizeof(*vh), @@ -383,8 +383,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type &= ~RTE_PTYPE_INNER_L2_MASK; pkt_type |= RTE_PTYPE_INNER_L2_ETHER_VLAN; @@ -395,8 +395,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l2_len += sizeof(*vh); proto = vh->eth_proto; } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type &= ~RTE_PTYPE_INNER_L2_MASK; pkt_type |= RTE_PTYPE_INNER_L2_ETHER_QINQ; diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 537e6593e..693be2cad 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -449,7 +449,7 @@ encap_cfg_check(struct rte_table_action_encap_config *encap) } struct encap_ether_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; } __attribute__((__packed__)); #define VLAN(pcp, dei, vid) \ @@ -458,14 +458,14 @@ struct encap_ether_data { (((uint64_t)(vid)) & 0xFFFLLU)) \ struct encap_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; } __attribute__((__packed__)); struct encap_qinq_data { - struct ether_hdr ether; - struct vlan_hdr svlan; - struct vlan_hdr cvlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr svlan; + struct rte_vlan_hdr cvlan; } __attribute__((__packed__)); #define ETHER_TYPE_MPLS_UNICAST 0x8847 @@ -479,7 +479,7 @@ struct encap_qinq_data { (((uint64_t)(ttl)) & 0xFFLLU))) struct encap_mpls_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX]; uint32_t mpls_count; } __attribute__((__packed__)); @@ -496,40 +496,40 @@ struct pppoe_ppp_hdr { } __attribute__((__packed__)); struct encap_pppoe_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct pppoe_ppp_hdr pppoe_ppp; } __attribute__((__packed__)); #define IP_PROTO_UDP 17 struct encap_vxlan_ipv4_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct ipv4_hdr ipv4; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv4_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; struct ipv4_hdr ipv4; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct ipv6_hdr ipv6; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; struct ipv6_hdr ipv6; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); static size_t @@ -962,13 +962,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + sizeof(struct ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -992,13 +992,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + sizeof(struct ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1022,10 +1022,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1048,10 +1048,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1098,7 +1098,7 @@ pkt_work_encap(struct rte_mbuf *mbuf, case 1LLU << RTE_TABLE_ACTION_ENCAP_MPLS: { struct encap_mpls_data *mpls = data; - size_t size = sizeof(struct ether_hdr) + + size_t size = sizeof(struct rte_ether_hdr) + mpls->mpls_count * 4; encap(ip, data, size); diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index c96061291..400bd5e2c 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -384,8 +384,8 @@ enum rte_table_action_encap_type { /** Pre-computed Ethernet header fields for encapsulation action. */ struct rte_table_action_ether_hdr { - struct ether_addr da; /**< Destination address. */ - struct ether_addr sa; /**< Source address. */ + struct rte_ether_addr da; /**< Destination address. */ + struct rte_ether_addr sa; /**< Source address. */ }; /** Pre-computed VLAN header fields for encapsulation action. */ diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index b4abad30c..064ebb951 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -356,7 +356,7 @@ struct virtio_net { uint64_t log_size; uint64_t log_base; uint64_t log_addr; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t mtu; struct vhost_device_ops const *notify_ops; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index f8794ee19..4ff9b66cd 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -969,18 +969,18 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t ethertype; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - m->l2_len += sizeof(struct vlan_hdr); + m->l2_len += sizeof(struct rte_vlan_hdr); ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); } diff --git a/test/test-pipeline/pipeline_acl.c b/test/test-pipeline/pipeline_acl.c index 524d2212d..8853d4376 100644 --- a/test/test-pipeline/pipeline_acl.c +++ b/test/test-pipeline/pipeline_acl.c @@ -39,7 +39,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, { @@ -47,7 +47,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, { @@ -55,7 +55,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, { @@ -63,14 +63,14 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr), + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/test/test-pipeline/pipeline_hash.c b/test/test-pipeline/pipeline_hash.c index c20147234..3e4a0a1bb 100644 --- a/test/test-pipeline/pipeline_hash.c +++ b/test/test-pipeline/pipeline_hash.c @@ -441,14 +441,14 @@ app_main_loop_rx_metadata(void) { if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip_hdr = (struct ipv4_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { ipv6_hdr = (struct ipv6_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; memcpy(key, ipv6_dst, 16); diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index ccc0bd591..51ab0db29 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -53,16 +53,16 @@ copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } void -initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t ether_type, +initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id) { ether_addr_copy(dst_mac, ð_hdr->d_addr); ether_addr_copy(src_mac, ð_hdr->s_addr); if (vlan_enabled) { - struct vlan_hdr *vhdr = (struct vlan_hdr *)((uint8_t *)eth_hdr + - sizeof(struct ether_hdr)); + 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); @@ -74,8 +74,8 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, } void -initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); @@ -256,7 +256,7 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { @@ -293,9 +293,9 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, * Copy headers in first packet segment(s). */ if (vlan_enabled) - eth_hdr_size = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr); else - eth_hdr_size = sizeof(struct ether_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr); copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); @@ -334,7 +334,7 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, int generate_packet_burst_proto(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, uint8_t proto, void *proto_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { @@ -371,10 +371,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, * Copy headers in first packet segment(s). */ if (vlan_enabled) - eth_hdr_size = sizeof(struct ether_hdr) + - sizeof(struct vlan_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr); else - eth_hdr_size = sizeof(struct ether_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr); copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index b6e013a11..8489212d0 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -24,13 +24,13 @@ extern "C" { #define PACKET_BURST_GEN_PKT_LEN_128 128 void -initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t ether_type, +initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id); void -initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); uint16_t @@ -59,14 +59,14 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); int generate_packet_burst_proto(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, uint8_t proto, void *proto_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); diff --git a/test/test/test_cmdline_etheraddr.c b/test/test/test_cmdline_etheraddr.c index 6ceba4b29..8e524e582 100644 --- a/test/test/test_cmdline_etheraddr.c +++ b/test/test/test_cmdline_etheraddr.c @@ -82,7 +82,7 @@ const char * ether_addr_invalid_strs[] = { static int -is_addr_different(const struct ether_addr addr, uint64_t num) +is_addr_different(const struct rte_ether_addr addr, uint64_t num) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++, num >>= 8) @@ -97,7 +97,7 @@ int test_parse_etheraddr_invalid_param(void) { char buf[CMDLINE_TEST_BUFSIZE]; - struct ether_addr result; + struct rte_ether_addr result; int ret = 0; /* try all null */ @@ -149,12 +149,12 @@ test_parse_etheraddr_invalid_data(void) { int ret = 0; unsigned i; - struct ether_addr result; + struct rte_ether_addr result; /* test full strings */ for (i = 0; i < ETHERADDR_INVALID_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_invalid_strs[i], (void*)&result, sizeof(result)); @@ -174,12 +174,12 @@ test_parse_etheraddr_valid(void) { int ret = 0; unsigned i; - struct ether_addr result; + struct rte_ether_addr result; /* test full strings */ for (i = 0; i < ETHERADDR_VALID_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_valid_strs[i].str, (void*)&result, sizeof(result)); @@ -198,7 +198,7 @@ test_parse_etheraddr_valid(void) /* test garbage strings */ for (i = 0; i < ETHERADDR_GARBAGE_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_garbage_strs[i], (void*)&result, sizeof(result)); diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c index 1d3be82b5..d0255ec1c 100644 --- a/test/test/test_event_eth_rx_adapter.c +++ b/test/test/test_event_eth_rx_adapter.c @@ -78,7 +78,7 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf, return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/test/test/test_event_eth_tx_adapter.c b/test/test/test_event_eth_tx_adapter.c index c26c5152c..208d20c53 100644 --- a/test/test/test_event_eth_tx_adapter.c +++ b/test/test/test_event_eth_tx_adapter.c @@ -84,7 +84,7 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf, return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index 5f5beeee7..f81bbba3a 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -39,7 +39,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -49,7 +49,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -59,7 +59,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -72,7 +72,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -82,7 +82,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -489,7 +489,7 @@ static int init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); @@ -503,9 +503,9 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, printf("Set up IPv4 UDP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, src_addr, dst_addr, @@ -526,7 +526,7 @@ static int init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); @@ -540,9 +540,9 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, printf("Set up IPv4 TCP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, @@ -563,7 +563,7 @@ static int init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); @@ -577,9 +577,9 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, printf("Set up IPv4 SCTP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index 2c20f44ea..25276715a 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -73,11 +73,11 @@ struct link_bonding_unittest_params { struct rte_mempool *mbuf_pool; - struct ether_addr *default_slave_mac; - struct ether_addr *default_bonded_mac; + struct rte_ether_addr *default_slave_mac; + struct rte_ether_addr *default_bonded_mac; /* Packet Headers */ - struct ether_hdr *pkt_eth_hdr; + struct rte_ether_hdr *pkt_eth_hdr; struct ipv4_hdr *pkt_ipv4_hdr; struct ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; @@ -99,8 +99,8 @@ static struct link_bonding_unittest_params default_params = { .mbuf_pool = NULL, - .default_slave_mac = (struct ether_addr *)slave_mac, - .default_bonded_mac = (struct ether_addr *)bonded_mac, + .default_slave_mac = (struct rte_ether_addr *)slave_mac, + .default_bonded_mac = (struct rte_ether_addr *)bonded_mac, .pkt_eth_hdr = NULL, .pkt_ipv4_hdr = &pkt_ipv4_hdr, @@ -210,12 +210,12 @@ static int test_setup(void) { int i, nb_mbuf_per_pool; - struct ether_addr *mac_addr = (struct ether_addr *)slave_mac; + struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)slave_mac; /* Allocate ethernet packet header with space for VLAN header */ if (test_params->pkt_eth_hdr == NULL) { - test_params->pkt_eth_hdr = malloc(sizeof(struct ether_hdr) + - sizeof(struct vlan_hdr)); + test_params->pkt_eth_hdr = malloc(sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr)); TEST_ASSERT_NOT_NULL(test_params->pkt_eth_hdr, "Ethernet header struct allocation failed!"); @@ -376,7 +376,7 @@ static int test_remove_slave_from_bonded_device(void) { int current_slave_count; - struct ether_addr read_mac_addr, *mac_addr; + struct rte_ether_addr read_mac_addr, *mac_addr; uint16_t slaves[RTE_MAX_ETHPORTS]; TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(test_params->bonded_port_id, @@ -394,7 +394,7 @@ test_remove_slave_from_bonded_device(void) current_slave_count, test_params->bonded_slave_count - 1); - mac_addr = (struct ether_addr *)slave_mac; + mac_addr = (struct rte_ether_addr *)slave_mac; mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = test_params->bonded_slave_count-1; @@ -699,8 +699,8 @@ static int test_set_primary_slave(void) { int i, j, retval; - struct ether_addr read_mac_addr; - struct ether_addr *expected_mac_addr; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr *expected_mac_addr; /* Add 4 slaves to bonded device */ for (i = test_params->bonded_slave_count; i < 4; i++) @@ -750,7 +750,7 @@ test_set_primary_slave(void) "Failed to start bonded port %d", test_params->bonded_port_id); - expected_mac_addr = (struct ether_addr *)&slave_mac; + expected_mac_addr = (struct rte_ether_addr *)&slave_mac; expected_mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; /* Check primary slave MAC */ @@ -801,12 +801,12 @@ static int test_set_explicit_bonded_mac(void) { int i; - struct ether_addr read_mac_addr; - struct ether_addr *mac_addr; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr *mac_addr; uint8_t explicit_bonded_mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x01 }; - mac_addr = (struct ether_addr *)explicit_bonded_mac; + mac_addr = (struct rte_ether_addr *)explicit_bonded_mac; /* Invalid port ID */ TEST_ASSERT_FAIL(rte_eth_bond_mac_address_set(INVALID_PORT_ID, mac_addr), @@ -878,11 +878,11 @@ test_set_bonded_port_initialization_mac_assignment(void) uint16_t slaves[RTE_MAX_ETHPORTS]; int slave_port_ids[BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT]; - struct ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; + struct rte_ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; /* Initialize default values for MAC addresses */ - memcpy(&slave_mac_addr, slave_mac, sizeof(struct ether_addr)); - memcpy(&bonded_mac_addr, slave_mac, sizeof(struct ether_addr)); + memcpy(&slave_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); + memcpy(&bonded_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); /* * 1. a - Create / configure bonded / slave ethdevs @@ -1268,11 +1268,11 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, if (toggle_dst_mac) initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_1, ether_type, vlan, vlan_id); else initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ether_type, vlan, vlan_id); @@ -1663,7 +1663,7 @@ test_roundrobin_rx_burst_on_multiple_slaves(void) static int test_roundrobin_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_2; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_2; int i; @@ -1722,7 +1722,7 @@ test_roundrobin_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "Failed to set MAC"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -1931,7 +1931,7 @@ int polling_test_slaves[TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT] = { -1, -1 }; static int test_roundrobin_verfiy_polling_slave_link_status_change(void) { - struct ether_addr *mac_addr = (struct ether_addr *)polling_slave_mac; + struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)polling_slave_mac; char slave_name[RTE_ETH_NAME_MAX_LEN]; int i; @@ -2030,7 +2030,7 @@ test_activebackup_tx_burst(void) "Failed to initialize bonded device with slaves"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -2237,7 +2237,7 @@ test_activebackup_verify_promiscuous_enable_disable(void) static int test_activebackup_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -2319,7 +2319,7 @@ test_activebackup_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -2564,7 +2564,7 @@ test_balance_l2_tx_burst(void) "Failed to set balance xmit policy."); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -2579,7 +2579,7 @@ test_balance_l2_tx_burst(void) "failed to generate packet burst"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_1, ETHER_TYPE_IPv4, 0, 0); /* Generate a burst 2 of packets to transmit */ @@ -3129,7 +3129,7 @@ test_balance_verify_promiscuous_enable_disable(void) static int test_balance_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -3211,7 +3211,7 @@ test_balance_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -3402,7 +3402,7 @@ test_broadcast_tx_burst(void) "Failed to initialise bonded device"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, @@ -3713,7 +3713,7 @@ test_broadcast_verify_promiscuous_enable_disable(void) static int test_broadcast_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; int i; @@ -3774,7 +3774,7 @@ test_broadcast_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "Failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -3985,12 +3985,12 @@ test_tlb_tx_burst(void) /*test two types of mac src own(bonding) and others */ if (i % 2 == 0) { initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); } else { initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)test_params->default_slave_mac, - (struct ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)test_params->default_slave_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); } pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -4201,7 +4201,7 @@ test_tlb_verify_promiscuous_enable_disable(void) static int test_tlb_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -4284,7 +4284,7 @@ test_tlb_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -4459,14 +4459,14 @@ test_alb_change_mac_in_reply_sent(void) struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; - struct ether_hdr *eth_pkt; + struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; int slave_idx, nb_pkts, pkt_idx; int retval = 0; - struct ether_addr bond_mac, client_mac; - struct ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr bond_mac, client_mac; + struct rte_ether_addr *slave_mac1, *slave_mac2; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4492,40 +4492,40 @@ test_alb_change_mac_in_reply_sent(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4545,8 +4545,8 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4570,7 +4570,7 @@ test_alb_change_mac_in_reply_sent(void) static int test_alb_reply_from_client(void) { - struct ether_hdr *eth_pkt; + struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; @@ -4579,8 +4579,8 @@ test_alb_reply_from_client(void) int slave_idx, nb_pkts, pkt_idx, nb_pkts_sum = 0; int retval = 0; - struct ether_addr bond_mac, client_mac; - struct ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr bond_mac, client_mac; + struct rte_ether_addr *slave_mac1, *slave_mac2; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4605,10 +4605,10 @@ test_alb_reply_from_client(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4616,10 +4616,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client2, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4627,10 +4627,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client3, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4638,10 +4638,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client4, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4666,8 +4666,8 @@ test_alb_reply_from_client(void) nb_pkts_sum += nb_pkts; for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4697,8 +4697,8 @@ test_alb_reply_from_client(void) static int test_alb_receive_vlan_reply(void) { - struct ether_hdr *eth_pkt; - struct vlan_hdr *vlan_pkt; + struct rte_ether_hdr *eth_pkt; + struct rte_vlan_hdr *vlan_pkt; struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; @@ -4707,7 +4707,7 @@ test_alb_receive_vlan_reply(void) int slave_idx, nb_pkts, pkt_idx; int retval = 0; - struct ether_addr bond_mac, client_mac; + struct rte_ether_addr bond_mac, client_mac; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4731,10 +4731,10 @@ test_alb_receive_vlan_reply(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_VLAN, 0, 0); - vlan_pkt = (struct vlan_hdr *)((char *)(eth_pkt + 1)); + 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 = vlan_pkt+1; @@ -4758,8 +4758,8 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - vlan_pkt = (struct vlan_hdr *)((char *)(eth_pkt + 1)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + vlan_pkt = (struct rte_vlan_hdr *)((char *)(eth_pkt + 1)); if (vlan_pkt->vlan_tci != rte_cpu_to_be_16(1)) { retval = -1; goto test_end; diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index e539f078d..63fcafaea 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -54,19 +54,19 @@ #define INVALID_PORT_ID (0xFF) #define INVALID_BONDING_MODE (-1) -static const struct ether_addr slave_mac_default = { +static const struct rte_ether_addr slave_mac_default = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; -static const struct ether_addr parnter_mac_default = { +static const struct rte_ether_addr parnter_mac_default = { { 0x22, 0xBB, 0xFF, 0xBB, 0x00, 0x00 } }; -static const struct ether_addr parnter_system = { +static const struct rte_ether_addr parnter_system = { { 0x33, 0xFF, 0xBB, 0xFF, 0x00, 0x00 } }; -static const struct ether_addr slow_protocol_mac_addr = { +static const struct rte_ether_addr slow_protocol_mac_addr = { { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; @@ -80,8 +80,8 @@ struct slave_conf { }; struct ether_vlan_hdr { - struct ether_hdr pkt_eth_hdr; - struct vlan_hdr vlan_hdr; + struct rte_ether_hdr pkt_eth_hdr; + struct rte_vlan_hdr vlan_hdr; }; struct link_bonding_unittest_params { @@ -224,7 +224,7 @@ configure_ethdev(uint16_t port_id, uint8_t start) static int add_slave(struct slave_conf *slave, uint8_t start) { - struct ether_addr addr, addr_check; + struct rte_ether_addr addr, addr_check; /* Some sanity check */ RTE_VERIFY(test_params.slave_ports <= slave && @@ -293,12 +293,12 @@ remove_slave(struct slave_conf *slave) static void lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) { - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; RTE_VERIFY(lacp_pkt != NULL); - hdr = rte_pktmbuf_mtod(lacp_pkt, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(lacp_pkt, struct rte_ether_hdr *); RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_SLOW)); slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *); @@ -474,12 +474,12 @@ testsuite_teardown(void) static int make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) { - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; struct lacpdu *lacp; /* look for LACP */ - hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW)) return 1; @@ -718,8 +718,8 @@ test_mode4_agg_mode_selection(void) } static int -generate_packets(struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf) +generate_packets(struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf) { uint16_t pktlen = PACKET_BURST_GEN_PKT_LEN; uint8_t vlan_enable = 0; @@ -731,7 +731,7 @@ generate_packets(struct ether_addr *src_mac, uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { struct ipv4_hdr v4; @@ -765,8 +765,8 @@ generate_packets(struct ether_addr *src_mac, } static int -generate_and_put_packets(struct slave_conf *slave, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t count) +generate_and_put_packets(struct slave_conf *slave, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t count) { struct rte_mbuf *pkts[MAX_PKT_BURST]; int retval; @@ -796,11 +796,11 @@ test_mode4_rx(void) int retval; unsigned delay; - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; - struct ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; - struct ether_addr dst_mac; - struct ether_addr bonded_mac; + struct rte_ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; + struct rte_ether_addr dst_mac; + struct rte_ether_addr bonded_mac; retval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, 0); @@ -844,7 +844,7 @@ test_mode4_rx(void) int cnt[2] = { 0, 0 }; for (i = 0; i < expected_pkts_cnt; i++) { - hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; } @@ -888,7 +888,7 @@ test_mode4_rx(void) int eq_cnt = 0; for (i = 0; i < expected_pkts_cnt; i++) { - hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac); } @@ -977,8 +977,8 @@ test_mode4_tx_burst(void) int retval; unsigned delay; - struct ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; - struct ether_addr bonded_mac; + struct rte_ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; + struct rte_ether_addr bonded_mac; retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -1351,7 +1351,7 @@ test_mode4_ext_ctrl(void) uint8_t i; struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; - struct ether_addr src_mac, dst_mac; + struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { .subtype = SLOW_SUBTYPE_LACP, @@ -1405,7 +1405,7 @@ test_mode4_ext_lacp(void) struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; struct rte_mbuf *buf[SLAVE_COUNT]; - struct ether_addr src_mac, dst_mac; + struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { .subtype = SLOW_SUBTYPE_LACP, diff --git a/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c index d82de2cef..4392522ea 100644 --- a/test/test/test_link_bonding_rssconf.c +++ b/test/test/test_link_bonding_rssconf.c @@ -495,7 +495,7 @@ test_setup(void) int port_id; char name[256]; struct slave_conf *port; - struct ether_addr mac_addr = { .addr_bytes = {0} }; + struct rte_ether_addr mac_addr = { .addr_bytes = {0} }; if (test_params.mbuf_pool == NULL) { diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index f5095c87d..1265cb86f 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -58,7 +58,7 @@ static struct rte_mempool *mbufpool[NB_SOCKETS]; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { @@ -171,7 +171,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -182,7 +182,7 @@ static int init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; @@ -191,8 +191,8 @@ init_traffic(struct rte_mempool *mp, initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, IPV4_ADDR(10, 0, 0, 1), diff --git a/test/test/test_sched.c b/test/test/test_sched.c index 32e500ba9..3cbf5844e 100644 --- a/test/test/test_sched.c +++ b/test/test/test_sched.c @@ -78,15 +78,15 @@ create_mempool(void) static void prepare_pkt(struct rte_mbuf *mbuf) { - struct ether_hdr *eth_hdr; - struct vlan_hdr *vlan1, *vlan2; + struct rte_ether_hdr *eth_hdr; + struct rte_vlan_hdr *vlan1, *vlan2; struct ipv4_hdr *ip_hdr; /* Simulate a classifier */ - eth_hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); - vlan1 = (struct vlan_hdr *)(ð_hdr->ether_type ); - vlan2 = (struct vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct vlan_hdr)); - eth_hdr = (struct ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct vlan_hdr)); + eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); + vlan1 = (struct rte_vlan_hdr *)(ð_hdr->ether_type ); + vlan2 = (struct rte_vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct rte_vlan_hdr)); + eth_hdr = (struct rte_ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct rte_vlan_hdr)); ip_hdr = (struct ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); diff --git a/test/test/virtual_pmd.c b/test/test/virtual_pmd.c index f8ddc2db8..15ce64445 100644 --- a/test/test/virtual_pmd.c +++ b/test/test/virtual_pmd.c @@ -218,7 +218,7 @@ virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused) static int virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct ether_addr *addr) + __rte_unused struct rte_ether_addr *addr) { return 0; } @@ -496,7 +496,7 @@ virtual_ethdev_get_mbufs_from_tx_queue(uint16_t port_id, int -virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, +virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support) { struct rte_pci_device *pci_dev = NULL; diff --git a/test/test/virtual_pmd.h b/test/test/virtual_pmd.h index 5ca02bb50..120b58b27 100644 --- a/test/test/virtual_pmd.h +++ b/test/test/virtual_pmd.h @@ -15,7 +15,7 @@ int virtual_ethdev_init(void); int -virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, +virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support); void -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 03/14] net: add rte prefix to ether structures 2018-10-24 8:18 ` [dpdk-dev] [RFC 03/14] net: add rte prefix to ether structures Olivier Matz @ 2018-12-20 22:04 ` Ferruh Yigit 0 siblings, 0 replies; 107+ messages in thread From: Ferruh Yigit @ 2018-12-20 22:04 UTC (permalink / raw) To: Olivier MATZ, dpdk-dev; +Cc: Thomas Monjalon On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: > diff --git a/lib/librte_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c > index 24e04755c..c9cf33f19 100644 > --- a/lib/librte_cmdline/cmdline_parse_etheraddr.c > +++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c > @@ -12,9 +12,9 @@ > #include <ctype.h> > #include <string.h> > #include <sys/types.h> > -#include <net/ethernet.h> > #include <rte_string_fns.h> > +#include <rte_ether.h> This is creating dependency from 'cmdline' library to 'net' library, Makefile and meson needs to be updated to not break build. ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 04/14] net: add rte prefix to ether functions 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (2 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 03/14] net: add rte prefix to ether structures Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 05/14] net: add rte prefix to ether defines Olivier Matz ` (16 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to functions: - rename is_same_ether_addr() as rte_is_same_ether_addr(). - rename is_zero_ether_addr() as rte_is_zero_ether_addr(). - rename is_unicast_ether_addr() as rte_is_unicast_ether_addr(). - rename is_multicast_ether_addr() as rte_is_multicast_ether_addr(). - rename is_broadcast_ether_addr() as rte_is_broadcast_ether_addr(). - rename is_universal_ether_addr() as rte_is_universal_ether_addr(). - rename is_local_admin_ether_addr() as rte_is_local_admin_ether_addr(). - rename is_valid_assigned_ether_addr() as rte_is_valid_assigned_ether_addr(). - rename eth_random_addr() as rte_eth_random_addr(). - rename ether_addr_copy() as rte_ether_addr_copy(). - rename ether_format_addr() as rte_ether_format_addr(). Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/cmdline.c | 6 ++-- app/test-pmd/config.c | 8 ++--- app/test-pmd/csumonly.c | 4 +-- app/test-pmd/flowgen.c | 4 +-- app/test-pmd/icmpecho.c | 22 ++++++------ app/test-pmd/ieee1588fwd.c | 6 ++-- app/test-pmd/macfwd.c | 4 +-- app/test-pmd/macswap.c | 6 ++-- app/test-pmd/txonly.c | 4 +-- app/test-pmd/util.c | 2 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 4 +-- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 2 +- .../sample_app_ug/l2_forward_real_virtual.rst | 2 +- doc/guides/sample_app_ug/link_status_intr.rst | 2 +- drivers/net/atlantic/atl_ethdev.c | 2 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 4 +-- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 2 +- drivers/net/avf/avf_ethdev.c | 14 ++++---- drivers/net/avf/avf_vchnl.c | 4 +-- drivers/net/avp/avp_ethdev.c | 6 ++-- drivers/net/axgbe/axgbe_ethdev.c | 6 ++-- drivers/net/bnx2x/bnx2x.c | 4 +-- drivers/net/bnx2x/bnx2x_vfpf.c | 6 ++-- drivers/net/bnxt/bnxt_flow.c | 12 +++---- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 18 +++++----- drivers/net/bonding/rte_eth_bond_alb.c | 26 +++++++------- drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++----- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 4 +-- drivers/net/dpaa/dpaa_ethdev.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 8 ++--- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 8 ++--- drivers/net/e1000/igb_flow.c | 8 ++--- drivers/net/e1000/igb_pf.c | 6 ++-- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enetc/enetc_ethdev.c | 2 +- drivers/net/enic/enic_main.c | 2 +- drivers/net/failsafe/failsafe.c | 4 +-- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 12 +++---- drivers/net/i40e/i40e_ethdev.c | 38 ++++++++++---------- drivers/net/i40e/i40e_ethdev_vf.c | 16 ++++----- drivers/net/i40e/i40e_flow.c | 24 ++++++------- drivers/net/i40e/i40e_pf.c | 6 ++-- drivers/net/i40e/rte_pmd_i40e.c | 10 +++--- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++--- drivers/net/ixgbe/ixgbe_flow.c | 8 ++--- drivers/net/ixgbe/ixgbe_pf.c | 4 +-- drivers/net/ixgbe/rte_pmd_ixgbe.c | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/mlx4/mlx4_flow.c | 2 +- drivers/net/mlx5/mlx5_flow_tcf.c | 4 +-- drivers/net/mlx5/mlx5_mac.c | 4 +-- drivers/net/mlx5/mlx5_nl.c | 6 ++-- drivers/net/mvneta/mvneta_ethdev.c | 6 ++-- drivers/net/mvpp2/mrvl_ethdev.c | 6 ++-- drivers/net/netvsc/hn_rxtx.c | 4 +-- drivers/net/netvsc/hn_vf.c | 6 ++-- drivers/net/nfp/nfp_net.c | 6 ++-- drivers/net/null/rte_eth_null.c | 2 +- drivers/net/qede/qede_ethdev.c | 26 +++++++------- drivers/net/sfc/sfc_ethdev.c | 6 ++-- drivers/net/sfc/sfc_flow.c | 10 +++--- drivers/net/sfc/sfc_port.c | 2 +- drivers/net/szedata2/rte_eth_szedata2.c | 2 +- drivers/net/tap/rte_eth_tap.c | 10 +++--- drivers/net/tap/tap_flow.c | 4 +-- drivers/net/thunderx/base/nicvf_mbox.c | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 6 ++-- drivers/net/vdev_netvsc/vdev_netvsc.c | 4 +-- drivers/net/vhost/rte_eth_vhost.c | 4 +-- drivers/net/virtio/virtio_ethdev.c | 10 +++--- drivers/net/virtio/virtio_rxtx.c | 4 +-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +-- examples/bond/main.c | 8 ++--- examples/ethtool/ethtool-app/main.c | 4 +-- examples/ethtool/lib/rte_ethtool.c | 2 +- examples/eventdev_pipeline/pipeline_common.h | 4 +-- examples/flow_filtering/main.c | 2 +- examples/ip_fragmentation/main.c | 4 +-- examples/ip_reassembly/main.c | 4 +-- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/ipv4_multicast/main.c | 6 ++-- examples/kni/main.c | 2 +- examples/l2fwd-crypto/main.c | 2 +- examples/l2fwd-jobstats/main.c | 2 +- examples/l2fwd-keepalive/main.c | 2 +- examples/l2fwd/main.c | 2 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 6 ++-- examples/l3fwd-vf/main.c | 4 +-- examples/l3fwd/l3fwd_em.h | 4 +-- examples/l3fwd/l3fwd_lpm.h | 4 +-- examples/l3fwd/main.c | 4 +-- examples/link_status_interrupt/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 40 +++++++++++----------- examples/ptpclient/ptpclient.c | 2 +- examples/quota_watermark/qw/main.c | 2 +- examples/tep_termination/vxlan_setup.c | 14 ++++---- examples/vhost/main.c | 4 +-- examples/vmdq/main.c | 2 +- examples/vmdq_dcb/main.c | 2 +- lib/librte_ethdev/rte_ethdev.c | 20 +++++------ lib/librte_gro/gro_tcp4.c | 8 ++--- lib/librte_gro/gro_tcp4.h | 4 +-- lib/librte_gro/gro_vxlan_tcp4.c | 20 +++++------ lib/librte_net/rte_arp.c | 6 ++-- lib/librte_net/rte_ether.h | 24 ++++++------- lib/librte_pipeline/rte_table_action.c | 36 +++++++++---------- test/test/packet_burst_generator.c | 8 ++--- test/test/test_link_bonding.c | 14 ++++---- test/test/test_link_bonding_mode4.c | 26 +++++++------- test/test/test_pmd_perf.c | 2 +- 116 files changed, 414 insertions(+), 414 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index c866ffe32..d21d984bb 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -8607,8 +8607,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); - ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); - ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { @@ -12261,7 +12261,7 @@ static void cmd_mcast_addr_parsed(void *parsed_result, { struct cmd_mcast_addr_result *res = parsed_result; - if (!is_multicast_ether_addr(&res->mc_addr)) { + if (!rte_is_multicast_ether_addr(&res->mc_addr)) { printf("Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n", res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1], res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3], diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 614719ec0..9db38e327 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -107,7 +107,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3530,7 +3530,7 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) * in the pool of multicast addresses. */ for (i = 0; i < port->mc_addr_nb; i++) { - if (is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) { + if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) { printf("multicast address already filtered by port\n"); return; } @@ -3538,7 +3538,7 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) if (mcast_addr_pool_extend(port) != 0) return; - ether_addr_copy(mc_addr, &port->mc_addr_pool[i]); + rte_ether_addr_copy(mc_addr, &port->mc_addr_pool[i]); eth_port_multicast_addr_list_set(port_id); } @@ -3557,7 +3557,7 @@ mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr) * Search the pool of multicast MAC addresses for the removed address. */ for (i = 0; i < port->mc_addr_nb; i++) { - if (is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) + if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) break; } if (i == port->mc_addr_nb) { diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 2c458693d..f3fb78a75 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -762,9 +762,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) * and inner headers */ eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); parse_ethernet(eth_hdr, &info); l3_hdr = (char *)eth_hdr + info.l2_len; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 574162cd4..cbba5211a 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -171,8 +171,8 @@ pkt_burst_flow_gen(struct fwd_stream *fs) /* Initialize Ethernet header. */ eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); - ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); + 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); /* Initialize IP header. */ diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 49720ad41..879f6283d 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -225,7 +225,7 @@ ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); if (what) printf("%s", what); printf("%s", buf); @@ -370,12 +370,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) continue; } if (verbose_level > 0) { - ether_addr_copy(&arp_h->arp_data.arp_sha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_sha, ð_addr); ether_addr_dump(" sha=", ð_addr); ip_addr = arp_h->arp_data.arp_sip; ipv4_addr_dump(" sip=", ip_addr); printf("\n"); - ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_dump(" tha=", ð_addr); ip_addr = arp_h->arp_data.arp_tip; ipv4_addr_dump(" tip=", ip_addr); @@ -391,15 +391,15 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) */ /* Use source MAC address as destination MAC address. */ - ether_addr_copy(ð_h->s_addr, ð_h->d_addr); + rte_ether_addr_copy(ð_h->s_addr, ð_h->d_addr); /* Set source MAC address with MAC address of TX port */ - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); - ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); - ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); - ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); + rte_ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); + rte_ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); /* Swap IP addresses in ARP payload */ ip_addr = arp_h->arp_data.arp_sip; @@ -456,9 +456,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ - ether_addr_copy(ð_h->s_addr, ð_addr); - ether_addr_copy(ð_h->d_addr, ð_h->s_addr); - ether_addr_copy(ð_addr, ð_h->d_addr); + rte_ether_addr_copy(ð_h->s_addr, ð_addr); + rte_ether_addr_copy(ð_h->d_addr, ð_h->s_addr); + rte_ether_addr_copy(ð_addr, ð_h->d_addr); ip_addr = ip_h->src_addr; if (is_multicast_ipv4_addr(ip_h->dst_addr)) { uint32_t ip_src; diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index c6aa3c618..2b7003be4 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -178,9 +178,9 @@ ieee1588_packet_fwd(struct fwd_stream *fs) port_ieee1588_rx_timestamp_check(fs->rx_port, timesync_index); /* Swap dest and src mac addresses. */ - ether_addr_copy(ð_hdr->d_addr, &addr); - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - ether_addr_copy(&addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->d_addr, &addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&addr, ð_hdr->s_addr); /* Forward PTP packet with hardware TX timestamp */ mb->ol_flags |= PKT_TX_IEEE1588_TMST; diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 631f86f3e..f15149252 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -92,9 +92,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs) void *)); mb = pkts_burst[i]; eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 36d385728..4c57a2a56 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -123,9 +123,9 @@ pkt_burst_mac_swap(struct fwd_stream *fs) eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ - ether_addr_copy(ð_hdr->d_addr, &addr); - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - ether_addr_copy(&addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->d_addr, &addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 3aa5e2560..eb7319466 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -227,8 +227,8 @@ pkt_burst_transmit(struct fwd_stream *fs) /* * Initialize Ethernet header. */ - ether_addr_copy(&peer_eth_addrs[fs->peer_addr],ð_hdr.d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); + 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); /* diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 31815292e..c7c497389 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -17,7 +17,7 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", what, buf); } diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 8f2fb3930..68ae68596 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -227,8 +227,8 @@ The actual packet transmission is done in the mcast_send_pkt() function: RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_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); /* Put new packet into the output queue */ diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index 15ca6db20..d3cdc629f 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -467,7 +467,7 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); l2fwd_send_packet(m, (uint8_t) dst_port); } diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index 33f7ee7ee..59f5c8bdf 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -383,7 +383,7 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); l2fwd_send_packet(m, (uint8_t) dst_port); } diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index 50baf3467..a3ba229bd 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -324,7 +324,7 @@ The processing is very simple: processes the TX port from the RX port and then r *((uint64_t *)tmp) = 0x000000000002 + (dst_port << 40); /* src addr */ - ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); lsi_send_packet(m, dst_port); } diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 5be9e528c..585d24472 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -1229,7 +1229,7 @@ static int atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index __rte_unused, uint32_t pool __rte_unused) { - if (is_zero_ether_addr(mac_addr)) { + if (rte_is_zero_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); return -EINVAL; } diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c index 401bd11cf..4075f2895 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c @@ -654,7 +654,7 @@ static int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self, mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct rte_ether_addr *)mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mac_addr, (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { @@ -865,7 +865,7 @@ static int aq_fw1x_set_wol(struct aq_hw_s *self, bool wol_enabled, u8 *mac) prpc->msg_wol.pattern_id = 1U; prpc->msg_wol.wol_packet_type = 2U; /* Magic Packet */ - ether_addr_copy((struct rte_ether_addr *)mac, + rte_ether_addr_copy((struct rte_ether_addr *)mac, (struct rte_ether_addr *)&prpc->msg_wol.wol_pattern); } else { rpc_size = sizeof(prpc->msg_id) + sizeof(prpc->msg_del_id); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c index 1fc18bb27..c336b8583 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -218,7 +218,7 @@ int aq_fw2x_get_mac_permanent(struct aq_hw_s *self, u8 *mac) mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct rte_ether_addr *)mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mac_addr, (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c index 523911e17..af3944480 100644 --- a/drivers/net/avf/avf_ethdev.c +++ b/drivers/net/avf/avf_ethdev.c @@ -696,7 +696,7 @@ avf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, struct avf_info *vf = AVF_DEV_PRIVATE_TO_VF(adapter); int err; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); return -EINVAL; } @@ -941,11 +941,11 @@ avf_dev_set_default_mac_addr(struct rte_eth_dev *dev, old_addr = (struct rte_ether_addr *)hw->mac.addr; perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; - if (is_same_ether_addr(mac_addr, old_addr)) + if (rte_is_same_ether_addr(mac_addr, old_addr)) return 0; /* If the MAC address is configured by host, skip the setting */ - if (is_valid_assigned_ether_addr(perm_addr)) + if (rte_is_valid_assigned_ether_addr(perm_addr)) return -EPERM; ret = avf_add_del_eth_addr(adapter, old_addr, FALSE); @@ -973,7 +973,7 @@ avf_dev_set_default_mac_addr(struct rte_eth_dev *dev, if (ret) return -EIO; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } @@ -1244,9 +1244,9 @@ avf_dev_init(struct rte_eth_dev *eth_dev) /* If the MAC address is not configured by host, * generate a random one. */ - if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) - eth_random_addr(hw->mac.addr); - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + if (!rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) + rte_eth_random_addr(hw->mac.addr); + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* register callback func to eal lib */ diff --git a/drivers/net/avf/avf_vchnl.c b/drivers/net/avf/avf_vchnl.c index 6ccd7a1c9..32aa62e5e 100644 --- a/drivers/net/avf/avf_vchnl.c +++ b/drivers/net/avf/avf_vchnl.c @@ -647,7 +647,7 @@ avf_add_del_all_mac_addr(struct avf_adapter *adapter, bool add) len = sizeof(struct virtchnl_ether_addr_list); for (i = begin; i < AVF_NUM_MACADDR_MAX; i++, next_begin++) { addr = &adapter->eth_dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; len += sizeof(struct virtchnl_ether_addr); if (len >= AVF_AQ_BUF_SZ) { @@ -664,7 +664,7 @@ avf_add_del_all_mac_addr(struct avf_adapter *adapter, bool add) for (i = begin; i < next_begin; i++) { addr = &adapter->eth_dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 834b1f3e1..4f563d14b 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -1014,7 +1014,7 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev) } /* Get a mac from device config */ - ether_addr_copy(&avp->ethaddr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&avp->ethaddr, ð_dev->data->mac_addrs[0]); return 0; } @@ -1221,12 +1221,12 @@ _avp_mac_filter(struct avp_dev *avp, struct rte_mbuf *m) return 0; } - if (likely(is_broadcast_ether_addr(ð->d_addr))) { + if (likely(rte_is_broadcast_ether_addr(ð->d_addr))) { /* allow all broadcast packets */ return 0; } - if (likely(is_multicast_ether_addr(ð->d_addr))) { + if (likely(rte_is_multicast_ether_addr(ð->d_addr))) { /* allow all multicast packets */ return 0; } diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index 4b84b50c0..c8ce67771 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -634,11 +634,11 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } - if (!is_valid_assigned_ether_addr(&pdata->mac_addr)) - eth_random_addr(pdata->mac_addr.addr_bytes); + if (!rte_is_valid_assigned_ether_addr(&pdata->mac_addr)) + rte_eth_random_addr(pdata->mac_addr.addr_bytes); /* Copy the permanent MAC address */ - ether_addr_copy(&pdata->mac_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&pdata->mac_addr, ð_dev->data->mac_addrs[0]); /* Clock settings */ pdata->sysclk_rate = AXGBE_V2_DMA_CLOCK_FREQ; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index f3e235534..3088e27e6 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2185,8 +2185,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_parse_bd = &txq->tx_ring[TX_BD(bd_prod, txq)].parse_bd_e2; - if (is_multicast_ether_addr(&eh->d_addr)) { - if (is_broadcast_ether_addr(&eh->d_addr)) + if (rte_is_multicast_ether_addr(&eh->d_addr)) { + if (rte_is_broadcast_ether_addr(&eh->d_addr)) mac_type = BROADCAST_ADDRESS; else mac_type = MULTICAST_ADDRESS; diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index a044e6eac..67e3b54b1 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -300,11 +300,11 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ sc->igu_sb_cnt, sc->igu_base_sb); strncpy(sc->fw_ver, sc_resp.fw_ver, sizeof(sc->fw_ver)); - if (is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) - ether_addr_copy(&sc_resp.resc.current_mac_addr, + if (rte_is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) + rte_ether_addr_copy(&sc_resp.resc.current_mac_addr, (struct rte_ether_addr *)sc->link_params.mac_addr); else - eth_random_addr(sc->link_params.mac_addr); + rte_eth_random_addr(sc->link_params.mac_addr); out: bnx2x_vf_finalize(sc, &acq->first_tlv); diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 1afe67407..a1f527d4f 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -187,10 +187,10 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, * Destination MAC address mask must not be partially * set. Should be all 1's or all 0's. */ - if ((!is_zero_ether_addr(ð_mask->src) && - !is_broadcast_ether_addr(ð_mask->src)) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if ((!rte_is_zero_ether_addr(ð_mask->src) && + !rte_is_broadcast_ether_addr(ð_mask->src)) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -209,7 +209,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, return -rte_errno; } - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { rte_memcpy(filter->dst_macaddr, ð_spec->dst, 6); en |= use_ntuple ? @@ -217,7 +217,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, EM_FLOW_ALLOC_INPUT_EN_DST_MACADDR; } - if (is_broadcast_ether_addr(ð_mask->src)) { + if (rte_is_broadcast_ether_addr(ð_mask->src)) { rte_memcpy(filter->src_macaddr, ð_spec->src, 6); en |= use_ntuple ? diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index b6f76128f..7903ac74e 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2586,7 +2586,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, if (memcmp(mac.addr_bytes, "\x00\x00\x00\x00\x00", 6) == 0) { cfg_req->enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_MAC_ADDR); - eth_random_addr(cfg_req->dflt_mac_addr); + 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); diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 608d754a4..f9ab6959b 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -322,7 +322,7 @@ rx_machine(struct bond_dev_private *internals, uint16_t slave_id, agg = &mode_8023ad_ports[port->aggregator_port_id]; bool match = port->actor.system_priority == lacp->partner.port_params.system_priority && - is_same_ether_addr(&agg->actor.system, + rte_is_same_ether_addr(&agg->actor.system, &lacp->partner.port_params.system) && port->actor.port_priority == lacp->partner.port_params.port_priority && @@ -575,7 +575,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) hdr = rte_pktmbuf_mtod(lacp_pkt, struct lacpdu_header *); /* Source and destination MAC */ - ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.d_addr); + 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); @@ -592,7 +592,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) memcpy(&hdr->lacpdu.actor.port_params, &port->actor, sizeof(port->actor)); agg = &mode_8023ad_ports[port->aggregator_port_id]; - ether_addr_copy(&agg->actor.system, &hdr->lacpdu.actor.port_params.system); + rte_ether_addr_copy(&agg->actor.system, &hdr->lacpdu.actor.port_params.system); lacpdu->actor.state = port->actor_state; /* PARTNER */ @@ -694,9 +694,9 @@ selection_logic(struct bond_dev_private *internals, uint8_t slave_id) * ID (MAC address). */ if ((agg->actor.key == port->actor.key && agg->partner.system_priority == port->partner.system_priority && - is_same_ether_addr(&agg->partner.system, &port->partner.system) == 1 + rte_is_same_ether_addr(&agg->partner.system, &port->partner.system) == 1 && (agg->partner.key == port->partner.key)) && - is_zero_ether_addr(&port->partner.system) != 1 && + rte_is_zero_ether_addr(&port->partner.system) != 1 && (agg->actor.key & rte_cpu_to_be_16(BOND_LINK_FULL_DUPLEX_KEY)) != 0) { @@ -835,8 +835,8 @@ bond_mode_8023ad_periodic_cb(void *arg) SM_FLAG_SET(port, NTT); } - if (!is_same_ether_addr(&port->actor.system, &slave_addr)) { - ether_addr_copy(&slave_addr, &port->actor.system); + if (!rte_is_same_ether_addr(&port->actor.system, &slave_addr)) { + rte_ether_addr_copy(&slave_addr, &port->actor.system); if (port->aggregator_port_id == slave_id) SM_FLAG_SET(port, NTT); } @@ -1048,10 +1048,10 @@ bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) slave = &mode_8023ad_ports[slave_id]; rte_eth_macaddr_get(slave_id, &slave_addr); - if (is_same_ether_addr(&slave_addr, &slave->actor.system)) + if (rte_is_same_ether_addr(&slave_addr, &slave->actor.system)) continue; - ether_addr_copy(&slave_addr, &slave->actor.system); + rte_ether_addr_copy(&slave_addr, &slave->actor.system); /* Do nothing if this port is not an aggregator. In other case * Set NTT flag on every port that use this aggregator. */ if (slave->aggregator_port_id != slave_id) diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 24b2b505a..446677fae 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -101,17 +101,17 @@ void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, if (client_info->in_use == 0 || client_info->app_ip != arp->arp_data.arp_tip || client_info->cli_ip != arp->arp_data.arp_sip || - !is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || + !rte_is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || client_info->vlan_count != offset / sizeof(struct rte_vlan_hdr) || memcmp(client_info->vlan, eth_h + 1, offset) != 0 ) { client_info->in_use = 1; client_info->app_ip = arp->arp_data.arp_tip; client_info->cli_ip = arp->arp_data.arp_sip; - ether_addr_copy(&arp->arp_data.arp_sha, &client_info->cli_mac); + rte_ether_addr_copy(&arp->arp_data.arp_sha, &client_info->cli_mac); client_info->slave_idx = calculate_slave(internals); rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); } @@ -139,7 +139,7 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, * current primary port. */ rte_eth_macaddr_get(internals->port_id, &bonding_mac); - if (!is_same_ether_addr(&bonding_mac, &arp->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(&bonding_mac, &arp->arp_data.arp_sha)) { rte_eth_macaddr_get(internals->current_primary_port, &arp->arp_data.arp_sha); return internals->current_primary_port; @@ -155,13 +155,13 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { /* Entry is already assigned to this client */ - if (!is_broadcast_ether_addr(&arp->arp_data.arp_tha)) { - ether_addr_copy(&arp->arp_data.arp_tha, + if (!rte_is_broadcast_ether_addr(&arp->arp_data.arp_tha)) { + rte_ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); } rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); @@ -173,11 +173,11 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, client_info->in_use = 1; client_info->ntt = 0; client_info->app_ip = arp->arp_data.arp_sip; - ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); + rte_ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); client_info->cli_ip = arp->arp_data.arp_tip; client_info->slave_idx = calculate_slave(internals); rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); @@ -202,8 +202,8 @@ bond_mode_alb_arp_upd(struct client_data *client_info, rte_spinlock_lock(&internals->mode6.lock); eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ether_addr_copy(&client_info->app_mac, ð_h->s_addr); - ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); + 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); else @@ -215,9 +215,9 @@ bond_mode_alb_arp_upd(struct client_data *client_info, memcpy(eth_h + 1, client_info->vlan, client_info->vlan_count * sizeof(struct rte_vlan_hdr)); - ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); arp_h->arp_data.arp_sip = client_info->app_ip; - ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); + rte_ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; arp_h->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 2eda2f79f..77317362d 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -450,8 +450,8 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, * mode and packet address does not match. */ if (unlikely(is_lacp_packets(hdr->ether_type, subtype, bufs[j]) || !collecting || (!promisc && - !is_multicast_ether_addr(&hdr->d_addr) && - !is_same_ether_addr(&bond_mac, &hdr->d_addr)))) { + !rte_is_multicast_ether_addr(&hdr->d_addr) && + !rte_is_same_ether_addr(&bond_mac, &hdr->d_addr)))) { if (hdr->ether_type == ether_type_slow_be) { bond_mode_8023ad_handle_slow_pkt( @@ -1012,7 +1012,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) sizeof(internals->tlb_slaves_order[0]) * num_of_slaves); - ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); + rte_ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); if (nb_pkts > 3) { for (i = 0; i < 3; i++) @@ -1026,8 +1026,8 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) rte_prefetch0(rte_pktmbuf_mtod(bufs[j+3], void*)); ether_hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); - if (is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) - ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); + if (rte_is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) + rte_ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) mode6_debug("TX IPv4:", ether_hdr, slaves[i], &burstnumberTX); #endif @@ -1507,7 +1507,7 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr mac_addr = eth_dev->data->mac_addrs; - ether_addr_copy(mac_addr, dst_mac_addr); + rte_ether_addr_copy(mac_addr, dst_mac_addr); return 0; } @@ -1549,7 +1549,7 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; - if (is_same_ether_addr(mac_addr, &null_mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; ret = rte_eth_dev_mac_addr_add(slave_port_id, mac_addr, 0); @@ -1578,7 +1578,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, rc = 0; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; - if (is_same_ether_addr(mac_addr, &null_mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; ret = rte_eth_dev_mac_addr_remove(slave_port_id, mac_addr); diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index fc0af49cf..7c43e12d1 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -671,7 +671,7 @@ static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx, { struct port_info *pi = adap2pinfo(adapter, port_idx); - ether_addr_copy((struct rte_ether_addr *)hw_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0]); } diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index ccd165b56..13de577c6 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -117,12 +117,12 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item, mask = umask ? umask : (const struct rte_flow_item_eth *)dmask; /* we don't support SRC_MAC filtering*/ - if (!is_zero_ether_addr(&mask->src)) + if (!rte_is_zero_ether_addr(&mask->src)) return rte_flow_error_set(e, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "src mac filtering not supported"); - if (!is_zero_ether_addr(&mask->dst)) { + if (!rte_is_zero_ether_addr(&mask->dst)) { const u8 *addr = (const u8 *)&spec->dst.addr_bytes[0]; const u8 *m = (const u8 *)&mask->dst.addr_bytes[0]; struct rte_flow *flow = (struct rte_flow *)fs->private; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 9aaabf493..704bbf060 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1360,7 +1360,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) } /* copy the primary mac address */ - ether_addr_copy(&fman_intf->mac_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&fman_intf->mac_addr, ð_dev->data->mac_addrs[0]); RTE_LOG(INFO, PMD, "net: dpaa: %s: %02x:%02x:%02x:%02x:%02x:%02x\n", dpaa_device->name, diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index dcfc1a964..244099afc 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1872,9 +1872,9 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, * If empty_mac(phy), return prime. * if both are empty, create random MAC, set as prime and return */ - if (!is_zero_ether_addr(&phy_mac)) { + if (!rte_is_zero_ether_addr(&phy_mac)) { /* If the addresses are not same, overwrite prime */ - if (!is_same_ether_addr(&phy_mac, &prime_mac)) { + if (!rte_is_same_ether_addr(&phy_mac, &prime_mac)) { ret = dpni_set_primary_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, phy_mac.addr_bytes); @@ -1885,9 +1885,9 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, } memcpy(&prime_mac, &phy_mac, sizeof(struct rte_ether_addr)); } - } else if (is_zero_ether_addr(&prime_mac)) { + } else if (rte_is_zero_ether_addr(&prime_mac)) { /* In case phys and prime, both are zero, create random MAC */ - eth_random_addr(prime_mac.addr_bytes); + rte_eth_random_addr(prime_mac.addr_bytes); ret = dpni_set_primary_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, prime_mac.addr_bytes); diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index b4bb13572..4d8615325 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -293,7 +293,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, eth_dev->data->mac_addrs); /* initialize the vfta */ diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 210e5c3bd..762184665 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -819,7 +819,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* initialize the vfta */ memset(shadow_vfta, 0, sizeof(*shadow_vfta)); @@ -1019,8 +1019,8 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) } /* Generate a random MAC address, if none was assigned by PF. */ - if (is_zero_ether_addr(perm_addr)) { - eth_random_addr(perm_addr->addr_bytes); + if (rte_is_zero_ether_addr(perm_addr)) { + rte_eth_random_addr(perm_addr->addr_bytes); PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF"); PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address " "%02x:%02x:%02x:%02x:%02x:%02x", @@ -1039,7 +1039,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) return diag; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x " diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c index 33683498a..8dcfc71c5 100644 --- a/drivers/net/e1000/igb_flow.c +++ b/drivers/net/e1000/igb_flow.c @@ -548,9 +548,9 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid ether address mask"); @@ -567,7 +567,7 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index 9f1521350..ab48a269f 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -43,7 +43,7 @@ int igb_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) uint16_t vfn; for (vfn = 0; vfn < vf_num; vfn++) { - eth_random_addr(vf_mac_addr); + 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); @@ -306,8 +306,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); int rah; - if (is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { - if (!is_zero_ether_addr((struct rte_ether_addr *)new_mac)) + if (rte_is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { + if (!rte_is_zero_ether_addr((struct rte_ether_addr *)new_mac)) rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 165ff52e5..7bf8dd44c 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1656,7 +1656,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) /* Copy MAC address and point DPDK to it */ eth_dev->data->mac_addrs = (struct rte_ether_addr *)adapter->mac_addr; - ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, (struct rte_ether_addr *)adapter->mac_addr); adapter->drv_stats = rte_zmalloc("adapter stats", diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 1541368bc..8b2b47365 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -98,7 +98,7 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x", diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index e362219a5..f3eec251e 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1675,7 +1675,7 @@ static int enic_dev_init(struct enic *enic) dev_err(enic, "mac addr storage alloc failed, aborting.\n"); return -1; } - ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, eth_dev->data->mac_addrs); vnic_dev_set_reset_flag(enic->vdev, 0); diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 495f536c7..d1fcb5f21 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -245,7 +245,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) */ FOREACH_SUBDEV(sdev, i, dev) if (sdev->state >= DEV_PROBED) { - ether_addr_copy(Ð(sdev)->data->mac_addrs[0], + rte_ether_addr_copy(Ð(sdev)->data->mac_addrs[0], mac); break; } @@ -257,7 +257,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) * probed slaves. */ if (i == priv->subs_tail) - eth_random_addr(&mac->addr_bytes[0]); + rte_eth_random_addr(&mac->addr_bytes[0]); } INFO("MAC address is %02x:%02x:%02x:%02x:%02x:%02x", mac->addr_bytes[0], mac->addr_bytes[1], diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index a7f2b0e17..ff39ece18 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -174,7 +174,7 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, if (ret) { char ea_fmt[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); ERROR("Adding MAC address %s failed", ea_fmt); return ret; } diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index eb3e13061..e1bff3952 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -619,7 +619,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); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); macvlan->nb_queue_pools = nb_queue_pools; @@ -1530,7 +1530,7 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) for (mac_index = 0; (mac_index < FM10K_MAX_MACADDR_NUM) && (result == FM10K_SUCCESS); mac_index++) { - if (is_zero_ether_addr(&data->mac_addrs[mac_index])) + if (rte_is_zero_ether_addr(&data->mac_addrs[mac_index])) continue; if (mac_num > macvlan->mac_num - 1) { PMD_INIT_LOG(ERR, "MAC address number " @@ -3084,16 +3084,16 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_read_mac_addr(hw); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); if (diag != FM10K_SUCCESS || - !is_valid_assigned_ether_addr(dev->data->mac_addrs)) { + !rte_is_valid_assigned_ether_addr(dev->data->mac_addrs)) { /* Generate a random addr */ - eth_random_addr(hw->mac.addr); + rte_eth_random_addr(hw->mac.addr); memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index fa2e39aa2..895b3d6fb 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1457,7 +1457,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) goto err_get_mac_addr; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, (struct rte_ether_addr *) hw->mac.perm_addr); /* Disable flow control */ @@ -1512,7 +1512,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) "Failed to allocated memory for storing mac address"); goto err_mac_alloc; } - ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, &dev->data->mac_addrs[0]); /* Init dcb to sw mode by default */ @@ -4055,7 +4055,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, new_mac = &filter->mac_addr; - if (is_zero_ether_addr(new_mac)) { + if (rte_is_zero_ether_addr(new_mac)) { PMD_DRV_LOG(ERR, "Invalid ethernet address."); return -EINVAL; } @@ -4068,7 +4068,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } vf = &pf->vfs[vf_id]; - if (add && is_same_ether_addr(new_mac, &(pf->dev_addr))) { + if (add && rte_is_same_ether_addr(new_mac, &(pf->dev_addr))) { PMD_DRV_LOG(INFO, "Ignore adding permanent MAC address."); return -EINVAL; } @@ -4086,7 +4086,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, PMD_DRV_LOG(ERR, "Failed to add MAC filter."); return -1; } - ether_addr_copy(new_mac, &pf->dev_addr); + rte_ether_addr_copy(new_mac, &pf->dev_addr); } else { rte_memcpy(hw->mac.addr, hw->mac.perm_addr, ETHER_ADDR_LEN); @@ -4097,7 +4097,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } /* Clear device address as it has been removed */ - if (is_same_ether_addr(&(pf->dev_addr), new_mac)) + if (rte_is_same_ether_addr(&(pf->dev_addr), new_mac)) memset(&pf->dev_addr, 0, sizeof(struct rte_ether_addr)); } @@ -6841,7 +6841,7 @@ i40e_find_mac_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f; TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) return f; } @@ -7508,9 +7508,9 @@ i40e_tunnel_filter_convert( struct i40e_aqc_cloud_filters_element_bb *cld_filter, struct i40e_tunnel_filter *tunnel_filter) { - ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, (struct rte_ether_addr *)&tunnel_filter->input.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, (struct rte_ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->element.inner_vlan; if ((rte_le_to_cpu_16(cld_filter->element.flags) & @@ -7619,9 +7619,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - ether_addr_copy(&tunnel_filter->outer_mac, + rte_ether_addr_copy(&tunnel_filter->outer_mac, (struct rte_ether_addr *)&pfilter->element.outer_mac); - ether_addr_copy(&tunnel_filter->inner_mac, + rte_ether_addr_copy(&tunnel_filter->inner_mac, (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = @@ -8063,9 +8063,9 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - ether_addr_copy(&tunnel_filter->outer_mac, + rte_ether_addr_copy(&tunnel_filter->outer_mac, (struct rte_ether_addr *)&pfilter->element.outer_mac); - ether_addr_copy(&tunnel_filter->inner_mac, + rte_ether_addr_copy(&tunnel_filter->inner_mac, (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = @@ -8538,13 +8538,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(&filter->outer_mac))) { + (rte_is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(&filter->inner_mac))) { + (rte_is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } @@ -11844,13 +11844,13 @@ static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, struct i40e_mac_filter *f; int ret; - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) break; } @@ -11968,9 +11968,9 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) vsi = vf->vsi; } memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, (struct rte_ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = f->input.inner_vlan; cld_filter.element.flags = f->input.flags; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 601ffdc7c..22d18c740 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -765,7 +765,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev, int err; struct vf_cmd_info args; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x", addr->addr_bytes[0], addr->addr_bytes[1], addr->addr_bytes[2], addr->addr_bytes[3], @@ -1223,10 +1223,10 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) + if (rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; else - eth_random_addr(hw->mac.addr); /* Generate a random one */ + rte_eth_random_addr(hw->mac.addr); /* Generate a random one */ I40E_WRITE_REG(hw, I40E_VFINT_DYN_CTL01, (I40E_ITR_INDEX_DEFAULT << @@ -1460,7 +1460,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); return 0; @@ -1872,7 +1872,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) j = 0; len = sizeof(struct virtchnl_ether_addr_list); for (i = begin; i < I40E_NUM_MACADDR_MAX; i++, next_begin++) { - if (is_zero_ether_addr(&dev->data->mac_addrs[i])) + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[i])) continue; len += sizeof(struct virtchnl_ether_addr); if (len >= I40E_AQ_BUF_SZ) { @@ -1889,7 +1889,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) for (i = begin; i < next_begin; i++) { addr = &dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); @@ -2639,7 +2639,7 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } @@ -2652,7 +2652,7 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0) return -EIO; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 210552e36..f5813e99a 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2007,9 +2007,9 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2028,7 +2028,7 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { @@ -2485,8 +2485,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, eth_mask = item->mask; if (eth_spec && eth_mask) { - if (!is_zero_ether_addr(ð_mask->src) || - !is_zero_ether_addr(ð_mask->dst)) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + !rte_is_zero_ether_addr(ð_mask->dst)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -3326,8 +3326,8 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, /* DST address of inner MAC shouldn't be masked. * SRC address of Inner MAC should be masked. */ - if (!is_broadcast_ether_addr(ð_mask->dst) || - !is_zero_ether_addr(ð_mask->src) || + if (!rte_is_broadcast_ether_addr(ð_mask->dst) || + !rte_is_zero_ether_addr(ð_mask->src) || eth_mask->type) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -3556,8 +3556,8 @@ i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, /* DST address of inner MAC shouldn't be masked. * SRC address of Inner MAC should be masked. */ - if (!is_broadcast_ether_addr(ð_mask->dst) || - !is_zero_ether_addr(ð_mask->src) || + if (!rte_is_broadcast_ether_addr(ð_mask->dst) || + !rte_is_zero_ether_addr(ð_mask->src) || eth_mask->type) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -4803,9 +4803,9 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, int ret = 0; memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, (struct rte_ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = filter->input.inner_vlan; cld_filter.element.flags = filter->input.flags; diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 5b77fa7fd..de619dd0d 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -348,7 +348,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, vf_res->vsi_res[0].vsi_type = VIRTCHNL_VSI_SRIOV; vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; - ether_addr_copy(&vf->mac_addr, + rte_ether_addr_copy(&vf->mac_addr, (struct rte_ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: @@ -845,7 +845,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, mac = (struct rte_ether_addr *)(addr_list->list[i].addr); rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - if (is_zero_ether_addr(mac) || + if (rte_is_zero_ether_addr(mac) || i40e_vsi_add_mac(vf->vsi, &filter)) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; @@ -887,7 +887,7 @@ i40e_pf_host_process_cmd_del_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); - if(is_zero_ether_addr(mac) || + if(rte_is_zero_ether_addr(mac) || i40e_vsi_delete_mac(vf->vsi, mac)) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index e7b333655..6981d335d 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -559,7 +559,7 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, return -EINVAL; } - ether_addr_copy(mac_addr, &vf->mac_addr); + rte_ether_addr_copy(mac_addr, &vf->mac_addr); /* Remove all existing mac */ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) @@ -603,9 +603,9 @@ rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, return -EINVAL; } - if (is_same_ether_addr(mac_addr, &vf->mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &vf->mac_addr)) /* Reset the mac with NULL address */ - ether_addr_copy(&null_mac_addr, &vf->mac_addr); + rte_ether_addr_copy(&null_mac_addr, &vf->mac_addr); /* Remove the mac */ i40e_vsi_delete_mac(vsi, mac_addr); @@ -2386,7 +2386,7 @@ rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, } mac_filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - ether_addr_copy(mac_addr, &mac_filter.mac_addr); + rte_ether_addr_copy(mac_addr, &mac_filter.mac_addr); ret = i40e_vsi_add_mac(vsi, &mac_filter); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to add MAC filter."); @@ -2513,7 +2513,7 @@ rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct rte_ether_addr *vf_ma vf = &pf->vfs[vf_id]; mac = &vf->mac_addr; - if (is_same_ether_addr(mac, vf_mac)) + if (rte_is_same_ether_addr(mac, vf_mac)) return vf_id; } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index e7e1bae26..bd10b4012 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1215,7 +1215,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ @@ -1651,7 +1651,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } /* Generate a random MAC address, if none was assigned by PF. */ - if (is_zero_ether_addr(perm_addr)) { + if (rte_is_zero_ether_addr(perm_addr)) { generate_random_mac_addr(perm_addr); diag = ixgbe_set_rar_vf(hw, 1, perm_addr->addr_bytes, 0, 1); if (diag) { @@ -1671,7 +1671,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]); /* reset the hardware with the new settings */ diag = hw->mac.ops.start_hw(hw); @@ -6037,7 +6037,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) if (i == index) continue; /* Skip NULL MAC addresses */ - if (is_zero_ether_addr(mac_addr)) + if (rte_is_zero_ether_addr(mac_addr)) continue; /* Skip the permanent MAC address */ if (memcmp(perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 1adf1b803..ff9e6f49b 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -715,9 +715,9 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid ether address mask"); @@ -734,7 +734,7 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 0840e14f3..e8089a04d 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -46,7 +46,7 @@ int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) uint16_t vfn; for (vfn = 0; vfn < vf_num; vfn++) { - eth_random_addr(vf_mac_addr); + 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); @@ -480,7 +480,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { + if (rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 3defba175..45fc3a4ad 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -35,7 +35,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); rar_entry = hw->mac.num_rar_entries - (vf + 1); - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { + 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); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index a78059c60..06651980e 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -358,7 +358,7 @@ eth_kni_create(struct rte_vdev_device *vdev, data->dev_link = pmd_link; data->mac_addrs = &internals->eth_addr; - eth_random_addr(internals->eth_addr.addr_bytes); + rte_eth_random_addr(internals->eth_addr.addr_bytes); eth_dev->dev_ops = ð_kni_ops; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index ddf6bf6e6..a2ff73c9b 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1834,7 +1834,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) 2 + i)); /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); /* enable firmware checksum support for tunnel packets */ lio_enable_hw_tunnel_rx_checksum(eth_dev); diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 087725d7b..5287b9067 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -1393,7 +1393,7 @@ mlx4_flow_internal(struct priv *priv, struct rte_flow_error *error) mac = &priv->mac[i]; else mac = ð_mask.dst; - if (is_zero_ether_addr(mac)) + if (rte_is_zero_ether_addr(mac)) continue; /* Check if MAC flow rule is already present. */ for (flow = LIST_FIRST(&priv->flows); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 9b2b127fd..024ae5ea1 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -1727,7 +1727,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, spec.eth->type); eth_type_set = 1; } - if (!is_zero_ether_addr(&mask.eth->dst)) { + if (!rte_is_zero_ether_addr(&mask.eth->dst)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, spec.eth->dst.addr_bytes); @@ -1735,7 +1735,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, ETHER_ADDR_LEN, mask.eth->dst.addr_bytes); } - if (!is_zero_ether_addr(&mask.eth->src)) { + if (!rte_is_zero_ether_addr(&mask.eth->src)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, spec.eth->src.addr_bytes); diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index cee52a503..fdfd46f36 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -71,7 +71,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) const int vf = priv->config.vf; assert(index < MLX5_MAX_MAC_ADDRESSES); - if (is_zero_ether_addr(&dev->data->mac_addrs[index])) + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[index])) return; if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], @@ -101,7 +101,7 @@ mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, unsigned int i; assert(index < MLX5_MAX_MAC_ADDRESSES); - if (is_zero_ether_addr(mac)) { + if (rte_is_zero_ether_addr(mac)) { rte_errno = EINVAL; return -rte_errno; } diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index a82c0cc86..0fc453085 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -333,7 +333,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) #ifndef NDEBUG char m[18]; - ether_format_addr(m, 18, RTA_DATA(attribute)); + rte_ether_format_addr(m, 18, RTA_DATA(attribute)); DRV_LOG(DEBUG, "bridge MAC address %s", m); #endif memcpy(&(*data->mac)[data->mac_n++], @@ -548,14 +548,14 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) /* Verify the address is not in the array yet. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) - if (is_same_ether_addr(&macs[i], + if (rte_is_same_ether_addr(&macs[i], &dev->data->mac_addrs[j])) break; if (j != MLX5_MAX_MAC_ADDRESSES) continue; /* Find the first entry available. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) { - if (is_zero_ether_addr(&dev->data->mac_addrs[j])) { + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) { dev->data->mac_addrs[j] = macs[i]; break; } diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 8fd344165..9d719f176 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -594,7 +594,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = neta_ppio_remove_mac_addr(priv->ppio, dev->data->mac_addrs[index].addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), + rte_ether_format_addr(buf, sizeof(buf), &dev->data->mac_addrs[index]); MVNETA_LOG(ERR, "Failed to remove mac %s", buf); } @@ -632,7 +632,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, ret = neta_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to add mac %s", buf); return -1; } @@ -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]; - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to set mac to %s", buf); } return 0; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index bffad9ca1..b06af7761 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1079,7 +1079,7 @@ mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = pp2_ppio_remove_mac_addr(priv->ppio, dev->data->mac_addrs[index].addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), + rte_ether_format_addr(buf, sizeof(buf), &dev->data->mac_addrs[index]); MRVL_LOG(ERR, "Failed to remove mac %s", buf); } @@ -1133,7 +1133,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, */ ret = pp2_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to add mac %s", buf); return -1; } @@ -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]; - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to set mac to %s", buf); } diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index a5cc95231..38fa1dae3 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -128,8 +128,8 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) } ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) stats->broadcast++; else stats->multicast++; diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index 96f9e5484..4dad021cd 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -36,7 +36,7 @@ static int hn_vf_match(const struct rte_eth_dev *dev) char buf[32]; int i; - ether_format_addr(buf, sizeof(buf), mac); + rte_ether_format_addr(buf, sizeof(buf), mac); RTE_ETH_FOREACH_DEV(i) { const struct rte_eth_dev *vf_dev = &rte_eth_devices[i]; const struct rte_ether_addr *vf_mac = vf_dev->data->mac_addrs; @@ -44,8 +44,8 @@ static int hn_vf_match(const struct rte_eth_dev *dev) if (vf_dev == dev) continue; - ether_format_addr(buf, sizeof(buf), vf_mac); - if (is_same_ether_addr(mac, vf_mac)) + rte_ether_format_addr(buf, sizeof(buf), vf_mac); + if (rte_is_same_ether_addr(mac, vf_mac)) return i; } return -ENOENT; diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 56628b5b6..bfc5e08f1 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2888,16 +2888,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_vf_read_mac(hw); } - if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { + if (!rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { PMD_INIT_LOG(INFO, "Using random mac address for port %d", port); /* Using random mac addresses for VFs */ - eth_random_addr(&hw->mac_addr[0]); + rte_eth_random_addr(&hw->mac_addr[0]); nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr); } /* Copying mac address to DPDK eth_dev struct */ - ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index b7975933c..da95abe49 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -535,7 +535,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, internals->packet_size = packet_size; internals->packet_copy = packet_copy; internals->port_id = eth_dev->data->port_id; - eth_random_addr(internals->eth_addr.addr_bytes); + rte_eth_random_addr(internals->eth_addr.addr_bytes); internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK; internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_RETA_GROUP_SIZE; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 57b02cea5..89760e921 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -579,7 +579,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, DP_ERR(edev, "Did not allocate memory for ucast\n"); return -ENOMEM; } - ether_addr_copy(mac_addr, &u->mac); + rte_ether_addr_copy(mac_addr, &u->mac); u->vlan = ucast->vlan; u->vni = ucast->vni; SLIST_INSERT_HEAD(&qdev->uc_list_head, u, list); @@ -621,14 +621,14 @@ qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_ad DP_ERR(edev, "Did not allocate memory for mcast\n"); return -ENOMEM; } - ether_addr_copy(&mc_addrs[i], &m->mac); + rte_ether_addr_copy(&mc_addrs[i], &m->mac); SLIST_INSERT_HEAD(&qdev->mc_list_head, m, list); } memset(&mcast, 0, sizeof(mcast)); mcast.num_mc_addrs = mc_addrs_num; mcast.opcode = ECORE_FILTER_ADD; for (i = 0; i < mc_addrs_num; i++) - ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) + rte_ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) &mcast.mac[i]); rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { @@ -653,7 +653,7 @@ static int qede_del_mcast_filters(struct rte_eth_dev *eth_dev) mcast.opcode = ECORE_FILTER_REMOVE; j = 0; SLIST_FOREACH(tmp, &qdev->mc_list_head, list) { - ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); + rte_ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); j++; } rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); @@ -706,13 +706,13 @@ qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, struct ecore_filter_ucast ucast; int re; - if (!is_valid_assigned_ether_addr(mac_addr)) + if (!rte_is_valid_assigned_ether_addr(mac_addr)) return -EINVAL; qede_set_ucast_cmn_params(&ucast); ucast.opcode = ECORE_FILTER_ADD; ucast.type = ECORE_FILTER_MAC; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); re = (int)qede_mac_int_ops(eth_dev, &ucast, 1); return re; } @@ -732,7 +732,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) return; } - if (!is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) + if (!rte_is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) return; qede_set_ucast_cmn_params(&ucast); @@ -740,7 +740,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) ucast.type = ECORE_FILTER_MAC; /* Use the index maintained by rte */ - ether_addr_copy(ð_dev->data->mac_addrs[index], + rte_ether_addr_copy(ð_dev->data->mac_addrs[index], (struct rte_ether_addr *)&ucast.mac); qede_mac_int_ops(eth_dev, &ucast, false); @@ -1773,7 +1773,7 @@ qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_add } for (i = 0; i < mc_addrs_num; i++) { - if (!is_multicast_ether_addr(&mc_addrs[i])) { + if (!rte_is_multicast_ether_addr(&mc_addrs[i])) { DP_ERR(edev, "Not a valid multicast MAC\n"); return -EINVAL; } @@ -2551,10 +2551,10 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) } if (!is_vf) { - ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. + rte_ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. hw_info.hw_mac_addr, ð_dev->data->mac_addrs[0]); - ether_addr_copy(ð_dev->data->mac_addrs[0], + rte_ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); } else { ecore_vf_read_bulletin(ECORE_LEADING_HWFN(edev), @@ -2567,9 +2567,9 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) &is_mac_forced); if (is_mac_exist) { DP_INFO(edev, "VF macaddr received from PF\n"); - ether_addr_copy((struct rte_ether_addr *)&vf_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&vf_mac, ð_dev->data->mac_addrs[0]); - ether_addr_copy(ð_dev->data->mac_addrs[0], + rte_ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); } else { DP_ERR(edev, "No VF macaddr assigned\n"); diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 761958d56..fd7966eb9 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -915,7 +915,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) * Copy the address to the device private data so that * it could be recalled in the case of adapter restart. */ - ether_addr_copy(mac_addr, &port->default_mac_addr); + rte_ether_addr_copy(mac_addr, &port->default_mac_addr); /* * Neither of the two following checks can return @@ -975,7 +975,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) unlock: if (rc != 0) - ether_addr_copy(old_addr, &port->default_mac_addr); + rte_ether_addr_copy(old_addr, &port->default_mac_addr); sfc_adapter_unlock(sa); @@ -1987,7 +1987,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) * Linux kernel. Copy from NIC config to Ethernet device data. */ from = (const struct rte_ether_addr *)(encp->enc_mac_addr); - ether_addr_copy(from, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(from, &dev->data->mac_addrs[0]); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 371648b0e..3ce30ac8c 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -278,7 +278,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, if (spec == NULL) return 0; - if (is_same_ether_addr(&mask->dst, &supp_mask.dst)) { + if (rte_is_same_ether_addr(&mask->dst, &supp_mask.dst)) { efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_LOC_MAC : EFX_FILTER_MATCH_LOC_MAC; @@ -286,7 +286,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, EFX_MAC_ADDR_LEN); } else if (memcmp(mask->dst.addr_bytes, ig_mask, EFX_MAC_ADDR_LEN) == 0) { - if (is_unicast_ether_addr(&spec->dst)) + if (rte_is_unicast_ether_addr(&spec->dst)) efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST : EFX_FILTER_MATCH_UNKNOWN_UCAST_DST; @@ -294,7 +294,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST : EFX_FILTER_MATCH_UNKNOWN_MCAST_DST; - } else if (!is_zero_ether_addr(&mask->dst)) { + } else if (!rte_is_zero_ether_addr(&mask->dst)) { goto fail_bad_mask; } @@ -303,11 +303,11 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, * ethertype masks are equal to zero in inner frame, * so these fields are filled in only for the outer frame */ - if (is_same_ether_addr(&mask->src, &supp_mask.src)) { + if (rte_is_same_ether_addr(&mask->src, &supp_mask.src)) { efx_spec->efs_match_flags |= EFX_FILTER_MATCH_REM_MAC; rte_memcpy(efx_spec->efs_rem_mac, spec->src.addr_bytes, EFX_MAC_ADDR_LEN); - } else if (!is_zero_ether_addr(&mask->src)) { + } else if (!rte_is_zero_ether_addr(&mask->src)) { goto fail_bad_mask; } diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index c6f403d2a..c0bd49e74 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -388,7 +388,7 @@ sfc_port_attach(struct sfc_adapter *sa) RTE_BUILD_BUG_ON(sizeof(encp->enc_mac_addr) != sizeof(*from)); from = (const struct rte_ether_addr *)(encp->enc_mac_addr); - ether_addr_copy(from, &port->default_mac_addr); + rte_ether_addr_copy(from, &port->default_mac_addr); port->max_mcast_addrs = EFX_MAC_MULTICAST_LIST_MAX; port->nb_mcast_addrs = 0; diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 4857fb57a..fd12f02eb 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1522,7 +1522,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi) return -ENOMEM; } - ether_addr_copy(ð_addr, data->mac_addrs); + rte_ether_addr_copy(ð_addr, data->mac_addrs); PMD_INIT_LOG(INFO, "%s device %s successfully initialized", RTE_STR(RTE_SZEDATA2_DRIVER_NAME), data->name); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 473dcdbf5..6ae88093f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1113,7 +1113,7 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) return -ENOTSUP; } - if (is_zero_ether_addr(mac_addr)) { + if (rte_is_zero_ether_addr(mac_addr)) { TAP_LOG(ERR, "%s: can't set an empty MAC address", dev->device->name); return -EINVAL; @@ -1122,14 +1122,14 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY); if (ret < 0) return ret; - if (is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (rte_is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) return 0; /* Check the current MAC address on the remote */ ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY); if (ret < 0) return ret; - if (!is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (!rte_is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; @@ -1674,8 +1674,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name, } if (pmd->type == ETH_TUNTAP_TYPE_TAP) { - if (is_zero_ether_addr(mac_addr)) - eth_random_addr((uint8_t *)&pmd->eth_addr); + if (rte_is_zero_ether_addr(mac_addr)) + rte_eth_random_addr((uint8_t *)&pmd->eth_addr); else rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); } diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index 0e01af62a..0d5019c30 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -537,14 +537,14 @@ tap_flow_create_eth(const struct rte_flow_item *item, void *data) if (!flow) return 0; msg = &flow->msg; - if (!is_zero_ether_addr(&mask->dst)) { + if (!rte_is_zero_ether_addr(&mask->dst)) { tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, &spec->dst.addr_bytes); tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST_MASK, ETHER_ADDR_LEN, &mask->dst.addr_bytes); } - if (!is_zero_ether_addr(&mask->src)) { + if (!rte_is_zero_ether_addr(&mask->src)) { tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, &spec->src.addr_bytes); tap_nlattr_add(&msg->nh, diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c index 2a793a4b1..332a249e8 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.c +++ b/drivers/net/thunderx/base/nicvf_mbox.c @@ -135,7 +135,7 @@ nicvf_handle_mbx_intr(struct nicvf *nic) nic->node = mbx.nic_cfg.node_id; nic->sqs_mode = mbx.nic_cfg.sqs_mode; nic->loopback_supported = mbx.nic_cfg.loopback_supported; - ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, (struct rte_ether_addr *)nic->mac_addr); nic->pf_acked = true; break; diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index ec2087924..482968b7a 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2179,10 +2179,10 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) ret = -ENOMEM; goto alarm_fail; } - if (is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) - eth_random_addr(&nic->mac_addr[0]); + if (rte_is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) + rte_eth_random_addr(&nic->mac_addr[0]); - ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, ð_dev->data->mac_addrs[0]); ret = nicvf_mbox_set_mac_addr(nic, nic->mac_addr); diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index 3124c1a07..99a099ce6 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -390,7 +390,7 @@ vdev_netvsc_device_probe(const struct if_nameindex *iface, strlcpy(ctx->if_name, iface->if_name, sizeof(ctx->if_name)); return 0; } - if (!is_same_ether_addr(eth_addr, &ctx->if_addr)) + if (!rte_is_same_ether_addr(eth_addr, &ctx->if_addr)) return 0; /* Look for associated PCI device. */ ret = vdev_netvsc_sysfs_readlink(buf, sizeof(buf), iface->if_name, @@ -547,7 +547,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, pair->value); return -EINVAL; } - if (is_same_ether_addr(eth_addr, &tmp)) + if (rte_is_same_ether_addr(eth_addr, &tmp)) break; } } diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 4c8d0ca92..f4300a13a 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -329,8 +329,8 @@ vhost_count_multicast_broadcast(struct vhost_queue *vq, struct vhost_stats *pstats = &vq->stats; ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) pstats->xstats[VHOST_BROADCAST_PKT]++; else pstats->xstats[VHOST_MULTICAST_PKT]++; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 645b03c81..bd405c16f 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -962,7 +962,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) offsetof(struct virtio_net_config, mac), &hw->mac_addr, ETHER_ADDR_LEN); } else { - eth_random_addr(&hw->mac_addr[0]); + rte_eth_random_addr(&hw->mac_addr[0]); virtio_set_hwaddr(hw); } } @@ -1018,7 +1018,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, const struct rte_ether_addr *addr = (i == index) ? mac_addr : addrs + i; struct virtio_net_ctrl_mac *tbl - = is_multicast_ether_addr(addr) ? mc : uc; + = rte_is_multicast_ether_addr(addr) ? mc : uc; memcpy(&tbl->macs[tbl->entries++], addr, ETHER_ADDR_LEN); } @@ -1047,10 +1047,10 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { struct virtio_net_ctrl_mac *tbl; - if (i == index || is_zero_ether_addr(addrs + i)) + if (i == index || rte_is_zero_ether_addr(addrs + i)) continue; - tbl = is_multicast_ether_addr(addrs + i) ? mc : uc; + tbl = rte_is_multicast_ether_addr(addrs + i) ? mc : uc; memcpy(&tbl->macs[tbl->entries++], addrs + i, ETHER_ADDR_LEN); } @@ -1483,7 +1483,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Copy the permanent MAC address to: virtio_hw */ virtio_get_hwaddr(hw); - ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index ef8936a75..dc8cb4808 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -793,8 +793,8 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) } ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) stats->broadcast++; else stats->multicast++; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index b1cbeefcd..96e941490 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -311,7 +311,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -1166,7 +1166,7 @@ vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct vmxnet3_hw *hw = dev->data->dev_private; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); vmxnet3_write_mac(hw, mac_addr->addr_bytes); return 0; } diff --git a/examples/bond/main.c b/examples/bond/main.c index fe17936b9..2e67aa516 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -372,12 +372,12 @@ static int lcore_main(__attribute__((unused)) void *arg1) if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) { arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); - ether_addr_copy(&arp_hdr->arp_data.arp_sha, &arp_hdr->arp_data.arp_tha); + rte_ether_addr_copy(&arp_hdr->arp_data.arp_sha, &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = arp_hdr->arp_data.arp_sip; rte_eth_macaddr_get(BOND_PORT, &d_addr); - ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1); is_free = 1; @@ -392,7 +392,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) } ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); ipv4_hdr->dst_addr = ipv4_hdr->src_addr; ipv4_hdr->src_addr = bond_ip; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index ae61e7363..35b992436 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -163,8 +163,8 @@ static void process_frame(struct app_port *ptr_port, struct rte_ether_hdr *ptr_mac_hdr; ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *); - ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); - ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); + rte_ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); + rte_ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); } static int slave_main(__attribute__((unused)) void *ptr_data) diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index 35984cf00..d8fa8dd65 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -327,7 +327,7 @@ rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused, { if (addr == NULL) return -EINVAL; - return is_valid_assigned_ether_addr(addr); + return rte_is_valid_assigned_ether_addr(addr); } int diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index ef23d963a..8e30393d0 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -104,8 +104,8 @@ exchange_mac(struct rte_mbuf *m) /* change mac addresses on packet (to use mbuf data) */ eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ether_addr_copy(ð->d_addr, &addr); - ether_addr_copy(&addr, ð->d_addr); + rte_ether_addr_copy(ð->d_addr, &addr); + rte_ether_addr_copy(&addr, ð->d_addr); } static __rte_always_inline void diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index dad8bccbf..9c77f214f 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -48,7 +48,7 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 ccde72cc0..b223912c6 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -345,7 +345,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, *((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)port_out << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[port_out], ð_hdr->s_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); else @@ -563,7 +563,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 226153968..3a98e644f 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -409,7 +409,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, *((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } @@ -694,7 +694,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 abddc6f24..caad010e1 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1179,7 +1179,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 297bf1152..b74971dc2 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -287,8 +287,8 @@ mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_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); /* Put new packet into the output queue */ @@ -548,7 +548,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/kni/main.c b/examples/kni/main.c index 9ad30566e..8c326153e 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -767,7 +767,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); RTE_LOG(INFO, APP, "\t%s%s\n", name, buf); } diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 05fef7daf..bde1bf3cd 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -599,7 +599,7 @@ l2fwd_mac_updating(struct rte_mbuf *m, uint16_t dest_portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } static void diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 033104d63..77e44dc82 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -349,7 +349,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 21d19932d..9831a4323 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -179,7 +179,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index c1d6797b0..1e2b14297 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -161,7 +161,7 @@ l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } static void diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index ed25f75d8..4b94c246a 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1757,7 +1757,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 c36cafb22..283aa8cf4 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -658,7 +658,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -683,7 +683,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); #else @@ -1358,7 +1358,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 2c0c89e21..56a55ac28 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -450,7 +450,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); @@ -791,7 +791,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 5612ef378..4a7336350 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -47,7 +47,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { @@ -68,7 +68,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else { diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 28635bf03..323f853ee 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -43,7 +43,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -64,7 +64,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else { diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index a91a0a16c..ad013bae8 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -637,7 +637,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -895,7 +895,7 @@ main(int argc, char **argv) /* * prepare src MACs for each port. */ - ether_addr_copy(&ports_eth_addr[portid], + rte_ether_addr_copy(&ports_eth_addr[portid], (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 9997c58f4..9cd4dc7a6 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -176,7 +176,7 @@ lsi_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index b29ed9e97..bd1ec8fa0 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -1070,14 +1070,14 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); send_single_packet(m[0], (uint8_t)dst_port[0]); send_single_packet(m[1], (uint8_t)dst_port[1]); @@ -1204,14 +1204,14 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); send_single_packet(m[0], dst_port[0]); send_single_packet(m[1], dst_port[1]); @@ -1262,7 +1262,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -1283,7 +1283,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else @@ -3024,7 +3024,7 @@ print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3582,7 +3582,7 @@ main(int argc, char **argv) /* * prepare src MACs for each port. */ - ether_addr_copy(&ports_eth_addr[portid], + rte_ether_addr_copy(&ports_eth_addr[portid], (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 7d28f59ce..1266f521c 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -401,7 +401,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ - ether_addr_copy(ð_multicast, ð_hdr->d_addr); + rte_ether_addr_copy(ð_multicast, ð_hdr->d_addr); eth_hdr->ether_type = htons(PTP_PROTOCOL); ptp_msg = (struct ptp_message *) diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 61e92a820..a61360b99 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -67,7 +67,7 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) pause_frame = (struct ether_fc_frame *) &hdr[1]; rte_eth_macaddr_get(port_id, &mac_addr); - ether_addr_copy(&mac_addr, &hdr->s_addr); + rte_ether_addr_copy(&mac_addr, &hdr->s_addr); void *tmp = &hdr->d_addr.addr_bytes[0]; *((uint64_t *)tmp) = 0x010000C28001ULL; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index e4af7bc4d..18a2215b4 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -243,7 +243,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) /* Learn MAC address of guest device from packet */ pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { + if (rte_is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: This device is using an existing" " MAC address and has not been registered.\n", @@ -261,11 +261,11 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; /* inner MAC */ - ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.queue_id = vdev->rx_q; tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; @@ -309,9 +309,9 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) } vxdev.out_key = tenant_id_conf[vdev->rx_q]; - ether_addr_copy(&vxdev.port[portid].peer_mac, + rte_ether_addr_copy(&vxdev.port[portid].peer_mac, &app_l2_hdr[portid].d_addr); - ether_addr_copy(&ports_eth_addr[0], + 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); @@ -349,8 +349,8 @@ vxlan_unlink(struct vhost_dev *vdev) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); - ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index bea6b975a..568a2b232 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -680,7 +680,7 @@ find_vhost_dev(struct rte_ether_addr *mac) TAILQ_FOREACH(vdev, &vhost_dev_list, global_vdev_entry) { if (vdev->ready == DEVICE_RX && - is_same_ether_addr(mac, &vdev->mac_address)) + rte_is_same_ether_addr(mac, &vdev->mac_address)) return vdev; } @@ -928,7 +928,7 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) { + if (unlikely(rte_is_broadcast_ether_addr(&nh->d_addr))) { struct vhost_dev *vdev2; TAILQ_FOREACH(vdev2, &vhost_dev_list, global_vdev_entry) { diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 5195a515a..7281ffd7f 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -417,7 +417,7 @@ update_mac_address(struct rte_mbuf *m, unsigned dst_port) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); } /* When we receive a HUP signal, print out our stats */ diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 75cf31a10..389000327 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -504,7 +504,7 @@ update_mac_address(struct rte_mbuf *m, unsigned dst_port) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); } /* When we receive a HUP signal, print out our stats */ diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 08e226c3a..c552a20bd 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1252,7 +1252,7 @@ rte_eth_dev_mac_restore(struct rte_eth_dev *dev, addr = &dev->data->mac_addrs[i]; /* skip zero address */ - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; pool = 0; @@ -2474,7 +2474,7 @@ rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr) RTE_ETH_VALID_PORTID_OR_RET(port_id); dev = &rte_eth_devices[port_id]; - ether_addr_copy(&dev->data->mac_addrs[0], mac_addr); + rte_ether_addr_copy(&dev->data->mac_addrs[0], mac_addr); } @@ -2973,7 +2973,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP); - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n", port_id); return -EINVAL; @@ -3004,7 +3004,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, if (ret == 0) { /* Update address in NIC data structure */ - ether_addr_copy(addr, &dev->data->mac_addrs[index]); + rte_ether_addr_copy(addr, &dev->data->mac_addrs[index]); /* Update pool bitmap in NIC data structure */ dev->data->mac_pool_sel[index] |= (1ULL << pool); @@ -3036,7 +3036,7 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr) (*dev->dev_ops->mac_addr_remove)(dev, index); /* Update address in NIC data structure */ - ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]); + rte_ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]); /* reset pool bitmap */ dev->data->mac_pool_sel[index] = 0; @@ -3052,7 +3052,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); - if (!is_valid_assigned_ether_addr(addr)) + if (!rte_is_valid_assigned_ether_addr(addr)) return -EINVAL; dev = &rte_eth_devices[port_id]; @@ -3063,7 +3063,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) return ret; /* Update default address in NIC data structure */ - ether_addr_copy(addr, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(addr, &dev->data->mac_addrs[0]); return 0; } @@ -3103,7 +3103,7 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n", port_id); return -EINVAL; @@ -3135,10 +3135,10 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, if (ret == 0) { /* Update address in NIC data structure */ if (on) - ether_addr_copy(addr, + rte_ether_addr_copy(addr, &dev->data->hash_mac_addrs[index]); else - ether_addr_copy(&null_mac_addr, + rte_ether_addr_copy(&null_mac_addr, &dev->data->hash_mac_addrs[index]); } diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 552db8f35..398b5b4cf 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -160,8 +160,8 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, dst = &(tbl->flows[flow_idx].key); - ether_addr_copy(&(src->eth_saddr), &(dst->eth_saddr)); - ether_addr_copy(&(src->eth_daddr), &(dst->eth_daddr)); + rte_ether_addr_copy(&(src->eth_saddr), &(dst->eth_saddr)); + rte_ether_addr_copy(&(src->eth_daddr), &(dst->eth_daddr)); dst->ip_src_addr = src->ip_src_addr; dst->ip_dst_addr = src->ip_dst_addr; dst->recv_ack = src->recv_ack; @@ -235,8 +235,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); - ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr)); - ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr)); + rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr)); + rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr)); key.ip_src_addr = ipv4_hdr->src_addr; key.ip_dst_addr = ipv4_hdr->dst_addr; key.src_port = tcp_hdr->src_port; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 439f9a8c4..4879e2400 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -182,8 +182,8 @@ uint32_t gro_tcp4_tbl_pkt_count(void *tbl); static inline int is_same_tcp4_flow(struct tcp4_flow_key k1, struct tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && - is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && + return (rte_is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && + rte_is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && (k1.ip_src_addr == k2.ip_src_addr) && (k1.ip_dst_addr == k2.ip_dst_addr) && (k1.recv_ack == k2.recv_ack) && diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 4985b0124..baf3beffb 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -164,9 +164,9 @@ insert_new_flow(struct gro_vxlan_tcp4_tbl *tbl, dst = &(tbl->flows[flow_idx].key); - ether_addr_copy(&(src->inner_key.eth_saddr), + rte_ether_addr_copy(&(src->inner_key.eth_saddr), &(dst->inner_key.eth_saddr)); - ether_addr_copy(&(src->inner_key.eth_daddr), + rte_ether_addr_copy(&(src->inner_key.eth_daddr), &(dst->inner_key.eth_daddr)); dst->inner_key.ip_src_addr = src->inner_key.ip_src_addr; dst->inner_key.ip_dst_addr = src->inner_key.ip_dst_addr; @@ -176,8 +176,8 @@ insert_new_flow(struct gro_vxlan_tcp4_tbl *tbl, dst->vxlan_hdr.vx_flags = src->vxlan_hdr.vx_flags; dst->vxlan_hdr.vx_vni = src->vxlan_hdr.vx_vni; - ether_addr_copy(&(src->outer_eth_saddr), &(dst->outer_eth_saddr)); - ether_addr_copy(&(src->outer_eth_daddr), &(dst->outer_eth_daddr)); + rte_ether_addr_copy(&(src->outer_eth_saddr), &(dst->outer_eth_saddr)); + rte_ether_addr_copy(&(src->outer_eth_daddr), &(dst->outer_eth_daddr)); dst->outer_ip_src_addr = src->outer_ip_src_addr; dst->outer_ip_dst_addr = src->outer_ip_dst_addr; dst->outer_src_port = src->outer_src_port; @@ -193,8 +193,8 @@ static inline int is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, struct vxlan_tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.outer_eth_saddr, &k2.outer_eth_saddr) && - is_same_ether_addr(&k1.outer_eth_daddr, + return (rte_is_same_ether_addr(&k1.outer_eth_saddr, &k2.outer_eth_saddr) && + rte_is_same_ether_addr(&k1.outer_eth_daddr, &k2.outer_eth_daddr) && (k1.outer_ip_src_addr == k2.outer_ip_src_addr) && (k1.outer_ip_dst_addr == k2.outer_ip_dst_addr) && @@ -348,8 +348,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); - ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr)); - ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr)); + rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr)); + rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr)); key.inner_key.ip_src_addr = ipv4_hdr->src_addr; key.inner_key.ip_dst_addr = ipv4_hdr->dst_addr; key.inner_key.recv_ack = tcp_hdr->recv_ack; @@ -358,8 +358,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, key.vxlan_hdr.vx_flags = vxlan_hdr->vx_flags; key.vxlan_hdr.vx_vni = vxlan_hdr->vx_vni; - ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr)); - ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr)); + rte_ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr)); + rte_ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr)); key.outer_ip_src_addr = outer_ipv4_hdr->src_addr; key.outer_ip_dst_addr = outer_ipv4_hdr->dst_addr; key.outer_src_port = udp_hdr->src_port; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 921adb4cf..2274dc65d 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -30,7 +30,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, /* Ethernet header. */ memset(eth_hdr->d_addr.addr_bytes, 0xff, ETHER_ADDR_LEN); - ether_addr_copy(mac, ð_hdr->s_addr); + rte_ether_addr_copy(mac, ð_hdr->s_addr); eth_hdr->ether_type = htons(ETHER_TYPE_RARP); /* RARP header. */ @@ -41,8 +41,8 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, rarp->arp_plen = 4; rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); - ether_addr_copy(mac, &rarp->arp_data.arp_sha); - ether_addr_copy(mac, &rarp->arp_data.arp_tha); + rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha); + rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha); memset(&rarp->arp_data.arp_sip, 0x00, 4); memset(&rarp->arp_data.arp_tip, 0x00, 4); diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index ddb531845..cf6cbf431 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -75,7 +75,7 @@ struct rte_ether_addr { * True (1) if the given two ethernet address are the same; * False (0) otherwise. */ -static inline int is_same_ether_addr(const struct rte_ether_addr *ea1, +static inline int rte_is_same_ether_addr(const struct rte_ether_addr *ea1, const struct rte_ether_addr *ea2) { int i; @@ -95,7 +95,7 @@ static inline int is_same_ether_addr(const struct rte_ether_addr *ea1, * True (1) if the given ethernet address is filled with zeros; * false (0) otherwise. */ -static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -114,7 +114,7 @@ static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a unicast address; * false (0) otherwise. */ -static inline int is_unicast_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; } @@ -129,7 +129,7 @@ static inline int is_unicast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a multicast address; * false (0) otherwise. */ -static inline int is_multicast_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; } @@ -144,7 +144,7 @@ static inline int is_multicast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a broadcast address; * false (0) otherwise. */ -static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_broadcast_ether_addr(const struct rte_ether_addr *ea) { const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; @@ -162,7 +162,7 @@ static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a universally assigned address; * false (0) otherwise. */ -static inline int is_universal_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; } @@ -177,7 +177,7 @@ static inline int is_universal_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a locally assigned address; * false (0) otherwise. */ -static inline int is_local_admin_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; } @@ -193,9 +193,9 @@ static inline int is_local_admin_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is valid; * false (0) otherwise. */ -static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) { - return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); + return rte_is_unicast_ether_addr(ea) && (!rte_is_zero_ether_addr(ea)); } /** @@ -204,7 +204,7 @@ static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) * @param addr * A pointer to Ethernet address. */ -static inline void eth_random_addr(uint8_t *addr) +static inline void rte_eth_random_addr(uint8_t *addr) { uint64_t rand = rte_rand(); uint8_t *p = (uint8_t *)&rand; @@ -222,7 +222,7 @@ static inline void eth_random_addr(uint8_t *addr) * @param ea_to * A pointer to a ether_addr structure where to copy the Ethernet address. */ -static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, +static inline void rte_ether_addr_copy(const struct rte_ether_addr *ea_from, struct rte_ether_addr *ea_to) { #ifdef __INTEL_COMPILER @@ -252,7 +252,7 @@ static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, * A pointer to a ether_addr structure. */ static inline void -ether_format_addr(char *buf, uint16_t size, +rte_ether_format_addr(char *buf, uint16_t size, const struct rte_ether_addr *eth_addr) { snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 693be2cad..3cd1fd521 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -615,8 +615,8 @@ encap_ether_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ethertype); return 0; @@ -633,8 +633,8 @@ encap_vlan_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->vlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -657,8 +657,8 @@ encap_qinq_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); + 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); /* SVLAN */ @@ -687,8 +687,8 @@ encap_mpls_apply(void *data, uint32_t i; /* Ethernet */ - ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ethertype); /* MPLS */ @@ -714,8 +714,8 @@ encap_pppoe_apply(void *data, struct encap_pppoe_data *d = data; /* Ethernet */ - ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ETHER_TYPE_PPPOE_SESSION); /* PPPoE and PPP*/ @@ -744,8 +744,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv4_vlan_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -783,8 +783,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv4_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* IPv4*/ @@ -818,8 +818,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv6_vlan_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -857,8 +857,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv6_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* IPv6*/ diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index 51ab0db29..2ef5d15a5 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -57,8 +57,8 @@ initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_ struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id) { - ether_addr_copy(dst_mac, ð_hdr->d_addr); - ether_addr_copy(src_mac, ð_hdr->s_addr); + rte_ether_addr_copy(dst_mac, ð_hdr->d_addr); + rte_ether_addr_copy(src_mac, ð_hdr->s_addr); if (vlan_enabled) { struct rte_vlan_hdr *vhdr = (struct rte_vlan_hdr *)((uint8_t *)eth_hdr + @@ -83,9 +83,9 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma arp_hdr->arp_hlen = ETHER_ADDR_LEN; arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); - ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = src_ip; - ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); + rte_ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = dst_ip; } diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index 25276715a..00ddb0efe 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -4482,7 +4482,7 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); @@ -4549,12 +4549,12 @@ test_alb_change_mac_in_reply_sent(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { - if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } @@ -4595,7 +4595,7 @@ test_alb_reply_from_client(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); @@ -4670,12 +4670,12 @@ test_alb_reply_from_client(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { - if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } @@ -4722,7 +4722,7 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index 63fcafaea..f5ac6c99f 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -232,7 +232,7 @@ add_slave(struct slave_conf *slave, uint8_t start) RTE_VERIFY(slave->bonded == 0); RTE_VERIFY(slave->port_id != INVALID_PORT_ID); - ether_addr_copy(&slave_mac_default, &addr); + rte_ether_addr_copy(&slave_mac_default, &addr); addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; rte_eth_dev_mac_addr_remove(slave->port_id, &addr); @@ -253,7 +253,7 @@ add_slave(struct slave_conf *slave, uint8_t start) } rte_eth_macaddr_get(slave->port_id, &addr_check); - TEST_ASSERT_EQUAL(is_same_ether_addr(&addr, &addr_check), 1, + TEST_ASSERT_EQUAL(rte_is_same_ether_addr(&addr, &addr_check), 1, "Slave MAC address is not as expected"); RTE_VERIFY(slave->lacp_parnter_state == 0); @@ -491,7 +491,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *); /* Change source address to partner address */ - ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr); + 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; lacp = (struct lacpdu *) &slow_hdr->slow_protocol; @@ -503,7 +503,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) lacp->partner.state = lacp->actor.state; - ether_addr_copy(&parnter_system, &lacp->actor.port_params.system); + rte_ether_addr_copy(&parnter_system, &lacp->actor.port_params.system); lacp->actor.state = STATE_LACP_ACTIVE | STATE_SYNCHRONIZATION | STATE_AGGREGATION | @@ -810,7 +810,7 @@ test_mode4_rx(void) TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac); - ether_addr_copy(&bonded_mac, &dst_mac); + rte_ether_addr_copy(&bonded_mac, &dst_mac); /* Assert that dst address is not bonding address. Do not set the * least significant bit of the zero byte as this would create a @@ -845,7 +845,7 @@ test_mode4_rx(void) for (i = 0; i < expected_pkts_cnt; i++) { hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); - cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; + cnt[rte_is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; } free_pkts(pkts, expected_pkts_cnt); @@ -889,7 +889,7 @@ test_mode4_rx(void) for (i = 0; i < expected_pkts_cnt; i++) { hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); - eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac); + eq_cnt += rte_is_same_ether_addr(&hdr->d_addr, &bonded_mac); } free_pkts(pkts, expected_pkts_cnt); @@ -1130,10 +1130,10 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) struct marker_header *); /* Copy multicast destination address */ - ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr); + rte_ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr); /* Init source address */ - ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr); + 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.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW); @@ -1358,8 +1358,8 @@ test_mode4_ext_ctrl(void) }, }; - ether_addr_copy(&parnter_system, &src_mac); - ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); + rte_ether_addr_copy(&parnter_system, &src_mac); + 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); @@ -1412,8 +1412,8 @@ test_mode4_ext_lacp(void) }, }; - ether_addr_copy(&parnter_system, &src_mac); - ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); + rte_ether_addr_copy(&parnter_system, &src_mac); + 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); diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index 1265cb86f..3660efff4 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -174,7 +174,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 05/14] net: add rte prefix to ether defines 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (3 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 04/14] net: add rte prefix to ether functions Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 06/14] net: add rte prefix to esp structure Olivier Matz ` (15 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev 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. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-eventdev/test_perf_common.c | 2 +- app/test-eventdev/test_pipeline_common.c | 2 +- app/test-pmd/cmdline.c | 22 ++--- app/test-pmd/cmdline_flow.c | 8 +- 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 | 8 +- app/test-pmd/txonly.c | 2 +- app/test-pmd/util.c | 4 +- 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/ark/ark_ethdev.c | 4 +- drivers/net/atlantic/atl_ethdev.c | 6 +- drivers/net/avf/avf.h | 2 +- drivers/net/avf/avf_ethdev.c | 20 ++-- drivers/net/avf/avf_rxtx.c | 8 +- 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 | 2 +- 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_flow.c | 8 +- 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 | 50 +++++----- drivers/net/i40e/i40e_ethdev.h | 2 +- drivers/net/i40e/i40e_ethdev_vf.c | 20 ++-- 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/ixgbe/ixgbe_ethdev.c | 46 ++++----- drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- 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/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_tcf.c | 16 ++-- 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 | 44 ++++----- drivers/net/virtio/virtio_pci.h | 4 +- drivers/net/virtio/virtio_rxtx.c | 6 +- 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 | 16 ++-- 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/main.c | 2 +- lib/librte_cmdline/cmdline_parse_etheraddr.c | 7 +- lib/librte_ethdev/rte_ethdev.c | 16 ++-- 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 | 110 +++++++++++----------- lib/librte_net/rte_net.c | 26 ++--- lib/librte_pipeline/rte_table_action.c | 30 +++--- lib/librte_port/rte_port_source_sink.c | 6 +- lib/librte_vhost/virtio_net.c | 6 +- test/test/packet_burst_generator.c | 14 +-- test/test/test_cmdline_etheraddr.c | 2 +- test/test/test_flow_classify.c | 6 +- test/test/test_link_bonding.c | 90 +++++++++--------- test/test/test_link_bonding_mode4.c | 28 +++--- test/test/test_link_bonding_rssconf.c | 4 +- test/test/test_pmd_perf.c | 8 +- test/test/test_sched.c | 2 +- test/test/virtual_pmd.c | 2 +- 202 files changed, 936 insertions(+), 937 deletions(-) diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index 861877532..3fcae4885 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -678,7 +678,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 d07fa8826..15a4e2f0e 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 d21d984bb..9c643135b 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1764,16 +1764,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; @@ -1835,8 +1835,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); @@ -8030,7 +8030,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; @@ -9000,7 +9000,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; } @@ -15068,9 +15068,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 = { @@ -15225,9 +15225,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 = { diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 6c5538d9c..73aab50b3 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3359,9 +3359,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, @@ -3450,9 +3450,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, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 9db38e327..361137916 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -106,8 +106,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 f3fb78a75..f52608056 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); } @@ -146,7 +146,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); @@ -154,11 +154,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; @@ -196,7 +196,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 */ @@ -218,7 +218,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; @@ -229,10 +229,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; @@ -242,11 +242,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; @@ -260,7 +260,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 */ @@ -281,7 +281,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; @@ -291,10 +291,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; @@ -303,11 +303,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; @@ -344,10 +344,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; } @@ -379,7 +379,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; @@ -393,7 +393,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 */ @@ -454,7 +454,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; @@ -490,7 +490,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 cbba5211a..47fb011a1 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 4a4debb8d..b3e7863a6 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -815,15 +815,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 b8a99065c..6b02c0c10 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -389,7 +389,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 = { @@ -498,7 +498,7 @@ static void eth_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. @@ -554,7 +554,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; } } @@ -1143,8 +1143,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 cc8618cc8..3c730b869 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -489,8 +489,8 @@ struct vxlan_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 vxlan_encap_conf vxlan_encap_conf; @@ -504,8 +504,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; diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index eb7319466..ae094ab94 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -229,7 +229,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); /* * Copy headers in first packet segment(s). diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index c7c497389..312707430 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/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 0ebe85e5f..55ef0876a 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -865,7 +865,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. @@ -942,7 +942,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 ae51c80eb..e028f4559 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 68ae68596..97bd756a2 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 a73af7528..4b2af2d1b 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 bdb700423..dfa7e30b0 100644 --- a/drivers/bus/dpaa/base/fman/fman.c +++ b/drivers/bus/dpaa/base/fman/fman.c @@ -313,7 +313,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 4ebbc3d34..0ba9d211f 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/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index bc15add31..7963c0f66 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 585d24472..9ce2c3913 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -364,7 +364,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; @@ -1255,11 +1255,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/avf/avf.h b/drivers/net/avf/avf.h index be43f343d..5bdee902b 100644 --- a/drivers/net/avf/avf.h +++ b/drivers/net/avf/avf.h @@ -56,7 +56,7 @@ */ #define AVF_VLAN_TAG_SIZE 4 #define AVF_ETH_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + AVF_VLAN_TAG_SIZE * 2) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + AVF_VLAN_TAG_SIZE * 2) struct avf_adapter; struct avf_rx_queue; diff --git a/drivers/net/avf/avf_ethdev.c b/drivers/net/avf/avf_ethdev.c index af3944480..6d4b491b6 100644 --- a/drivers/net/avf/avf_ethdev.c +++ b/drivers/net/avf/avf_ethdev.c @@ -223,23 +223,23 @@ avf_init_rxq(struct rte_eth_dev *dev, struct avf_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 > AVF_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)AVF_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 @@ avf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t frame_size = mtu + AVF_ETH_OVERHEAD; int ret = 0; - if (mtu < ETHER_MIN_MTU || frame_size > AVF_FRAME_SIZE_MAX) + if (mtu < RTE_ETHER_MIN_MTU || frame_size > AVF_FRAME_SIZE_MAX) return -EINVAL; /* mtu setting is forbidden if port is start */ @@ -916,7 +916,7 @@ avf_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 @@ avf_dev_init(struct rte_eth_dev *eth_dev) /* copy mac addr */ eth_dev->data->mac_addrs = rte_zmalloc( "avf_mac", - ETHER_ADDR_LEN * AVF_NUM_MACADDR_MAX, + RTE_ETHER_ADDR_LEN * AVF_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 * AVF_NUM_MACADDR_MAX); + RTE_ETHER_ADDR_LEN * AVF_NUM_MACADDR_MAX); return -ENOMEM; } /* If the MAC address is not configured by host, diff --git a/drivers/net/avf/avf_rxtx.c b/drivers/net/avf/avf_rxtx.c index 6b3b0191c..9203b74b8 100644 --- a/drivers/net/avf/avf_rxtx.c +++ b/drivers/net/avf/avf_rxtx.c @@ -1025,17 +1025,17 @@ avf_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/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 4f563d14b..53ddf626f 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 c8ce67771..33ec8a590 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 3088e27e6..fe51dd738 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -9724,13 +9724,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 f75b0ad3c..d499a80c9 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 3f2404a69..a97976a1a 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, @@ -3355,16 +3355,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], @@ -3375,7 +3375,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 7903ac74e..9e25aee14 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 5345d3938..aa92828bf 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -333,7 +333,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 c7bc88481..868e79f57 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -664,7 +664,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 f9ab6959b..50a38f051 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 446677fae..6ea25e9f1 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 77317362d..46757cf79 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 = { @@ -396,7 +396,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, 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); @@ -641,14 +641,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 } @@ -806,12 +806,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); @@ -845,7 +845,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; @@ -872,7 +872,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); @@ -1095,7 +1095,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 */ @@ -2226,7 +2226,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 @@ -3040,12 +3040,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; } @@ -3104,7 +3104,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) { @@ -3114,7 +3114,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 7c43e12d1..330803235 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 701e0b1fe..f834ce6b0 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 eb58f8802..90e8ef221 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 17728af01..45b45ec70 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 b7bcbf56a..7e9bd3702 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 13de577c6..a572f7434 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -235,7 +235,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 */ @@ -264,7 +264,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 */ @@ -450,7 +450,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 a135df9c7..0b22f42fe 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -1343,7 +1343,7 @@ int link_start(struct port_info *pi) unsigned int mtu; 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); /* * We do not set address filters and promiscuity here, the stack does @@ -1838,7 +1838,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 4214d0312..0f8705d13 100644 --- a/drivers/net/cxgbe/cxgbevf_main.c +++ b/drivers/net/cxgbe/cxgbevf_main.c @@ -244,7 +244,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 814188fea..60a98922a 100644 --- a/drivers/net/cxgbe/l2t.c +++ b/drivers/net/cxgbe/l2t.c @@ -80,10 +80,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); @@ -115,7 +115,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; } @@ -153,7 +153,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 22a34e388..f82ead8eb 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 02ec69a92..751be1d28 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 c3d6fe0d7..be696359c 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 f9d2d48a0..07b924d5f 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); } @@ -1127,7 +1127,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; @@ -1144,7 +1144,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", @@ -1229,7 +1229,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 704bbf060..0b8337b3b 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -145,13 +145,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 @@ -171,7 +171,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 @@ -229,7 +229,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) { @@ -1350,11 +1350,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; } @@ -1382,7 +1382,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 937388cfb..a51469373 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 244099afc..faae9898d 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1016,7 +1016,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(); @@ -1027,10 +1027,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 @@ -1992,11 +1992,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 94edff08e..daafb865e 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -149,7 +149,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 4d8615325..a2f3b3709 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; } @@ -578,7 +578,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); @@ -823,7 +823,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) @@ -1039,7 +1039,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; } @@ -1699,7 +1699,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"); @@ -1749,7 +1749,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)); @@ -1775,10 +1775,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 @@ -1791,7 +1791,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 a9cd76518..6de335fb6 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -1003,17 +1003,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); } /* @@ -1366,7 +1366,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; @@ -1461,7 +1461,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; @@ -1797,7 +1797,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; @@ -1830,7 +1830,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 762184665..ab3f4cfb6 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -809,11 +809,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; } @@ -1008,13 +1008,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; } @@ -1305,7 +1305,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 */ @@ -1672,7 +1672,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; @@ -1691,7 +1691,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); @@ -1755,10 +1755,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); @@ -1771,10 +1771,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); @@ -1808,10 +1808,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); @@ -3057,7 +3057,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"); @@ -3113,7 +3113,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)); @@ -4449,7 +4449,7 @@ eth_igb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t rctl; struct e1000_hw *hw; 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 + VLAN_TAG_SIZE); hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4462,7 +4462,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; @@ -4475,7 +4475,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; @@ -4721,8 +4721,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; @@ -5133,7 +5133,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 25ff5f68f..e0834ab58 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -1143,17 +1143,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); } /* @@ -1721,7 +1721,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; @@ -2374,7 +2374,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 2dc8129e0..d4b29a505 100644 --- a/drivers/net/ena/ena_ethdev.h +++ b/drivers/net/ena/ena_ethdev.h @@ -182,7 +182,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 8b2b47365..14766228c 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 7bca3cad2..92934ee71 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -202,7 +202,7 @@ struct enic { static inline uint32_t enic_mtu_to_max_rx_pktlen(uint32_t mtu) { /* ethdev max size includes eth and crc whereas NIC MTU does not */ - return mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + return mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; } /* Get the CQ index from a Start of Packet(SOP) RQ index */ diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index dbd638da9..c964a5e78 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -513,14 +513,14 @@ enic_copy_item_eth_v2(const struct rte_flow_item *item, 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 28ae823f4..6c4e6aebc 100644 --- a/drivers/net/enic/enic_res.c +++ b/drivers/net/enic/enic_res.c @@ -61,10 +61,10 @@ 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 + 4); + enic->max_mtu = c->max_pkt_size - (RTE_ETHER_HDR_LEN + 4); else enic->max_mtu = ENIC_DEFAULT_RX_MAX_PKT_SIZE - - (ETHER_HDR_LEN + 4); + - (RTE_ETHER_HDR_LEN + 4); if (c->mtu == 0) c->mtu = 1500; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index d19f83e8f..e67bbf7b2 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 ff39ece18..b6748d074 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 e1bff3952..da51546c2 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -618,7 +618,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)); @@ -3076,7 +3076,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 895b3d6fb..8262ed1ce 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1467,7 +1467,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 " @@ -1501,9 +1501,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); @@ -2809,7 +2809,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); @@ -2909,7 +2909,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), @@ -2929,10 +2929,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 @@ -2986,7 +2986,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 @@ -3709,9 +3709,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); @@ -3969,7 +3969,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 @@ -4074,11 +4074,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); @@ -4089,7 +4089,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."); @@ -5753,7 +5753,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); @@ -7039,7 +7039,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 */ @@ -7090,7 +7090,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 */ @@ -8532,7 +8532,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; } @@ -9812,7 +9812,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; @@ -9904,14 +9904,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."); @@ -11892,7 +11892,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 */ @@ -11902,7 +11902,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 09ee61d45..f7a33cf2f 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 22d18c740..8ac7405a7 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1452,12 +1452,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, @@ -1700,21 +1700,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; } } @@ -2611,7 +2611,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 */ @@ -2621,7 +2621,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 f5813e99a..d7a1000d8 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 de619dd0d..2856fe87e 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 b2819f757..1227a4daa 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -885,17 +885,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; @@ -1830,7 +1830,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; @@ -2610,23 +2610,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 6981d335d..71fd3d690 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -662,7 +662,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; } @@ -764,7 +764,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 { @@ -892,7 +892,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/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index bd10b4012..0818be2bf 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1205,13 +1205,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 */ @@ -1219,12 +1219,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; } @@ -1494,7 +1494,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; } @@ -1534,7 +1534,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); @@ -1640,13 +1640,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; } @@ -3023,7 +3023,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] += @@ -3068,12 +3068,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 @@ -3103,7 +3103,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); @@ -4521,7 +4521,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"); @@ -4742,7 +4742,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"); @@ -4914,13 +4914,13 @@ ixgbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t maxfrs; struct ixgbe_hw *hw; 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; struct rte_eth_dev_data *dev_data = dev->data; 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 @@ -4937,7 +4937,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; @@ -6304,12 +6304,12 @@ static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) { struct ixgbe_hw *hw; - uint32_t max_frame = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN; + uint32_t max_frame = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; struct rte_eth_rxmode *rx_conf = &dev->data->dev_conf.rxmode; 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; /* refuse mtu that requires the support of scattered packets when this @@ -6604,8 +6604,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; @@ -7013,7 +7013,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 d0b93968b..725c1ff3f 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -254,7 +254,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 ff9e6f49b..5797a5e95 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -858,8 +858,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, @@ -1676,7 +1676,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]; } @@ -1705,7 +1705,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, @@ -2631,7 +2631,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)); @@ -2642,7 +2642,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; @@ -2663,7 +2663,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 e8089a04d..040174b8b 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; @@ -460,7 +460,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 @@ -553,7 +553,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 && @@ -562,7 +562,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 e6f61c900..46f3f5d5d 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2935,7 +2935,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; @@ -3916,7 +3916,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 = @@ -4894,7 +4894,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/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index a2ff73c9b..ac043b8e4 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -429,7 +429,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; @@ -444,9 +444,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; } @@ -475,7 +475,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 @@ -1428,9 +1428,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); @@ -1711,7 +1711,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; @@ -1829,7 +1829,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)); @@ -2091,7 +2091,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 b942eeebd..10d226858 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -656,7 +656,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 b843032cc..2c55d52c3 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -115,7 +115,7 @@ struct priv { /* mlx4_ethdev.c */ int mlx4_get_ifname(const struct priv *priv, char (*ifname)[IF_NAMESIZE]); -int mlx4_get_mac(struct priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]); +int mlx4_get_mac(struct priv *priv, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]); int mlx4_mtu_get(struct 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 350271dc8..9c7461462 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -176,14 +176,14 @@ mlx4_ifreq(const struct priv *priv, int req, struct ifreq *ifr) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_get_mac(struct priv *priv, uint8_t (*mac)[ETHER_ADDR_LEN]) +mlx4_get_mac(struct 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 5287b9067..13f2987bb 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -227,7 +227,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; @@ -249,10 +249,10 @@ mlx4_flow_merge_eth(struct rte_flow *flow, .type = IBV_FLOW_SPEC_ETH, .size = sizeof(*eth), }; - 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 8c88effcd..0e2d34ec9 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 6f124dd24..a62f20cf6 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -953,7 +953,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, sizeof(priv->ibdev_path)); priv->device_attr = attr; priv->pd = pd; - 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 47b9d9136..0dd0a4c34 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -283,7 +283,7 @@ int mlx5_sysfs_switch_info(unsigned int ifindex, /* 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_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 024ae5ea1..e4dea1197 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -383,7 +383,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); } @@ -660,11 +660,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: @@ -1373,7 +1373,7 @@ flow_tcf_get_items_and_size(const struct rte_flow_attr *attr, break; case RTE_FLOW_ITEM_TYPE_ETH: size += SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. */ - SZ_NLATTR_DATA_OF(ETHER_ADDR_LEN) * 4; + SZ_NLATTR_DATA_OF(RTE_ETHER_ADDR_LEN) * 4; /* dst/src MAC addr and mask. */ flags |= MLX5_FLOW_LAYER_OUTER_L2; break; @@ -1729,18 +1729,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); } break; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 65c849ce0..4de4759e7 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -163,14 +163,14 @@ flow_verbs_translate_item_eth(const struct rte_flow_item *item, 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 fdfd46f36..42130133f 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 0fc453085..a111fcacb 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -337,7 +337,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; @@ -426,7 +426,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)), @@ -442,7 +442,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; @@ -452,7 +452,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 558e6b60a..3d18727fc 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -570,7 +570,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; @@ -1975,7 +1975,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); @@ -2181,7 +2181,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 b37b7381c..9fdf85362 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h @@ -374,7 +374,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 = { @@ -388,8 +388,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; @@ -712,7 +712,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 54b3783cf..0c3741838 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h @@ -371,16 +371,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 @@ -696,9 +696,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 686b9ec63..98f267899 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -338,7 +338,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 9d719f176..e9036f5b0 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -260,7 +260,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; } @@ -585,7 +585,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) @@ -620,7 +620,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) @@ -659,7 +659,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); } @@ -792,7 +792,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; @@ -806,7 +806,7 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name) goto out_free_mac; 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->data->dev_private = priv; 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 b06af7761..6b26aa9d5 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -447,7 +447,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; } @@ -1067,7 +1067,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) @@ -1105,7 +1105,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) @@ -1166,7 +1166,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); } @@ -2785,7 +2785,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; @@ -2799,7 +2799,7 @@ mrvl_eth_dev_create(struct rte_vdev_device *vdev, const char *name) goto out_free_mac; 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->data->dev_private = priv; 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 8e409eb7e..ef32d6d5f 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -767,7 +767,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 9690c5f8a..3e99b83d2 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; /* TODO 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 38fa1dae3..a346d9249 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 @@ -587,7 +587,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 bfc5e08f1..5a8426183 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -1149,7 +1149,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; @@ -1422,7 +1422,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 */ @@ -1433,7 +1433,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; @@ -2831,7 +2831,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) @@ -2874,7 +2874,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 b01036df2..d71e0e1e3 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 e4dbdc098..237ce9302 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; @@ -1063,7 +1063,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"); @@ -1084,7 +1084,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 920f6f89b..7b66846c1 100644 --- a/drivers/net/octeontx/octeontx_ethdev.h +++ b/drivers/net/octeontx/octeontx_ethdev.h @@ -61,7 +61,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 e0ac16c33..d42b0ea18 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -28,7 +28,7 @@ #include <rte_string_fns.h> #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 @@ -270,7 +270,7 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) pcap_dump((u_char *)dumper_q->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_q->dumper, &header, tx_pcap_data); @@ -278,7 +278,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; @@ -327,7 +327,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(tx_queue->pcap, tx_pcap_data, mbuf->pkt_len); @@ -335,7 +335,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; @@ -955,7 +955,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; @@ -964,7 +964,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); @@ -1002,7 +1002,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; @@ -1011,7 +1011,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 cf454b19b..0e3f38c28 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -3648,9 +3648,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 89760e921..42aae4a19 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -564,7 +564,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" @@ -587,7 +587,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; @@ -1213,7 +1213,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; @@ -2231,9 +2231,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; } @@ -2273,7 +2273,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; @@ -2407,7 +2407,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 */ @@ -2537,7 +2537,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); @@ -2593,7 +2593,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 c361f24d5..9014cc176 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -367,7 +367,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; @@ -432,7 +432,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); @@ -453,7 +453,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 93f9e54a5..103eeb509 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -915,21 +915,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 d3a41e92e..af84f9e1a 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 fd7966eb9..9bed74961 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -875,7 +875,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; } @@ -1956,7 +1956,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 3ce30ac8c..d558665e8 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 6ae88093f..f50b12fa0 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -527,9 +527,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); } @@ -619,7 +619,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; @@ -639,7 +639,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; @@ -884,7 +884,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; @@ -1133,11 +1133,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); @@ -1700,7 +1700,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, 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; } @@ -1756,7 +1756,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, 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.", @@ -1883,8 +1883,8 @@ set_mac_type(const char *key __rte_unused, static int iface_idx; /* fixed mac = 00:64:74:61:70:<iface_idx> */ - 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 0d5019c30..57fc1796d 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 <rte_ether.h> -#define NICVF_MAC_ADDR_SIZE ETHER_ADDR_LEN +#define NICVF_MAC_ADDR_SIZE RTE_ETHER_ADDR_LEN #include <rte_io.h> #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 bd405c16f..2e20b6036 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -703,16 +703,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; @@ -951,7 +951,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 @@ -960,7 +960,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); @@ -983,10 +983,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); @@ -1009,9 +1009,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++) { @@ -1020,7 +1020,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); @@ -1039,9 +1039,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++) { @@ -1051,7 +1051,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); @@ -1062,17 +1062,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); } @@ -1151,7 +1151,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); } @@ -1531,7 +1531,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; @@ -1542,7 +1542,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; } @@ -1557,7 +1557,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; } @@ -1656,11 +1656,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; } diff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h index 58fdd3d45..ca9852bd7 100644 --- a/drivers/net/virtio/virtio_pci.h +++ b/drivers/net/virtio/virtio_pci.h @@ -244,7 +244,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; @@ -286,7 +286,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 dc8cb4808..ce91c59f2 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -924,7 +924,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); @@ -1035,7 +1035,7 @@ virtio_recv_mergeable_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); @@ -1229,7 +1229,7 @@ virtio_recv_mergeable_pkts(void *rx_queue, rxm = rcv_pkts[0]; - if (unlikely(len[0] < hdr_size + ETHER_HDR_LEN)) { + if (unlikely(len[0] < 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 a3faf1d0c..ccfbea82c 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c @@ -128,7 +128,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 a185aed34..6347e84b6 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -202,15 +202,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 d6e0e137b..e6cbf6572 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -36,7 +36,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]; struct vring vrings[VIRTIO_MAX_VIRTQUEUES]; struct virtio_user_backend_ops *ops; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 525d16cab..52c7a8529 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -120,8 +120,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; } @@ -181,8 +181,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 26518ed98..381fa3c0d 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -109,7 +109,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 96e941490..46ba28f40 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 2e67aa516..b5b66ebed 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 = { @@ -289,13 +289,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; @@ -357,12 +357,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); @@ -385,7 +385,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); @@ -460,19 +460,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 5a2bbec4b..fafbe7eb5 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -79,7 +79,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 ee65b3ef2..25ad1eaae 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 9c77f214f..8d075cb69 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 b223912c6..f92b24912 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -52,8 +52,8 @@ * 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 /* * Default payload in bytes for the IPv6 packet. @@ -347,9 +347,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; @@ -562,8 +562,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); } @@ -667,9 +667,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 7e5ff0543..906a5e4b3 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 caad010e1..e3e61391e 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -195,7 +195,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, }, @@ -235,8 +235,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; @@ -244,8 +244,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) t->ip4.data[t->ip4.num] = nlp; t->ip4.pkts[(t->ip4.num)++] = pkt; } - } 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; @@ -322,21 +322,21 @@ 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 |= PKT_TX_IP_CKSUM | PKT_TX_IPV4; pkt->l3_len = sizeof(struct ip); - pkt->l2_len = ETHER_HDR_LEN; + pkt->l2_len = RTE_ETHER_HDR_LEN; ip->ip_sum = 0; - 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 |= PKT_TX_IPV6; 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, @@ -1178,8 +1178,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 b74971dc2..0c9c3a749 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -289,7 +289,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; @@ -547,8 +547,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 8c326153e..b8690335c 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -696,7 +696,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; @@ -766,8 +766,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 bde1bf3cd..787ce3fdb 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -211,7 +211,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 = { @@ -392,7 +392,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 283aa8cf4..d9b752d80 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -178,7 +178,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, }, @@ -582,9 +582,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; @@ -1312,7 +1312,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)) { @@ -1357,8 +1357,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 568a2b232..b2865c9c2 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -707,7 +707,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. */ @@ -871,7 +871,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); } @@ -961,7 +961,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/main.c b/examples/vm_power_manager/main.c index cfbb99189..253a7c84b 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_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c index c9cf33f19..6ad08737a 100644 --- a/lib/librte_cmdline/cmdline_parse_etheraddr.c +++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c @@ -29,14 +29,13 @@ struct cmdline_token_ops cmdline_token_etheraddr_ops = { /* the format can be either XX:XX:XX:XX:XX:XX or XXXX:XXXX:XXXX */ #define ETHER_ADDRSTRLENLONG 18 #define ETHER_ADDRSTRLENSHORT 15 -#define ETHER_ADDR_LEN 6 static struct rte_ether_addr * 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; @@ -53,14 +52,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/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index c552a20bd..c150e5dc8 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -321,7 +321,7 @@ rte_eth_dev_allocate(const char *name) eth_dev = eth_dev_get(port_id); snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", 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); @@ -1126,19 +1126,19 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, port_id, dev_conf->rxmode.max_rx_pkt_len, dev_info.max_rx_pktlen); return -EINVAL; - } 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); return -EINVAL; } } 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 */ @@ -2952,7 +2952,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; @@ -3086,7 +3086,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_flow.h b/lib/librte_ethdev/rte_flow.h index 89e5e2278..6887741cf 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -597,7 +597,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 { @@ -761,7 +761,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 { /** @@ -2036,7 +2036,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 168786079..d06af0e75 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 251698e87..2df230a0b 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); snprintf(dev_info.name, RTE_KNI_NAMESIZE, "%s", conf->name); diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h index 601abdfc6..ce86b19a2 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 cf6cbf431..f279cf33c 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -23,25 +23,25 @@ extern "C" { #include <rte_mbuf.h> #include <rte_byteorder.h> -#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,19 +295,19 @@ 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 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_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) +#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 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_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -323,15 +323,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. */ @@ -352,7 +352,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); @@ -361,7 +361,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; } @@ -400,8 +400,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 75fb66616..d7d94791f 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -154,16 +154,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; @@ -248,10 +248,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; @@ -262,7 +262,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; @@ -280,7 +280,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; @@ -303,7 +303,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; @@ -372,7 +372,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; @@ -382,7 +382,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; @@ -394,7 +394,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; @@ -412,7 +412,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; @@ -435,7 +435,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 3cd1fd521..453494294 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, @@ -746,13 +746,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; @@ -785,7 +785,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; @@ -820,13 +820,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) | @@ -859,7 +859,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 4ff9b66cd..e62fdf228 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); diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index 2ef5d15a5..feee9e121 100644 --- a/test/test/packet_burst_generator.c +++ b/test/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/test/test/test_cmdline_etheraddr.c b/test/test/test_cmdline_etheraddr.c index 8e524e582..76574fedc 100644 --- a/test/test/test_cmdline_etheraddr.c +++ b/test/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/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index f81bbba3a..3f06f3005 100644 --- a/test/test/test_flow_classify.c +++ b/test/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/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index 00ddb0efe..2490d5dd2 100644 --- a/test/test/test_link_bonding.c +++ b/test/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/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index f5ac6c99f..6295b1874 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/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/test/test/test_link_bonding_rssconf.c b/test/test/test_link_bonding_rssconf.c index 4392522ea..65de3b98d 100644 --- a/test/test/test_link_bonding_rssconf.c +++ b/test/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/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index 3660efff4..c5515cc5c 100644 --- a/test/test/test_pmd_perf.c +++ b/test/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/test/test/test_sched.c b/test/test/test_sched.c index 3cbf5844e..f02e50882 100644 --- a/test/test/test_sched.c +++ b/test/test/test_sched.c @@ -91,7 +91,7 @@ prepare_pkt(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/test/test/virtual_pmd.c b/test/test/virtual_pmd.c index 15ce64445..55c2bdb98 100644 --- a/test/test/virtual_pmd.c +++ b/test/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; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 06/14] net: add rte prefix to esp structure 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (4 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 05/14] net: add rte prefix to ether defines Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 07/14] net: add rte prefix to gre structure Olivier Matz ` (14 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct esp_hdr as struct rte_esp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- examples/ipsec-secgw/esp.c | 42 +++++++++++++++++++++--------------------- examples/ipsec-secgw/sa.c | 6 +++--- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_esp.h | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c index e33232c98..da031a3c9 100644 --- a/examples/ipsec-secgw/esp.c +++ b/examples/ipsec-secgw/esp.c @@ -49,7 +49,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, } payload_len = rte_pktmbuf_pkt_len(m) - ip_hdr_len - - sizeof(struct esp_hdr) - sa->iv_len - sa->digest_len; + sizeof(struct rte_esp_hdr) - sa->iv_len - sa->digest_len; if ((payload_len & (sa->block_size - 1)) || (payload_len <= 0)) { RTE_LOG_DP(DEBUG, IPSEC_ESP, "payload %d not multiple of %u\n", @@ -61,13 +61,13 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->m_src = m; if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) { - sym_cop->aead.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + + sym_cop->aead.data.offset = ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->aead.data.length = payload_len; struct cnt_blk *icb; uint8_t *aad; - uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct esp_hdr)); + uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct rte_esp_hdr)); icb = get_cnt_blk(m); icb->salt = sa->salt; @@ -75,7 +75,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, icb->cnt = rte_cpu_to_be_32(1); aad = get_aad(m); - memcpy(aad, iv - sizeof(struct esp_hdr), 8); + memcpy(aad, iv - sizeof(struct rte_esp_hdr), 8); sym_cop->aead.aad.data = aad; sym_cop->aead.aad.phys_addr = rte_pktmbuf_iova_offset(m, aad - rte_pktmbuf_mtod(m, uint8_t *)); @@ -85,12 +85,12 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->aead.digest.phys_addr = rte_pktmbuf_iova_offset(m, rte_pktmbuf_pkt_len(m) - sa->digest_len); } else { - sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + + sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = payload_len; struct cnt_blk *icb; - uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct esp_hdr)); + uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct rte_esp_hdr)); uint8_t *iv_ptr = rte_crypto_op_ctod_offset(cop, uint8_t *, IV_OFFSET); @@ -118,7 +118,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_AUTH_SHA1_HMAC: case RTE_CRYPTO_AUTH_SHA256_HMAC: sym_cop->auth.data.offset = ip_hdr_len; - sym_cop->auth.data.length = sizeof(struct esp_hdr) + + sym_cop->auth.data.length = sizeof(struct rte_esp_hdr) + sa->iv_len + payload_len; break; default: @@ -192,7 +192,7 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, if (unlikely(sa->flags == TRANSPORT)) { ip = rte_pktmbuf_mtod(m, struct ip *); ip4 = (struct ip *)rte_pktmbuf_adj(m, - sizeof(struct esp_hdr) + sa->iv_len); + sizeof(struct rte_esp_hdr) + sa->iv_len); if (likely(ip->ip_v == IPVERSION)) { memmove(ip4, ip, ip->ip_hl * 4); ip4->ip_p = *nexthdr; @@ -206,7 +206,7 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, sizeof(struct ip6_hdr)); } } else - ipip_inbound(m, sizeof(struct esp_hdr) + sa->iv_len); + ipip_inbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len); return 0; } @@ -217,7 +217,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, { struct ip *ip4; struct ip6_hdr *ip6; - struct esp_hdr *esp = NULL; + struct rte_esp_hdr *esp = NULL; uint8_t *padding = NULL, *new_ip, nlp; struct rte_crypto_sym_op *sym_cop; int32_t i; @@ -268,7 +268,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, } /* Check maximum packet size */ - if (unlikely(ip_hdr_len + sizeof(struct esp_hdr) + sa->iv_len + + if (unlikely(ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len + pad_payload_len + sa->digest_len > IP_MAXPACKET)) { RTE_LOG(ERR, IPSEC_ESP, "ipsec packet is too big\n"); return -EINVAL; @@ -290,20 +290,20 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, switch (sa->flags) { case IP4_TUNNEL: - ip4 = ip4ip_outbound(m, sizeof(struct esp_hdr) + sa->iv_len, + ip4 = ip4ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, &sa->src, &sa->dst); - esp = (struct esp_hdr *)(ip4 + 1); + esp = (struct rte_esp_hdr *)(ip4 + 1); break; case IP6_TUNNEL: - ip6 = ip6ip_outbound(m, sizeof(struct esp_hdr) + sa->iv_len, + ip6 = ip6ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, &sa->src, &sa->dst); - esp = (struct esp_hdr *)(ip6 + 1); + esp = (struct rte_esp_hdr *)(ip6 + 1); break; case TRANSPORT: new_ip = (uint8_t *)rte_pktmbuf_prepend(m, - sizeof(struct esp_hdr) + sa->iv_len); + sizeof(struct rte_esp_hdr) + sa->iv_len); memmove(new_ip, ip4, ip_hdr_len); - esp = (struct esp_hdr *)(new_ip + ip_hdr_len); + esp = (struct rte_esp_hdr *)(new_ip + ip_hdr_len); ip4 = (struct ip *)new_ip; if (likely(ip4->ip_v == IPVERSION)) { ip4->ip_p = IPPROTO_ESP; @@ -362,7 +362,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, uint8_t *aad; sym_cop->aead.data.offset = ip_hdr_len + - sizeof(struct esp_hdr) + sa->iv_len; + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->aead.data.length = pad_payload_len; /* Fill pad_len using default sequential scheme */ @@ -392,12 +392,12 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_CIPHER_3DES_CBC: case RTE_CRYPTO_CIPHER_AES_CBC: sym_cop->cipher.data.offset = ip_hdr_len + - sizeof(struct esp_hdr); + sizeof(struct rte_esp_hdr); sym_cop->cipher.data.length = pad_payload_len + sa->iv_len; break; case RTE_CRYPTO_CIPHER_AES_CTR: sym_cop->cipher.data.offset = ip_hdr_len + - sizeof(struct esp_hdr) + sa->iv_len; + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = pad_payload_len; break; default: @@ -422,7 +422,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_AUTH_SHA1_HMAC: case RTE_CRYPTO_AUTH_SHA256_HMAC: sym_cop->auth.data.offset = ip_hdr_len; - sym_cop->auth.data.length = sizeof(struct esp_hdr) + + sym_cop->auth.data.length = sizeof(struct rte_esp_hdr) + sa->iv_len + pad_payload_len; break; default: diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index d2d3550a4..cb021efa6 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -957,7 +957,7 @@ static inline void single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, struct ipsec_sa **sa_ret) { - struct esp_hdr *esp; + struct rte_esp_hdr *esp; struct ip *ip; uint32_t *src4_addr; uint8_t *src6_addr; @@ -967,9 +967,9 @@ single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, ip = rte_pktmbuf_mtod(pkt, struct ip *); if (ip->ip_v == IPVERSION) - esp = (struct esp_hdr *)(ip + 1); + esp = (struct rte_esp_hdr *)(ip + 1); else - esp = (struct esp_hdr *)(((struct ip6_hdr *)ip) + 1); + esp = (struct rte_esp_hdr *)(((struct ip6_hdr *)ip) + 1); if (esp->spi == INVALID_SPI) return; diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 6887741cf..c2cdc8c08 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -908,7 +908,7 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { * Matches an ESP header. */ struct rte_flow_item_esp { - struct esp_hdr hdr; /**< ESP header definition. */ + struct rte_esp_hdr hdr; /**< ESP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */ diff --git a/lib/librte_net/rte_esp.h b/lib/librte_net/rte_esp.h index f77ec2eb2..034c113ff 100644 --- a/lib/librte_net/rte_esp.h +++ b/lib/librte_net/rte_esp.h @@ -20,7 +20,7 @@ extern "C" { /** * ESP Header */ -struct esp_hdr { +struct rte_esp_hdr { rte_be32_t spi; /**< Security Parameters Index */ rte_be32_t seq; /**< packet sequence number */ } __attribute__((__packed__)); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 07/14] net: add rte prefix to gre structure 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (5 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 06/14] net: add rte prefix to esp structure Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 08/14] net: add rte prefix to icmp structure Olivier Matz ` (13 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct gre_hdr as struct rte_gre_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- lib/librte_net/rte_gre.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/librte_net/rte_gre.h b/lib/librte_net/rte_gre.h index 69499bb82..0a09543ea 100644 --- a/lib/librte_net/rte_gre.h +++ b/lib/librte_net/rte_gre.h @@ -15,7 +15,7 @@ extern "C" { /** * GRE Header */ -struct gre_hdr { +struct rte_gre_hdr { #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint16_t res2:4; /**< Reserved */ uint16_t s:1; /**< Sequence Number Present bit */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index d7d94791f..3ad16f0c4 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -139,8 +139,8 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, [0xa] = 12, [0xb] = 16, }; - const struct gre_hdr *gh; - struct gre_hdr gh_copy; + const struct rte_gre_hdr *gh; + struct rte_gre_hdr gh_copy; uint16_t flags; gh = rte_pktmbuf_read(m, *off, sizeof(*gh), &gh_copy); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 08/14] net: add rte prefix to icmp structure 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (6 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 07/14] net: add rte prefix to gre structure Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 09/14] net: add rte prefix to icmp defines Olivier Matz ` (12 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct icmp_hdr as struct rte_icmp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_icmp.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index e778de438..33b9e2ffd 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -279,7 +279,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; - struct icmp_hdr *icmp_h; + struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; @@ -425,7 +425,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* * Check if packet is a ICMP echo request. */ - icmp_h = (struct icmp_hdr *) ((char *)ip_h + + icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + sizeof(struct ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index c2cdc8c08..ee2d116dc 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -666,7 +666,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { * Matches an ICMP header. */ struct rte_flow_item_icmp { - struct icmp_hdr hdr; /**< ICMP header definition. */ + struct rte_icmp_hdr hdr; /**< ICMP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */ diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h index 053b5f6a4..d0309537e 100644 --- a/lib/librte_net/rte_icmp.h +++ b/lib/librte_net/rte_icmp.h @@ -23,7 +23,7 @@ extern "C" { /** * ICMP Header */ -struct icmp_hdr { +struct rte_icmp_hdr { uint8_t icmp_type; /* ICMP packet type. */ uint8_t icmp_code; /* ICMP packet code. */ uint16_t icmp_cksum; /* ICMP packet checksum. */ -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 09/14] net: add rte prefix to icmp defines 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (7 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 08/14] net: add rte prefix to icmp structure Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 10/14] net: add rte prefix to ip structure Olivier Matz ` (11 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'RTE_' prefix to defines: - rename IP_ICMP_ECHO_REPLY as RTE_IP_ICMP_ECHO_REPLY. - rename IP_ICMP_ECHO_REQUEST as RTE_IP_ICMP_ECHO_REQUEST. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 10 +++++----- lib/librte_net/rte_icmp.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 33b9e2ffd..4bf3fed64 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -428,7 +428,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + sizeof(struct ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && - (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && + (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { rte_pktmbuf_free(pkt); continue; @@ -452,7 +452,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * - switch the request IP source and destination * addresses in the reply IP header, * - keep the IP header checksum unchanged. - * - set IP_ICMP_ECHO_REPLY in ICMP header. + * - set RTE_IP_ICMP_ECHO_REPLY in ICMP header. * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ @@ -475,10 +475,10 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ip_h->src_addr = ip_h->dst_addr; ip_h->dst_addr = ip_addr; } - icmp_h->icmp_type = IP_ICMP_ECHO_REPLY; + icmp_h->icmp_type = RTE_IP_ICMP_ECHO_REPLY; cksum = ~icmp_h->icmp_cksum & 0xffff; - cksum += ~htons(IP_ICMP_ECHO_REQUEST << 8) & 0xffff; - cksum += htons(IP_ICMP_ECHO_REPLY << 8); + cksum += ~htons(RTE_IP_ICMP_ECHO_REQUEST << 8) & 0xffff; + cksum += htons(RTE_IP_ICMP_ECHO_REPLY << 8); cksum = (cksum & 0xffff) + (cksum >> 16); cksum = (cksum & 0xffff) + (cksum >> 16); icmp_h->icmp_cksum = ~cksum; diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h index d0309537e..3f8100a5f 100644 --- a/lib/librte_net/rte_icmp.h +++ b/lib/librte_net/rte_icmp.h @@ -32,8 +32,8 @@ struct rte_icmp_hdr { } __attribute__((__packed__)); /* ICMP packet types */ -#define IP_ICMP_ECHO_REPLY 0 -#define IP_ICMP_ECHO_REQUEST 8 +#define RTE_IP_ICMP_ECHO_REPLY 0 +#define RTE_IP_ICMP_ECHO_REQUEST 8 #ifdef __cplusplus } -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 10/14] net: add rte prefix to ip structure 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (8 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 09/14] net: add rte prefix to icmp defines Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 11/14] net: add rte prefix to ip defines Olivier Matz ` (10 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct ipv4_hdr as struct rte_ipv4_hdr. - rename struct ipv6_hdr as struct rte_ipv6_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 40 ++++---- app/test-pmd/flowgen.c | 6 +- app/test-pmd/icmpecho.c | 8 +- app/test-pmd/macfwd.c | 2 +- app/test-pmd/macswap.c | 2 +- app/test-pmd/txonly.c | 12 +-- app/test-pmd/util.c | 12 +-- .../prog_guide/packet_classif_access_ctrl.rst | 12 +-- doc/guides/sample_app_ug/flow_classify.rst | 10 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- doc/guides/sample_app_ug/l3_forward.rst | 12 +-- doc/guides/sample_app_ug/server_node_efd.rst | 8 +- drivers/net/bonding/rte_eth_bond_pmd.c | 16 +-- drivers/net/dpaa/dpaa_rxtx.c | 8 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/ena/ena_ethdev.c | 4 +- drivers/net/enic/enic_clsf.c | 16 +-- drivers/net/enic/enic_flow.c | 26 ++--- drivers/net/i40e/i40e_fdir.c | 36 +++---- drivers/net/mlx5/mlx5_flow.c | 6 +- drivers/net/mlx5/mlx5_flow_tcf.c | 12 +-- drivers/net/mvpp2/mrvl_flow.c | 2 +- drivers/net/qede/qede_filter.c | 14 +-- drivers/net/qede/qede_rxtx.c | 12 +-- drivers/net/sfc/sfc_ef10_tx.c | 4 +- drivers/net/sfc/sfc_tso.c | 4 +- drivers/net/softnic/rte_eth_softnic_pipeline.c | 32 +++--- drivers/net/tap/rte_eth_tap.c | 8 +- drivers/net/virtio/virtio_rxtx.c | 8 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 18 ++-- examples/bond/main.c | 4 +- examples/flow_classify/flow_classify.c | 10 +- examples/ip_fragmentation/main.c | 12 +-- examples/ip_pipeline/pipeline.c | 32 +++--- examples/ip_reassembly/main.c | 12 +-- examples/ipv4_multicast/main.c | 4 +- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 80 +++++++-------- examples/l3fwd-power/main.c | 28 +++--- examples/l3fwd-vf/main.c | 18 ++-- examples/l3fwd/l3fwd.h | 6 +- examples/l3fwd/l3fwd_altivec.h | 10 +- examples/l3fwd/l3fwd_common.h | 4 +- examples/l3fwd/l3fwd_em.c | 14 +-- examples/l3fwd/l3fwd_em.h | 8 +- examples/l3fwd/l3fwd_em_hlm.h | 8 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 8 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 8 +- examples/l3fwd/l3fwd_em_sequential.h | 8 +- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/l3fwd/l3fwd_lpm.h | 8 +- examples/l3fwd/l3fwd_lpm_altivec.h | 10 +- examples/l3fwd/l3fwd_lpm_neon.h | 10 +- examples/l3fwd/l3fwd_lpm_sse.h | 10 +- examples/l3fwd/l3fwd_neon.h | 10 +- examples/l3fwd/l3fwd_sse.h | 10 +- examples/load_balancer/runtime.c | 4 +- examples/performance-thread/l3fwd-thread/main.c | 110 ++++++++++----------- examples/server_node_efd/node/node.c | 4 +- examples/server_node_efd/server/main.c | 4 +- examples/tep_termination/vxlan.c | 32 +++--- examples/tep_termination/vxlan.h | 2 +- examples/tep_termination/vxlan_setup.c | 4 +- examples/vhost/main.c | 2 +- lib/librte_ethdev/rte_flow.h | 4 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 16 +-- lib/librte_gro/gro_tcp4.c | 8 +- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 12 +-- lib/librte_gso/gso_common.h | 4 +- lib/librte_gso/gso_tcp4.c | 8 +- lib/librte_gso/gso_tunnel_tcp4.c | 10 +- lib/librte_gso/gso_udp4.c | 8 +- lib/librte_gso/rte_gso.h | 4 +- lib/librte_hash/rte_thash.h | 2 +- lib/librte_ip_frag/rte_ip_frag.h | 8 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 26 ++--- lib/librte_ip_frag/rte_ipv4_reassembly.c | 6 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 ++--- lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- lib/librte_net/rte_ip.h | 20 ++-- lib/librte_net/rte_net.c | 18 ++-- lib/librte_net/rte_net.h | 10 +- lib/librte_pipeline/rte_table_action.c | 50 +++++----- lib/librte_port/rte_port_ras.c | 4 +- lib/librte_vhost/virtio_net.c | 10 +- test/test-pipeline/pipeline_acl.c | 10 +- test/test-pipeline/pipeline_hash.c | 8 +- test/test/packet_burst_generator.c | 44 ++++----- test/test/packet_burst_generator.h | 6 +- test/test/test_flow_classify.c | 16 +-- test/test/test_link_bonding.c | 8 +- test/test/test_link_bonding_mode4.c | 4 +- test/test/test_pmd_perf.c | 2 +- test/test/test_sched.c | 4 +- test/test/test_thash.c | 2 +- 96 files changed, 618 insertions(+), 618 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index f52608056..23f16bab3 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -100,7 +100,7 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) /* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) +parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; @@ -117,11 +117,11 @@ parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) /* Parse an IPv6 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) +parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ @@ -140,8 +140,8 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) static void parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; @@ -155,11 +155,11 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) switch (info->ethertype) { case _htons(RTE_ETHER_TYPE_IPv4): - ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv4(ipv4_hdr, info); break; case _htons(RTE_ETHER_TYPE_IPv6): - ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len); + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv6(ipv6_hdr, info); break; default: @@ -205,8 +205,8 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); @@ -225,7 +225,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)vxlan_gpe_hdr + + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ipv4(ipv4_hdr, info); @@ -239,7 +239,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)vxlan_gpe_hdr + + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); @@ -268,8 +268,8 @@ static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; gre_len += sizeof(struct simple_gre_hdr); @@ -288,7 +288,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)gre_hdr + gre_len); parse_ipv4(ipv4_hdr, info); info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); @@ -301,7 +301,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len); + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)gre_hdr + gre_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); @@ -328,8 +328,8 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) static void parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr = encap_ip; - struct ipv6_hdr *ipv6_hdr = encap_ip; + struct rte_ipv4_hdr *ipv4_hdr = encap_ip; + struct rte_ipv6_hdr *ipv6_hdr = encap_ip; uint8_t ip_version; ip_version = (ipv4_hdr->version_ihl & 0xf0) >> 4; @@ -358,7 +358,7 @@ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { - struct ipv4_hdr *ipv4_hdr = l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -449,8 +449,8 @@ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, uint64_t tx_offloads, int tso_enabled) { - struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; - struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; struct udp_hdr *udp_hdr; uint64_t ol_flags = 0; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 47fb011a1..e62601541 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -120,7 +120,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mempool *mbp; struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags; @@ -176,7 +176,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); /* Initialize IP header. */ - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); memset(ip_hdr, 0, sizeof(*ip_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -206,7 +206,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkts_burst[nb_pkt] = pkt; next_flow = (next_flow + 1) % cfg_n_flows; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 4bf3fed64..146293175 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -243,7 +243,7 @@ ipv4_addr_dump(const char *what, uint32_t be_ipv4_addr) } static uint16_t -ipv4_hdr_cksum(struct ipv4_hdr *ip_h) +ipv4_hdr_cksum(struct rte_ipv4_hdr *ip_h) { uint16_t *v16_h; uint32_t ip_cksum; @@ -278,7 +278,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_ether_hdr *eth_h; struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; - struct ipv4_hdr *ip_h; + struct rte_ipv4_hdr *ip_h; struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; @@ -413,7 +413,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_pktmbuf_free(pkt); continue; } - ip_h = (struct ipv4_hdr *) ((char *)eth_h + l2_len); + ip_h = (struct rte_ipv4_hdr *) ((char *)eth_h + l2_len); if (verbose_level > 0) { ipv4_addr_dump(" IPV4: src=", ip_h->src_addr); ipv4_addr_dump(" dst=", ip_h->dst_addr); @@ -426,7 +426,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * Check if packet is a ICMP echo request. */ icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f15149252..d2ebb1105 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -99,7 +99,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; } diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 4c57a2a56..0ee1cec23 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -130,7 +130,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; } diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index ae094ab94..5d76e471e 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -51,7 +51,7 @@ #define IP_HDRLEN 0x05 /* default IP header length == five 32-bits words. */ #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) -static struct ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ +static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ static void @@ -92,7 +92,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } static void -setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, +setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, struct udp_hdr *udp_hdr, uint16_t pkt_data_len) { @@ -112,7 +112,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; ip_hdr->fragment_offset = 0; @@ -239,7 +239,7 @@ pkt_burst_transmit(struct fwd_stream *fs) sizeof(struct rte_ether_hdr)); copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); /* * Complete first mbuf of packet and append it to the @@ -251,7 +251,7 @@ pkt_burst_transmit(struct fwd_stream *fs) pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkts_burst[nb_pkt] = pkt; } nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pkt); @@ -297,7 +297,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) uint16_t pkt_data_len; pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 312707430..fe8b18bd3 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -102,8 +102,8 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (sw_packet_type & RTE_PTYPE_INNER_L4_MASK) printf(" - inner_l4_len=%d", hdr_lens.inner_l4_len); if (is_encapsulation) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; @@ -115,15 +115,15 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { - l3_len = sizeof(struct ipv4_hdr); + l3_len = sizeof(struct rte_ipv4_hdr); ipv4_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, l2_len); l4_proto = ipv4_hdr->next_proto_id; } else { - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); ipv6_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv6_hdr *, + struct rte_ipv6_hdr *, l2_len); l4_proto = ipv6_hdr->proto; } diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 395b3ec47..6887e4dc6 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -154,7 +154,7 @@ To define classification for the IPv6 2-tuple: <protocol, IPv6 source address> o .. code-block:: c - struct struct ipv6_hdr { + struct struct rte_ipv6_hdr { uint32_t vtc_flow; /* IP version, traffic class & flow label. */ uint16_t payload_len; /* IP packet length - includes sizeof(ip_header). */ uint8_t proto; /* Protocol, next header. */ @@ -173,7 +173,7 @@ The following array of field definitions can be used: .size = sizeof (uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof (struct ipv6_hdr, proto), + .offset = offsetof (struct rte_ipv6_hdr, proto), }, { @@ -181,7 +181,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof (struct ipv6_hdr, src_addr[0]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[0]), }, { @@ -189,7 +189,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof (struct ipv6_hdr, src_addr[4]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[4]), }, { @@ -197,7 +197,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof (struct ipv6_hdr, src_addr[8]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[8]), }, { @@ -205,7 +205,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof (struct ipv6_hdr, src_addr[12]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[12]), }, }; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index e028f4559..8172a96c4 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -92,7 +92,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -102,7 +102,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -112,7 +112,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -125,7 +125,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -135,7 +135,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 97bd756a2..0d89be96e 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index 58c4aae92..bf6c5ea52 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -242,7 +242,7 @@ The get_ipv4_dst_port() function is shown below: int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); m128i data = _mm_loadu_si128(( m128i*)(ipv4_hdr)); @@ -270,10 +270,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -306,7 +306,7 @@ for LPM-based lookups is done by the get_ipv4_dst_port() function below: .. code-block:: c static inline uint16_t - get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) + get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint8_t next_hop; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index f7dab9e98..12208f425 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -191,12 +191,12 @@ which tells the node where the packet has to be distributed. efd_value_t data[EFD_BURST_MAX]; const void *key_ptrs[EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; @@ -348,7 +348,7 @@ flow is not handled by the node. static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -356,7 +356,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 46757cf79..2aa94d7c2 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -587,7 +587,7 @@ static void mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_h, uint16_t port, uint32_t __attribute__((unused)) *burstnumber) { - struct ipv4_hdr *ipv4_h; + struct rte_ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB struct rte_arp_hdr *arp_h; char dst_ip[16]; @@ -604,7 +604,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_ #endif if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset); + ipv4_h = (struct rte_ipv4_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String); #ifdef RTE_LIBRTE_BOND_DEBUG_ALB ipv4_addr_to_dot(ipv4_h->dst_addr, dst_ip, MaxIPv4String); @@ -750,13 +750,13 @@ ether_hash(struct rte_ether_hdr *eth_hdr) } static inline uint32_t -ipv4_hash(struct ipv4_hdr *ipv4_hdr) +ipv4_hash(struct rte_ipv4_hdr *ipv4_hdr) { return ipv4_hdr->src_addr ^ ipv4_hdr->dst_addr; } static inline uint32_t -ipv6_hash(struct ipv6_hdr *ipv6_hdr) +ipv6_hash(struct rte_ipv6_hdr *ipv6_hdr) { unaligned_uint32_t *word_src_addr = (unaligned_uint32_t *)&(ipv6_hdr->src_addr[0]); @@ -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(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv4_hash(ipv4_hdr); } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_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, l4hash = 0; if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_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, } } } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index a51469373..9aa31ad42 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -200,22 +200,22 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; DPAA_DP_LOG(DEBUG, "Calculating checksum for mbuf: %p", mbuf); if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4_EXT)) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; ipv4_hdr->hdr_checksum = 0; ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } else if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6_EXT)) - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 6de335fb6..84c0c537b 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -220,7 +220,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, /* setup IPCS* fields */ ctx.lower_setup.ip_fields.ipcss = (uint8_t)l2len; ctx.lower_setup.ip_fields.ipcso = (uint8_t)(l2len + - offsetof(struct ipv4_hdr, hdr_checksum)); + offsetof(struct rte_ipv4_hdr, hdr_checksum)); /* * When doing checksum or TCP segmentation with IPv6 headers, diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 7bf8dd44c..6cf4259fe 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1949,7 +1949,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint32_t i; struct rte_mbuf *m; struct ena_ring *tx_ring = (struct ena_ring *)(tx_queue); - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint64_t ol_flags; uint16_t frag_field; @@ -1966,7 +1966,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (unlikely(m->l2_len == 0)) m->l2_len = sizeof(struct rte_ether_hdr); - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 9d95201ec..ddfa52776 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -176,9 +176,9 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) { - struct ipv4_hdr ip4_mask, ip4_val; - memset(&ip4_mask, 0, sizeof(struct ipv4_hdr)); - memset(&ip4_val, 0, sizeof(struct ipv4_hdr)); + struct rte_ipv4_hdr ip4_mask, ip4_val; + memset(&ip4_mask, 0, sizeof(struct rte_ipv4_hdr)); + memset(&ip4_val, 0, sizeof(struct rte_ipv4_hdr)); if (input->flow.ip4_flow.tos) { ip4_mask.type_of_service = masks->ipv4_mask.tos; @@ -202,7 +202,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV4, FILTER_GENERIC_1_L3, - &ip4_mask, &ip4_val, sizeof(struct ipv4_hdr)); + &ip4_mask, &ip4_val, sizeof(struct rte_ipv4_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { @@ -264,9 +264,9 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) { - struct ipv6_hdr ipv6_mask, ipv6_val; - memset(&ipv6_mask, 0, sizeof(struct ipv6_hdr)); - memset(&ipv6_val, 0, sizeof(struct ipv6_hdr)); + struct rte_ipv6_hdr ipv6_mask, ipv6_val; + memset(&ipv6_mask, 0, sizeof(struct rte_ipv6_hdr)); + memset(&ipv6_val, 0, sizeof(struct rte_ipv6_hdr)); if (input->flow.ipv6_flow.proto) { ipv6_mask.proto = masks->ipv6_mask.proto; @@ -290,7 +290,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV6, FILTER_GENERIC_1_L3, - &ipv6_mask, &ipv6_val, sizeof(struct ipv6_hdr)); + &ipv6_mask, &ipv6_val, sizeof(struct rte_ipv6_hdr)); } } diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index c964a5e78..ede89c8f8 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -347,7 +347,7 @@ enic_copy_item_ipv4_v1(const struct rte_flow_item *item, const struct rte_flow_item_ipv4 *spec = item->spec; const struct rte_flow_item_ipv4 *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct ipv4_hdr supported_mask = { + struct rte_ipv4_hdr supported_mask = { .src_addr = 0xffffffff, .dst_addr = 0xffffffff, }; @@ -635,19 +635,19 @@ enic_copy_item_ipv4_v2(const struct rte_flow_item *item, mask = &rte_flow_item_ipv4_mask; memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); } else { /* Inner IPv4 header. Mask/Val start at *inner_ofst into L5 */ - if ((*inner_ofst + sizeof(struct ipv4_hdr)) > + if ((*inner_ofst + sizeof(struct rte_ipv4_hdr)) > FILTER_GENERIC_1_KEY_LEN) return ENOTSUP; memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst], - mask, sizeof(struct ipv4_hdr)); + mask, sizeof(struct rte_ipv4_hdr)); memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst], - spec, sizeof(struct ipv4_hdr)); - *inner_ofst += sizeof(struct ipv4_hdr); + spec, sizeof(struct rte_ipv4_hdr)); + *inner_ofst += sizeof(struct rte_ipv4_hdr); } return 0; } @@ -685,19 +685,19 @@ enic_copy_item_ipv6_v2(const struct rte_flow_item *item, if (*inner_ofst == 0) { memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); } else { /* Inner IPv6 header. Mask/Val start at *inner_ofst into L5 */ - if ((*inner_ofst + sizeof(struct ipv6_hdr)) > + if ((*inner_ofst + sizeof(struct rte_ipv6_hdr)) > FILTER_GENERIC_1_KEY_LEN) return ENOTSUP; memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst], - mask, sizeof(struct ipv6_hdr)); + mask, sizeof(struct rte_ipv6_hdr)); memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst], - spec, sizeof(struct ipv6_hdr)); - *inner_ofst += sizeof(struct ipv6_hdr); + spec, sizeof(struct rte_ipv6_hdr)); + *inner_ofst += sizeof(struct rte_ipv6_hdr); } return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4aaf27f7c..b20f30fb4 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -686,8 +686,8 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; static const uint8_t next_proto[] = { [RTE_ETH_FLOW_FRAG_IPV4] = IPPROTO_IP, [RTE_ETH_FLOW_NONFRAG_IPV4_TCP] = IPPROTO_TCP, @@ -723,7 +723,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: case RTE_ETH_FLOW_FRAG_IPV4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -743,14 +743,14 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, */ ip->src_addr = fdir_input->flow.ip4_flow.dst_ip; ip->dst_addr = fdir_input->flow.ip4_flow.src_ip; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: case RTE_ETH_FLOW_FRAG_IPV6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -776,7 +776,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, rte_memcpy(&(ip6->dst_addr), &(fdir_input->flow.ipv6_flow.src_ip), IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); break; default: PMD_DRV_LOG(ERR, "unknown flow type %u.", @@ -960,8 +960,8 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; bool is_customized_pctype = fdir_input->flow_ext.customized_pctype; static const uint8_t next_proto[] = { @@ -1007,7 +1007,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, pctype == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV4 || is_customized_pctype) { - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -1034,13 +1034,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) ip->next_proto_id = IPPROTO_UDP; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV6) { - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -1066,7 +1066,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); } else { PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype); @@ -1093,8 +1093,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, struct tcp_hdr *tcp; struct sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; - struct ipv4_hdr *gtp_ipv4; - struct ipv6_hdr *gtp_ipv6; + struct rte_ipv4_hdr *gtp_ipv4; + struct rte_ipv6_hdr *gtp_ipv6; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -1232,7 +1232,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv4 = (struct ipv4_hdr *) + gtp_ipv4 = (struct rte_ipv4_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv4->version_ihl = @@ -1242,11 +1242,11 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, rte_cpu_to_be_16( I40E_FDIR_INNER_IP_DEFAULT_LEN); payload = (unsigned char *)gtp_ipv4 + - sizeof(struct ipv4_hdr); + sizeof(struct rte_ipv4_hdr); } else if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv6 = (struct ipv6_hdr *) + gtp_ipv6 = (struct rte_ipv6_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv6->vtc_flow = @@ -1260,7 +1260,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, gtp_ipv6->hop_limits = I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS; payload = (unsigned char *)gtp_ipv6 + - sizeof(struct ipv6_hdr); + sizeof(struct rte_ipv6_hdr); } else payload = (unsigned char *)gtp + sizeof(struct rte_flow_item_gtp); diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index bd70fce24..d99e2c526 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2494,13 +2494,13 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: - attributes->l3.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = input->flow.ip4_flow.src_ip, .dst_addr = input->flow.ip4_flow.dst_ip, .time_to_live = input->flow.ip4_flow.ttl, .type_of_service = input->flow.ip4_flow.tos, }; - attributes->l3_mask.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3_mask.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = mask->ipv4_mask.src_ip, .dst_addr = mask->ipv4_mask.dst_ip, .time_to_live = mask->ipv4_mask.ttl, @@ -2516,7 +2516,7 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: - attributes->l3.ipv6.hdr = (struct ipv6_hdr){ + attributes->l3.ipv6.hdr = (struct rte_ipv6_hdr){ .hop_limits = input->flow.ipv6_flow.hop_limits, .proto = input->flow.ipv6_flow.proto, }; diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index e4dea1197..f287762a4 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -408,12 +408,12 @@ flow_tcf_pedit_key_set_dec_ttl(const struct rte_flow_action *actions, if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV4) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP4; p_parser->keys[idx].off = - offsetof(struct ipv4_hdr, time_to_live); + offsetof(struct rte_ipv4_hdr, time_to_live); } if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP6; p_parser->keys[idx].off = - offsetof(struct ipv6_hdr, hop_limits); + offsetof(struct rte_ipv6_hdr, hop_limits); } if (actions->type == RTE_FLOW_ACTION_TYPE_DEC_TTL) { p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_ADD; @@ -477,8 +477,8 @@ flow_tcf_pedit_key_set_ipv6_addr(const struct rte_flow_action *actions, int keys = NUM_OF_PEDIT_KEYS(IPV6_ADDR_LEN); int off_base = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC ? - offsetof(struct ipv6_hdr, src_addr) : - offsetof(struct ipv6_hdr, dst_addr); + offsetof(struct rte_ipv6_hdr, src_addr) : + offsetof(struct rte_ipv6_hdr, dst_addr); const struct rte_flow_action_set_ipv6 *conf = (const struct rte_flow_action_set_ipv6 *)actions->conf; @@ -512,8 +512,8 @@ flow_tcf_pedit_key_set_ipv4_addr(const struct rte_flow_action *actions, p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_SET; p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC ? - offsetof(struct ipv4_hdr, src_addr) : - offsetof(struct ipv4_hdr, dst_addr); + offsetof(struct rte_ipv4_hdr, src_addr) : + offsetof(struct rte_ipv4_hdr, dst_addr); p_parser->keys[idx].mask = ~UINT32_MAX; p_parser->keys[idx].val = ((const struct rte_flow_action_set_ipv4 *) diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index 738986575..381b54e29 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -1170,7 +1170,7 @@ mrvl_parse_ip6(const struct rte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_ipv6 *spec = NULL, *mask = NULL; - struct ipv6_hdr zero; + struct rte_ipv6_hdr zero; uint32_t flow_mask; int ret; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 12c83f46d..34299b993 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -457,8 +457,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); uint16_t *ether_type; uint8_t *raw_pkt; - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; struct tcp_hdr *tcp; uint16_t len; @@ -474,14 +474,14 @@ 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 RTE_ETHER_TYPE_IPv4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; ip->version_ihl = QEDE_FDIR_IP_DEFAULT_VERSION_IHL; - ip->total_length = sizeof(struct ipv4_hdr); + ip->total_length = sizeof(struct rte_ipv4_hdr); ip->next_proto_id = arfs->tuple.ip_proto; ip->time_to_live = QEDE_FDIR_IPV4_DEF_TTL; ip->dst_addr = arfs->tuple.dst_ipv4; ip->src_addr = arfs->tuple.src_ipv4; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); params->ipv4 = true; raw_pkt = (uint8_t *)buff; @@ -507,7 +507,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, } break; case RTE_ETHER_TYPE_IPv6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; ip6->proto = arfs->tuple.ip_proto; ip6->vtc_flow = rte_cpu_to_be_32(QEDE_FDIR_IPV6_DEFAULT_VTC_FLOW); @@ -516,7 +516,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, IPV6_ADDR_LEN); rte_memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); params->ipv6 = true; raw_pkt = (uint8_t *)buff; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 103eeb509..2debac294 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -903,8 +903,8 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; @@ -924,14 +924,14 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) if (ethertype == RTE_ETHER_TYPE_IPv4) { packet_type |= RTE_PTYPE_L3_IPV4; - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, len); + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_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 == RTE_ETHER_TYPE_IPv6) { packet_type |= RTE_PTYPE_L3_IPV6; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, len); + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, len); if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) @@ -1093,7 +1093,7 @@ static inline uint32_t qede_rx_cqe_to_pkt_type(uint16_t flags) static inline uint8_t qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) { - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; uint16_t pkt_csum; uint16_t calc_csum; uint16_t val; @@ -1104,7 +1104,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) if (unlikely(val)) { m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index bcd3153ff..e52de8ebd 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -423,9 +423,9 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, switch (first_m_seg->ol_flags & (PKT_TX_IPV4 | PKT_TX_IPV6)) { case PKT_TX_IPV4: { - const struct ipv4_hdr *iphe4; + const struct rte_ipv4_hdr *iphe4; - iphe4 = (const struct ipv4_hdr *)(hdr_addr + iph_off); + iphe4 = (const struct rte_ipv4_hdr *)(hdr_addr + iph_off); rte_memcpy(&packet_id, &iphe4->packet_id, sizeof(uint16_t)); packet_id = rte_be_to_cpu_16(packet_id); break; diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index 076a25d44..cfa5c037a 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -146,9 +146,9 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, /* Handle IP header */ if (m->ol_flags & PKT_TX_IPV4) { - const struct ipv4_hdr *iphe4; + const struct rte_ipv4_hdr *iphe4; - iphe4 = (const struct ipv4_hdr *)(tsoh + nh_off); + iphe4 = (const struct rte_ipv4_hdr *)(tsoh + nh_off); rte_memcpy(&packet_id, &iphe4->packet_id, sizeof(uint16_t)); packet_id = rte_be_to_cpu_16(packet_id); } else if (m->ol_flags & PKT_TX_IPV6) { diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 3d37ba3fe..4e6735c75 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -592,7 +592,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -601,7 +601,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -610,7 +610,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -619,7 +619,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -629,7 +629,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -641,7 +641,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -650,7 +650,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -658,7 +658,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -666,7 +666,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -674,7 +674,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -683,7 +683,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -691,7 +691,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -699,7 +699,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -707,7 +707,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -716,7 +716,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -726,7 +726,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index f50b12fa0..3d7f56a9a 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -253,12 +253,12 @@ tap_verify_csum(struct rte_mbuf *mbuf) else if (l2 == RTE_PTYPE_L2_ETHER_QINQ) l2_len += 8; /* Don't verify checksum for packets with discontinuous L2 header */ - if (unlikely(l2_len + sizeof(struct ipv4_hdr) > + if (unlikely(l2_len + sizeof(struct rte_ipv4_hdr) > rte_pktmbuf_data_len(mbuf))) return; l3_hdr = rte_pktmbuf_mtod_offset(mbuf, void *, l2_len); if (l3 == RTE_PTYPE_L3_IPV4 || l3 == RTE_PTYPE_L3_IPV4_EXT) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; /* ihl contains the number of 4-byte words in the header */ l3_len = 4 * (iph->version_ihl & 0xf); @@ -270,7 +270,7 @@ tap_verify_csum(struct rte_mbuf *mbuf) PKT_RX_IP_CKSUM_BAD : PKT_RX_IP_CKSUM_GOOD; } else if (l3 == RTE_PTYPE_L3_IPV6) { - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); } else { /* IPv6 extensions are not supported */ return; @@ -461,7 +461,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, void *l3_hdr = packet + l2_len; if (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4)) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; uint16_t cksum; iph->hdr_checksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index ce91c59f2..b36450871 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -316,13 +316,13 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) /* common case: header is not fragmented */ if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + m->l4_len)) { - struct ipv4_hdr *iph; - struct ipv6_hdr *ip6h; + struct rte_ipv4_hdr *iph; + struct rte_ipv6_hdr *ip6h; struct tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; - iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + iph = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); th = RTE_PTR_ADD(iph, m->l3_len); if ((iph->version_ihl >> 4) == 4) { iph->hdr_checksum = 0; @@ -331,7 +331,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) - m->l3_len); } else { - ip6h = (struct ipv6_hdr *)iph; + ip6h = (struct rte_ipv6_hdr *)iph; ip_paylen = ip6h->payload_len; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index ca3b1ef33..9f22d273c 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -665,8 +665,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm) { uint32_t hlen, slen; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; char *ptr; @@ -677,20 +677,20 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { - if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) - return hw->mtu - sizeof(struct ipv4_hdr) + if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) + return hw->mtu - sizeof(struct rte_ipv4_hdr) - sizeof(struct tcp_hdr); - ipv4_hdr = (struct ipv4_hdr *)(ptr + hlen); + ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { - if (unlikely(slen < hlen + sizeof(struct ipv6_hdr))) - return hw->mtu - sizeof(struct ipv6_hdr) - + if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) + return hw->mtu - sizeof(struct rte_ipv6_hdr) - sizeof(struct tcp_hdr); - ipv6_hdr = (struct ipv6_hdr *)(ptr + hlen); - hlen += sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); + hlen += sizeof(struct rte_ipv6_hdr); if (unlikely(ipv6_hdr->proto != IPPROTO_TCP)) { int frag; diff --git a/examples/bond/main.c b/examples/bond/main.c index b5b66ebed..b257bf63f 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -325,7 +325,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; uint16_t rx_cnt; @@ -390,7 +390,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[2]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index dfb7db1c9..c75a410f4 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -99,7 +99,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -109,7 +109,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -119,7 +119,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -132,7 +132,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -142,7 +142,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index f92b24912..42b1d2cb0 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -58,8 +58,8 @@ /* * Default payload in bytes for the IPv6 packet. */ -#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct ipv4_hdr)) -#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct ipv6_hdr)) +#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct rte_ipv4_hdr)) +#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct rte_ipv6_hdr)) /* * Max number of fragments per packet expected - defined by config file. @@ -251,10 +251,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, /* if this is an IPv4 packet */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv4_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv4_hdr *); ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); /* Find destination port */ @@ -286,12 +286,12 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, } } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if this is an IPv6 packet */ - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; ipv6 = 1; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv6_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv6_hdr *); /* Find destination port */ if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index b23d6c09a..1e44fe37c 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -636,7 +636,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -645,7 +645,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -654,7 +654,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -663,7 +663,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -673,7 +673,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -685,7 +685,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -694,7 +694,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -702,7 +702,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -710,7 +710,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -718,7 +718,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -727,7 +727,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -735,7 +735,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -743,7 +743,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -751,7 +751,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -760,7 +760,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -770,7 +770,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index c2a1f9228..00a95e07a 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -324,10 +324,10 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, /* if packet is IPv4 */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); /* if it is a fragmented packet, then try to reassemble. */ if (rte_ipv4_frag_pkt_is_fragmented(ip_hdr)) { @@ -351,7 +351,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); } } ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); @@ -366,9 +366,9 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if packet is IPv6 */ struct ipv6_extension_fragment *frag_hdr; - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(ip_hdr); @@ -389,7 +389,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); } } diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 0c9c3a749..c97c11e75 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -306,7 +306,7 @@ static inline void mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) { struct rte_mbuf *mc; - struct ipv4_hdr *iphdr; + struct rte_ipv4_hdr *iphdr; uint32_t dest_addr, port_mask, port_num, use_clone; int32_t hash; uint16_t port; @@ -316,7 +316,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 787ce3fdb..7dac6de2d 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -384,7 +384,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct l2fwd_crypto_params *cparams) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; @@ -397,7 +397,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ipdata_offset = sizeof(struct rte_ether_hdr); - ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + + ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index ab8ba046b..b0e933e03 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -146,7 +146,7 @@ static struct rte_mempool *pktmbuf_pool[NB_SOCKETS]; /***********************start of ACL part******************************/ #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len); +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len); #endif static inline void send_single_packet(struct rte_mbuf *m, uint16_t port); @@ -174,8 +174,8 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *d = (unsigned char)(ip & 0xff);\ } while (0) #define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) -#define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) -#define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) +#define OFF_IPV42PROTO (offsetof(struct rte_ipv4_hdr, next_proto_id)) +#define OFF_IPV62PROTO (offsetof(struct rte_ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ rte_pktmbuf_mtod_offset((m), uint8_t *, OFF_ETHHEAD + OFF_IPV42PROTO) #define MBUF_IPV6_2PROTO(m) \ @@ -252,32 +252,32 @@ struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_SRC, - .offset = offsetof(struct ipv4_hdr, src_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, src_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_DST, - .offset = offsetof(struct ipv4_hdr, dst_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id) + + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id) + sizeof(uint16_t), }, }; @@ -314,80 +314,80 @@ struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = { .size = sizeof(uint32_t), .field_index = SRC1_FIELD_IPV6, .input_index = SRC1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC2_FIELD_IPV6, .input_index = SRC2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC3_FIELD_IPV6, .input_index = SRC3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC4_FIELD_IPV6, .input_index = SRC4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST1_FIELD_IPV6, .input_index = DST1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) + - offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST2_FIELD_IPV6, .input_index = DST2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST3_FIELD_IPV6, .input_index = DST3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST4_FIELD_IPV6, .input_index = DST4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint16_t), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint16_t), }, }; @@ -542,8 +542,8 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) { uint32_t offset = sig & ~ACL_DENY_SIGNATURE; unsigned char a, b, c, d; - struct ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv4_hdr *, + struct rte_ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); @@ -566,8 +566,8 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) { unsigned i; uint32_t offset = sig & ~ACL_DENY_SIGNATURE; - struct ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv6_hdr *, + struct rte_ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); printf("Packet Src"); @@ -620,11 +620,11 @@ static inline void prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, int index) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = pkts_in[index]; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ @@ -1281,14 +1281,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -1313,7 +1313,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index d9b752d80..abbfcc29f 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -424,14 +424,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -456,7 +456,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -481,7 +481,7 @@ print_ipv6_key(struct ipv6_5tuple key) } static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -496,14 +496,14 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -520,7 +520,7 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, } static inline uint16_t -get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, +get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; @@ -536,14 +536,14 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -562,7 +562,7 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint32_t next_hop; @@ -620,7 +620,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; @@ -629,7 +629,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -664,10 +664,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; ipv6_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d9b636806..ebb2378dd 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -314,14 +314,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -346,7 +346,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -362,7 +362,7 @@ print_key(struct ipv4_5tuple key) } static inline uint16_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -377,14 +377,14 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -402,7 +402,7 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint32_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { uint32_t next_hop; @@ -418,13 +418,13 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 1893f8c3a..293fb1fa2 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -130,14 +130,14 @@ send_single_packet(struct lcore_conf *qconf, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -162,7 +162,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 0c68aa01c..fc7996f88 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,13 +68,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -129,7 +129,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); /* dynamically vec_sel te and ve for MASK_ETH (0x3f) */ diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h index 0f4fcb427..7d83ff641 100644 --- a/examples/l3fwd/l3fwd_common.h +++ b/examples/l3fwd/l3fwd_common.h @@ -14,7 +14,7 @@ #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -28,7 +28,7 @@ * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index b56b08646..fb55e196d 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -252,7 +252,7 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv4_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); /* * Get 5 tuple: dst port, src port, dst IP address, @@ -273,7 +273,7 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv6_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct rte_ipv6_hdr, payload_len); void *data0 = ipv6_hdr; void *data1 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t); void *data2 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t) + sizeof(xmm_t); @@ -566,17 +566,17 @@ em_parse_ptype(struct rte_mbuf *m) uint16_t ether_type; void *l3; int hdr_len; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; 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(RTE_ETHER_TYPE_IPv4)) { - ipv4_hdr = (struct ipv4_hdr *)l3; + ipv4_hdr = (struct rte_ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; - if (hdr_len == sizeof(struct ipv4_hdr)) { + if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; @@ -585,7 +585,7 @@ em_parse_ptype(struct rte_mbuf *m) } else packet_type |= RTE_PTYPE_L3_IPV4_EXT; } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { - ipv6_hdr = (struct ipv6_hdr *)l3; + ipv6_hdr = (struct rte_ipv6_hdr *)l3; if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 4a7336350..62ae1bf30 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -10,7 +10,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -21,7 +21,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -52,9 +52,9 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 5afe77591..4476a91f3 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -80,8 +80,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint16_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -91,7 +91,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -106,7 +106,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 3ee2304b5..3aaf71428 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); } @@ -26,17 +26,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 8)); + offsetof(struct rte_ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 16)); + offsetof(struct rte_ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); key->xmm[1] = tmpdata1; diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 8156bbb90..7964a9277 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); } @@ -26,18 +26,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 6e7096c01..8307c20dd 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -25,8 +25,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint8_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -36,7 +36,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -51,7 +51,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 96143d871..881b0c7c0 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -82,7 +82,7 @@ lpm_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm *)lookup_struct; return (uint16_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -94,7 +94,7 @@ lpm_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm6 *)lookup_struct; return (uint16_t) ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } @@ -102,21 +102,21 @@ static __rte_always_inline uint16_t lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { - struct ipv6_hdr *ipv6_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -135,7 +135,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -146,7 +146,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, ipv6_hdr->dst_addr, &next_hop) == 0) diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 323f853ee..05faa5426 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -10,14 +10,14 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -48,9 +48,9 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index b36e991ac..7c6814252 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -17,30 +17,30 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], vector unsigned int *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index a3e42cfa7..d6c0ba64a 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -18,27 +18,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], int32x4_t *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 4603e0749..3f637a23d 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -15,27 +15,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index af2dc47ac..712c3a704 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -113,7 +113,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); ve = vcopyq_laneq_u32(ve, 3, te, 3); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index 3349f2747..5919f48b9 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -109,7 +109,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); te = _mm_blend_epi16(te, ve, MASK_ETH); diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index c4e6b4ac8..ff76c8d5b 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -495,7 +495,7 @@ app_lcore_worker( for (j = 0; j < bsz_rd; j ++) { struct rte_mbuf *pkt; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst, pos; uint32_t port; @@ -508,7 +508,7 @@ app_lcore_worker( pkt = lp->mbuf_in.array[j]; ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 3d2ceea2f..da5c66203 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -751,14 +751,14 @@ send_packetsx4(uint16_t port, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -783,7 +783,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -802,7 +802,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); __m128i data = _mm_loadu_si128((__m128i *)(ipv4_hdr)); /* Get 5 tuple: dst port, src port, dst IP address, src IP address and protocol */ @@ -819,7 +819,7 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, int ret = 0; union ipv6_5tuple_host key; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct rte_ipv6_hdr, payload_len); __m128i data0 = _mm_loadu_si128((__m128i *)(ipv6_hdr)); __m128i data1 = _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr) + sizeof(__m128i))); @@ -849,7 +849,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -860,7 +860,7 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } #endif @@ -885,7 +885,7 @@ static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { struct rte_ether_hdr *eth_hdr[8]; - struct ipv4_hdr *ipv4_hdr[8]; + struct rte_ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; @@ -901,21 +901,21 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ - ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, + ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, + ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, + ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, + ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, + ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, + ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, + ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, + ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -968,28 +968,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -1095,13 +1095,13 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); key->xmm[1] = tmpdata1; @@ -1116,7 +1116,7 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; - __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; + __attribute__((unused)) struct rte_ipv6_hdr *ipv6_hdr[8]; eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); @@ -1128,21 +1128,21 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ - ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, + ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, + ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, + ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, + ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, + ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, + ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, + ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, + ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); @@ -1229,14 +1229,14 @@ static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -1267,9 +1267,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, @@ -1300,7 +1300,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -1314,7 +1314,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; @@ -1345,7 +1345,7 @@ static __rte_always_inline uint16_t get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -1356,7 +1356,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct, @@ -1372,13 +1372,13 @@ static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; dst_ipv4 = rte_be_to_cpu_32(dst_ipv4); @@ -1402,27 +1402,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1503,13 +1503,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 8bec351ec..44216f999 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -266,7 +266,7 @@ transmit_packet(struct rte_mbuf *buf) static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -274,7 +274,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index a086c5a77..3e5295433 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -247,12 +247,12 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], efd_value_t data[RTE_EFD_BURST_MAX]; const void *key_ptrs[RTE_EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[RTE_EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 48a46d536..8088d9412 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -31,8 +31,8 @@ static void parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint16_t ethertype; info->outer_l2_len = sizeof(struct rte_ether_hdr); @@ -46,15 +46,15 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, switch (ethertype) { case RTE_ETHER_TYPE_IPv4: - ipv4_hdr = (struct ipv4_hdr *) + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv4_hdr); + info->outer_l3_len = sizeof(struct rte_ipv4_hdr); *l4_proto = ipv4_hdr->next_proto_id; break; case RTE_ETHER_TYPE_IPv6: - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv6_hdr); + info->outer_l3_len = sizeof(struct rte_ipv6_hdr); *l4_proto = ipv6_hdr->proto; break; default: @@ -73,8 +73,8 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i void *l3_hdr = NULL; uint8_t l4_proto; uint16_t ethertype; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -92,15 +92,15 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i l3_hdr = (char *)eth_hdr + info->l2_len; if (ethertype == RTE_ETHER_TYPE_IPv4) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_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); + info->l3_len = sizeof(struct rte_ipv4_hdr); l4_proto = ipv4_hdr->next_proto_id; } else if (ethertype == RTE_ETHER_TYPE_IPv6) { - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; + info->l3_len = sizeof(struct rte_ipv6_hdr); l4_proto = ipv6_hdr->proto; ol_flags |= PKT_TX_IPV6; } else @@ -176,10 +176,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); - struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; + struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; @@ -192,7 +192,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - sizeof(struct rte_ether_hdr)); @@ -210,7 +210,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) } m->outer_l2_len = sizeof(struct rte_ether_hdr); - m->outer_l3_len = sizeof(struct ipv4_hdr); + m->outer_l3_len = sizeof(struct rte_ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index 780ae73cc..689aea451 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -16,7 +16,7 @@ #define VXLAN_HF_VNI 0x08000000 #define DEFAULT_VXLAN_PORT 4789 -extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +extern struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 0b6b2d86e..b2c4155ee 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -48,7 +48,7 @@ /* VXLAN device */ struct vxlan_conf vxdev; -struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ @@ -229,7 +229,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) int i, ret; struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; struct rte_eth_tunnel_filter_conf tunnel_filter_conf; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index b2865c9c2..d7ee4530e 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -878,7 +878,7 @@ get_psd_sum(void *l3_hdr, uint64_t ol_flags) static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; - struct ipv4_hdr *ipv4_hdr = NULL; + struct rte_ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index ee2d116dc..4e0a84aff 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -621,7 +621,7 @@ static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { * Note: IPv4 options are handled by dedicated pattern items. */ struct rte_flow_item_ipv4 { - struct ipv4_hdr hdr; /**< IPv4 header definition. */ + struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ @@ -643,7 +643,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { * RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ struct rte_flow_item_ipv6 { - struct ipv6_hdr hdr; /**< IPv6 header definition. */ + struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index d06af0e75..14897c51c 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -611,8 +611,8 @@ rxa_calc_wrr_sequence(struct rte_event_eth_rx_adapter *rx_adapter, } static inline void -rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, - struct ipv6_hdr **ipv6_hdr) +rxa_mtoip(struct rte_mbuf *m, struct rte_ipv4_hdr **ipv4_hdr, + struct rte_ipv6_hdr **ipv6_hdr) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); struct rte_vlan_hdr *vlan_hdr; @@ -622,21 +622,21 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, switch (eth_hdr->ether_type) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_VLAN): vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(vlan_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(vlan_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(vlan_hdr + 1); break; default: break; @@ -656,8 +656,8 @@ rxa_do_softrss(struct rte_mbuf *m, const uint8_t *rss_key_be) void *tuple; struct rte_ipv4_tuple ipv4_tuple; struct rte_ipv6_tuple ipv6_tuple; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; rxa_mtoip(m, &ipv4_hdr, &ipv6_hdr); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 398b5b4cf..1c2fe713c 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -180,10 +180,10 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, static inline void update_header(struct gro_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = item->firstseg; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - pkt->l2_len); @@ -195,7 +195,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t tcp_dl, ip_id, hdr_len, frag_off; @@ -208,7 +208,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, uint8_t find; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 4879e2400..e33b65083 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -264,11 +264,11 @@ check_seq_option(struct gro_tcp4_item *item, uint8_t is_atomic) { struct rte_mbuf *pkt_orig = item->firstseg; - struct ipv4_hdr *iph_orig; + struct rte_ipv4_hdr *iph_orig; struct tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + + iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index baf3beffb..4426d82ad 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -262,14 +262,14 @@ merge_two_vxlan_tcp4_packets(struct gro_vxlan_tcp4_item *item, static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; /* Update the outer IPv4 header. */ len = pkt->pkt_len - pkt->outer_l2_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->outer_l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); @@ -280,7 +280,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the inner IPv4 header. */ len -= pkt->l2_len; - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); } @@ -290,7 +290,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; - struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; + struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; @@ -306,7 +306,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, uint8_t find; outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + + outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); @@ -314,7 +314,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sizeof(struct udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 6cd764ff5..ecce5da06 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -98,9 +98,9 @@ update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, static inline void update_ipv4_header(struct rte_mbuf *pkt, uint16_t l3_offset, uint16_t id) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l3_offset); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - l3_offset); ipv4_hdr->packet_id = rte_cpu_to_be_16(id); diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index fbd95f8f6..ad0cce6f9 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -9,14 +9,14 @@ static void update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; uint16_t l4_offset = l3_offset + pkt->l3_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -40,13 +40,13 @@ gso_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index d39b46863..f5a19bc43 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -9,7 +9,7 @@ static void update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; @@ -23,12 +23,12 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, tcp_offset = inner_ipv4_offset + pkt->l3_len; /* Outer IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + outer_ipv4_offset); outer_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); /* Inner IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -60,12 +60,12 @@ gso_tunnel_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *inner_ipv4_hdr; + struct rte_ipv4_hdr *inner_ipv4_hdr; uint16_t pyld_unit_size, hdr_offset, frag_off; int ret = 1; hdr_offset = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len; - inner_ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + inner_ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + hdr_offset); /* * Don't process the packet whose MF bit or offset in the inner diff --git a/lib/librte_gso/gso_udp4.c b/lib/librte_gso/gso_udp4.c index 927dee121..93e6f8e0d 100644 --- a/lib/librte_gso/gso_udp4.c +++ b/lib/librte_gso/gso_udp4.c @@ -11,7 +11,7 @@ static inline void update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t frag_offset = 0, is_mf; uint16_t l2_hdrlen = pkt->l2_len, l3_hdrlen = pkt->l3_len; uint16_t tail_idx = nb_segs - 1, length, i; @@ -22,7 +22,7 @@ update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, * length. */ for (i = 0; i < nb_segs; i++) { - ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct rte_ipv4_hdr *, l2_hdrlen); length = segs[i]->pkt_len - l2_hdrlen; ipv4_hdr->total_length = rte_cpu_to_be_16(length); @@ -42,13 +42,13 @@ gso_udp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 433f2c8bb..ee879968c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,11 +19,11 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h index a6ddb7bf7..adbaf8f70 100644 --- a/lib/librte_hash/rte_thash.h +++ b/lib/librte_hash/rte_thash.h @@ -168,7 +168,7 @@ rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len) * Pointer to rte_ipv6_tuple structure */ static inline void -rte_thash_load_v6_addrs(const struct ipv6_hdr *orig, union rte_thash_tuple *targ) +rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig, union rte_thash_tuple *targ) { #ifdef RTE_ARCH_X86 __m128i ipv6 = _mm_loadu_si128((const __m128i *)orig->src_addr); diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 7f425f610..148507a4d 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -210,7 +210,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr); /** @@ -225,7 +225,7 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * present. */ static inline struct ipv6_extension_fragment * -rte_ipv6_frag_get_ipv6_fragment_header(struct ipv6_hdr *hdr) +rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr) { if (hdr->proto == IPPROTO_FRAGMENT) { return (struct ipv6_extension_fragment *) ++hdr; @@ -284,7 +284,7 @@ int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr); + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr); /** * Check if the IPv4 packet is fragmented @@ -295,7 +295,7 @@ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * 1 if fragmented, 0 if not fragmented */ static inline int -rte_ipv4_frag_pkt_is_fragmented(const struct ipv4_hdr * hdr) { +rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index a96fb03e4..2c781724a 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -21,8 +21,8 @@ #define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) -static inline void __fill_ipv4hdr_frag(struct ipv4_hdr *dst, - const struct ipv4_hdr *src, uint16_t len, uint16_t fofs, +static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, + const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); @@ -70,7 +70,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv4_hdr *in_hdr; + struct rte_ipv4_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, flag_offset, frag_size; @@ -80,10 +80,10 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, * Ensure the IP payload length of all fragments is aligned to a * multiple of 8 bytes as per RFC791 section 2.3. */ - frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct ipv4_hdr)), + frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct rte_ipv4_hdr)), IPV4_HDR_FO_ALIGN); - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv4_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv4_hdr *); flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset); /* If Don't Fragment flag is set */ @@ -92,11 +92,11 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Check that pkts_out is big enough to hold all fragments */ if (unlikely(frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv4_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof (struct rte_ipv4_hdr)))) return -EINVAL; in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv4_hdr); + in_seg_data_pos = sizeof(struct rte_ipv4_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -104,7 +104,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv4_hdr *out_hdr; + struct rte_ipv4_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -114,8 +114,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv4_hdr); - out_pkt->pkt_len = sizeof(struct ipv4_hdr); + out_pkt->data_len = sizeof(struct rte_ipv4_hdr); + out_pkt->pkt_len = sizeof(struct rte_ipv4_hdr); frag_bytes_remaining = frag_size; out_seg_prev = out_pkt; @@ -164,17 +164,17 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv4_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv4_hdr *); __fill_ipv4hdr_frag(out_hdr, in_hdr, (uint16_t)out_pkt->pkt_len, flag_offset, fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv4_hdr)); + out_pkt->pkt_len - sizeof(struct rte_ipv4_hdr)); out_pkt->ol_flags |= PKT_TX_IP_CKSUM; - out_pkt->l3_len = sizeof(struct ipv4_hdr); + out_pkt->l3_len = sizeof(struct rte_ipv4_hdr); /* Write the fragment to the output list */ pkts_out[out_pkt_pos] = out_pkt; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 4956b99ea..35f7d85cd 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -14,7 +14,7 @@ struct rte_mbuf * ipv4_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; uint32_t curr_idx = 0; @@ -67,7 +67,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv4 header for the reassembled packet */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); @@ -97,7 +97,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv4_hdr *ip_hdr) + struct rte_ipv4_hdr *ip_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c index 62a7e4e83..627d37c28 100644 --- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c @@ -18,8 +18,8 @@ */ static inline void -__fill_ipv6hdr_frag(struct ipv6_hdr *dst, - const struct ipv6_hdr *src, uint16_t len, uint16_t fofs, +__fill_ipv6hdr_frag(struct rte_ipv6_hdr *dst, + const struct rte_ipv6_hdr *src, uint16_t len, uint16_t fofs, uint32_t mf) { struct ipv6_extension_fragment *fh; @@ -73,25 +73,25 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv6_hdr *in_hdr; + struct rte_ipv6_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, frag_size; - frag_size = (uint16_t)(mtu_size - sizeof(struct ipv6_hdr)); + frag_size = (uint16_t)(mtu_size - sizeof(struct rte_ipv6_hdr)); /* Fragment size should be a multiple of 8. */ RTE_ASSERT((frag_size & ~RTE_IPV6_EHDR_FO_MASK) == 0); /* Check that pkts_out is big enough to hold all fragments */ if (unlikely (frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof (struct rte_ipv6_hdr)))) return -EINVAL; - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv6_hdr *); in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv6_hdr); + in_seg_data_pos = sizeof(struct rte_ipv6_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -99,7 +99,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv6_hdr *out_hdr; + struct rte_ipv6_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -109,8 +109,8 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); - out_pkt->pkt_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->data_len = sizeof(struct rte_ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->pkt_len = sizeof(struct rte_ipv6_hdr) + sizeof(struct ipv6_extension_fragment); out_seg_prev = out_pkt; more_out_segs = 1; @@ -159,14 +159,14 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv6_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv6_hdr *); __fill_ipv6hdr_frag(out_hdr, in_hdr, - (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr), + (uint16_t) out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr), fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv6_hdr) + out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr) - sizeof(struct ipv6_extension_fragment)); /* Write the fragment to the output list */ diff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c index db249fe60..0d9e3a597 100644 --- a/lib/librte_ip_frag/rte_ipv6_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c @@ -32,7 +32,7 @@ ip_frag_memmove(char *dst, char *src, int len) struct rte_mbuf * ipv6_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; struct ipv6_extension_fragment *frag_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; @@ -90,7 +90,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv6 header for the reassembled datagram */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, m->l2_len); ip_hdr->payload_len = rte_cpu_to_be_16(payload_len); @@ -136,7 +136,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) + struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index f2a8904a2..986fd137c 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -28,7 +28,7 @@ extern "C" { /** * IPv4 Header */ -struct ipv4_hdr { +struct rte_ipv4_hdr { uint8_t version_ihl; /**< version and header length */ uint8_t type_of_service; /**< type of service */ uint16_t total_length; /**< length of packet */ @@ -249,10 +249,10 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len, * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) +rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr) { uint16_t cksum; - cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr)); + cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr)); return (cksum == 0xffff) ? cksum : (uint16_t)~cksum; } @@ -275,7 +275,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) +rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags) { struct ipv4_psd_header { uint32_t src_addr; /* IP address of source host. */ @@ -294,7 +294,7 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) } else { psd_hdr.len = rte_cpu_to_be_16( (uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr))); + - sizeof(struct rte_ipv4_hdr))); } return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr)); } @@ -313,13 +313,13 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) +rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l4_len; l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); cksum = rte_raw_cksum(l4_hdr, l4_len); cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0); @@ -335,7 +335,7 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) /** * IPv6 Header */ -struct ipv6_hdr { +struct rte_ipv6_hdr { uint32_t vtc_flow; /**< IP version, traffic class & flow label. */ uint16_t payload_len; /**< IP packet length - includes sizeof(ip_header). */ uint8_t proto; /**< Protocol, next header. */ @@ -367,7 +367,7 @@ struct ipv6_hdr { * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) +rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags) { uint32_t sum; struct { @@ -403,7 +403,7 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr) +rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l4_len; diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 3ad16f0c4..dc2a66725 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -172,7 +172,7 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, /* get the ipv4 header length */ static uint8_t -ip4_hlen(const struct ipv4_hdr *hdr) +ip4_hlen(const struct rte_ipv4_hdr *hdr) { return (hdr->version_ihl & 0xf) * 4; } @@ -281,8 +281,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -304,8 +304,8 @@ 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(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); @@ -413,8 +413,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -436,8 +436,8 @@ 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(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index e59760a0a..84f8dfe1c 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -112,8 +112,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, static inline int rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -123,7 +123,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) inner_l3_offset += m->outer_l2_len + m->outer_l3_len; if (ol_flags & PKT_TX_IPV4) { - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, inner_l3_offset); if (ol_flags & PKT_TX_IP_CKSUM) @@ -137,7 +137,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, @@ -154,7 +154,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 453494294..c7b04d6f5 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -504,7 +504,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -512,14 +512,14 @@ struct encap_vxlan_ipv4_data { struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -527,7 +527,7 @@ struct encap_vxlan_ipv6_data { struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -964,7 +964,7 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -994,7 +994,7 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -1287,7 +1287,7 @@ nat_ipv6_tcp_udp_checksum_update(uint16_t cksum0, } static __rte_always_inline void -pkt_ipv4_work_nat(struct ipv4_hdr *ip, +pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, struct nat_ipv4_data *data, struct rte_table_action_nat_config *cfg) { @@ -1373,7 +1373,7 @@ pkt_ipv4_work_nat(struct ipv4_hdr *ip, } static __rte_always_inline void -pkt_ipv6_work_nat(struct ipv6_hdr *ip, +pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, struct nat_ipv6_data *data, struct rte_table_action_nat_config *cfg) { @@ -1481,7 +1481,7 @@ ttl_apply(void *data, } static __rte_always_inline uint64_t -pkt_ipv4_work_ttl(struct ipv4_hdr *ip, +pkt_ipv4_work_ttl(struct rte_ipv4_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -1502,7 +1502,7 @@ pkt_ipv4_work_ttl(struct ipv4_hdr *ip, } static __rte_always_inline uint64_t -pkt_ipv6_work_ttl(struct ipv6_hdr *ip, +pkt_ipv6_work_ttl(struct rte_ipv6_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -2843,16 +2843,16 @@ pkt_work(struct rte_mbuf *mbuf, uint16_t total_length; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr = ip; + struct rte_ipv4_hdr *hdr = ip; dscp = hdr->type_of_service >> 2; total_length = rte_ntohs(hdr->total_length); } else { - struct ipv6_hdr *hdr = ip; + struct rte_ipv6_hdr *hdr = ip; dscp = (rte_ntohl(hdr->vtc_flow) & 0x0F600000) >> 18; total_length = - rte_ntohs(hdr->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr->payload_len) + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { @@ -2991,10 +2991,10 @@ pkt4_work(struct rte_mbuf **mbufs, uint16_t total_length0, total_length1, total_length2, total_length3; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr0 = ip0; - struct ipv4_hdr *hdr1 = ip1; - struct ipv4_hdr *hdr2 = ip2; - struct ipv4_hdr *hdr3 = ip3; + struct rte_ipv4_hdr *hdr0 = ip0; + struct rte_ipv4_hdr *hdr1 = ip1; + struct rte_ipv4_hdr *hdr2 = ip2; + struct rte_ipv4_hdr *hdr3 = ip3; dscp0 = hdr0->type_of_service >> 2; dscp1 = hdr1->type_of_service >> 2; @@ -3006,10 +3006,10 @@ pkt4_work(struct rte_mbuf **mbufs, total_length2 = rte_ntohs(hdr2->total_length); total_length3 = rte_ntohs(hdr3->total_length); } else { - struct ipv6_hdr *hdr0 = ip0; - struct ipv6_hdr *hdr1 = ip1; - struct ipv6_hdr *hdr2 = ip2; - struct ipv6_hdr *hdr3 = ip3; + struct rte_ipv6_hdr *hdr0 = ip0; + struct rte_ipv6_hdr *hdr1 = ip1; + struct rte_ipv6_hdr *hdr2 = ip2; + struct rte_ipv6_hdr *hdr3 = ip3; dscp0 = (rte_ntohl(hdr0->vtc_flow) & 0x0F600000) >> 18; dscp1 = (rte_ntohl(hdr1->vtc_flow) & 0x0F600000) >> 18; @@ -3017,13 +3017,13 @@ pkt4_work(struct rte_mbuf **mbufs, dscp3 = (rte_ntohl(hdr3->vtc_flow) & 0x0F600000) >> 18; total_length0 = - rte_ntohs(hdr0->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr0->payload_len) + sizeof(struct rte_ipv6_hdr); total_length1 = - rte_ntohs(hdr1->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr1->payload_len) + sizeof(struct rte_ipv6_hdr); total_length2 = - rte_ntohs(hdr2->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr2->payload_len) + sizeof(struct rte_ipv6_hdr); total_length3 = - rte_ntohs(hdr3->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr3->payload_len) + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index c8b2e19bf..2e807e805 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -151,7 +151,7 @@ static void process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv4_hdr *); + struct rte_ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct rte_ipv4_hdr *); /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); @@ -182,7 +182,7 @@ static void process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv6_hdr *); + struct rte_ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct rte_ipv6_hdr *); struct ipv6_extension_fragment *frag_hdr; uint16_t frag_data = 0; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index e62fdf228..9736a7339 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -264,9 +264,9 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) /* IP cksum verification cannot be bypassed, then calculate here */ if (m_buf->ol_flags & PKT_TX_IP_CKSUM) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct rte_ipv4_hdr *, m_buf->l2_len); ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } @@ -966,8 +966,8 @@ virtio_net_with_host_offload(struct virtio_net *dev) static void parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; struct rte_ether_hdr *eth_hdr; uint16_t ethertype; @@ -997,7 +997,7 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) case RTE_ETHER_TYPE_IPv6: ipv6_hdr = l3_hdr; *l4_proto = ipv6_hdr->proto; - m->l3_len = sizeof(struct ipv6_hdr); + m->l3_len = sizeof(struct rte_ipv6_hdr); *l4_hdr = (char *)l3_hdr + m->l3_len; m->ol_flags |= PKT_TX_IPV6; break; diff --git a/test/test-pipeline/pipeline_acl.c b/test/test-pipeline/pipeline_acl.c index 8853d4376..ad939008a 100644 --- a/test/test-pipeline/pipeline_acl.c +++ b/test/test-pipeline/pipeline_acl.c @@ -40,7 +40,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -48,7 +48,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -56,21 +56,21 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr), + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/test/test-pipeline/pipeline_hash.c b/test/test-pipeline/pipeline_hash.c index 3e4a0a1bb..25fb2e0da 100644 --- a/test/test-pipeline/pipeline_hash.c +++ b/test/test-pipeline/pipeline_hash.c @@ -426,8 +426,8 @@ app_main_loop_rx_metadata(void) { for (j = 0; j < n_mbufs; j++) { struct rte_mbuf *m; uint8_t *m_data, *key; - struct ipv4_hdr *ip_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ip_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t ip_dst; uint8_t *ipv6_dst; uint32_t *signature, *k32; @@ -440,14 +440,14 @@ app_main_loop_rx_metadata(void) { APP_METADATA_OFFSET(32)); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip_hdr = (struct ipv4_hdr *) + ip_hdr = (struct rte_ipv4_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index feee9e121..886b5f8ac 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -137,7 +137,7 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, } uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len) { ip_hdr->vtc_flow = 0; @@ -148,11 +148,11 @@ initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, rte_memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); rte_memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); - return (uint16_t) (pkt_data_len + sizeof(struct ipv6_hdr)); + return (uint16_t) (pkt_data_len + sizeof(struct rte_ipv6_hdr)); } uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -162,7 +162,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -200,7 +200,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, } uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto) { uint16_t pkt_len; @@ -210,7 +210,7 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -300,13 +300,13 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), pkt, eth_hdr_size); copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), pkt, eth_hdr_size); copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); } /* @@ -319,10 +319,10 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; @@ -379,45 +379,45 @@ generate_packet_burst_proto(struct rte_mempool *mp, copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; default: break; } } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; default: break; @@ -434,10 +434,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index 8489212d0..93efee1f5 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -46,15 +46,15 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto); int diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index 3f06f3005..96e371691 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -40,7 +40,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -50,7 +50,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -60,7 +60,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -73,7 +73,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -83,7 +83,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -490,7 +490,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); @@ -527,7 +527,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); @@ -564,7 +564,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index 2490d5dd2..924de81ae 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -78,14 +78,14 @@ struct link_bonding_unittest_params { /* Packet Headers */ struct rte_ether_hdr *pkt_eth_hdr; - struct ipv4_hdr *pkt_ipv4_hdr; - struct ipv6_hdr *pkt_ipv6_hdr; + struct rte_ipv4_hdr *pkt_ipv4_hdr; + struct rte_ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; }; -static struct ipv4_hdr pkt_ipv4_hdr; -static struct ipv6_hdr pkt_ipv6_hdr; +static struct rte_ipv4_hdr pkt_ipv4_hdr; +static struct rte_ipv6_hdr pkt_ipv6_hdr; static struct udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index 6295b1874..fba629d43 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -734,8 +734,8 @@ generate_packets(struct rte_ether_addr *src_mac, struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { - struct ipv4_hdr v4; - struct ipv6_hdr v6; + struct rte_ipv4_hdr v4; + struct rte_ipv6_hdr v6; } pkt_ip_hdr; int retval; diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index c5515cc5c..3246b7ab6 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -183,7 +183,7 @@ init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; diff --git a/test/test/test_sched.c b/test/test/test_sched.c index f02e50882..1611fc64c 100644 --- a/test/test/test_sched.c +++ b/test/test/test_sched.c @@ -80,14 +80,14 @@ prepare_pkt(struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr; struct rte_vlan_hdr *vlan1, *vlan2; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; /* Simulate a classifier */ eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); vlan1 = (struct rte_vlan_hdr *)(ð_hdr->ether_type ); vlan2 = (struct rte_vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct rte_vlan_hdr)); eth_hdr = (struct rte_ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct rte_vlan_hdr)); - ip_hdr = (struct ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); + ip_hdr = (struct rte_ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); vlan2->vlan_tci = rte_cpu_to_be_16(PIPE); diff --git a/test/test/test_thash.c b/test/test/test_thash.c index 61754a947..bf332c9e9 100644 --- a/test/test/test_thash.c +++ b/test/test/test_thash.c @@ -110,7 +110,7 @@ test_thash(void) union rte_thash_tuple tuple; uint32_t rss_l3, rss_l3l4; uint8_t rss_key_be[RTE_DIM(default_rss_key)]; - struct ipv6_hdr ipv6_hdr; + struct rte_ipv6_hdr ipv6_hdr; /* Convert RSS key*/ rte_convert_rss_key((uint32_t *)&default_rss_key, -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 11/14] net: add rte prefix to ip defines 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (9 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 10/14] net: add rte prefix to ip structure Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 12/14] net: add rte prefix to sctp structure Olivier Matz ` (9 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'RTE_' prefix to defines: - rename IPv4( as RTE_IPv4(. - rename IPV4_MAX_PKT_LEN as RTE_IPV4_MAX_PKT_LEN. - rename IPV4_HDR_IHL_MASK as RTE_IPV4_HDR_IHL_MASK. - rename IPV4_IHL_MULTIPLIER as RTE_IPV4_IHL_MULTIPLIER. - rename IPV4_HDR_DF_SHIFT as RTE_IPV4_HDR_DF_SHIFT. - rename IPV4_HDR_MF_SHIFT as RTE_IPV4_HDR_MF_SHIFT. - rename IPV4_HDR_FO_SHIFT as RTE_IPV4_HDR_FO_SHIFT. - rename IPV4_HDR_DF_FLAG as RTE_IPV4_HDR_DF_FLAG. - rename IPV4_HDR_MF_FLAG as RTE_IPV4_HDR_MF_FLAG. - rename IPV4_HDR_OFFSET_MASK as RTE_IPV4_HDR_OFFSET_MASK. - rename IPV4_HDR_OFFSET_UNITS as RTE_IPV4_HDR_OFFSET_UNITS. - rename IPV4_ANY as RTE_IPV4_ANY. - rename IPV4_LOOPBACK as RTE_IPV4_LOOPBACK. - rename IPV4_BROADCAST as RTE_IPV4_BROADCAST. - rename IPV4_ALLHOSTS_GROUP as RTE_IPV4_ALLHOSTS_GROUP. - rename IPV4_ALLRTRS_GROUP as RTE_IPV4_ALLRTRS_GROUP. - rename IPV4_MAX_LOCAL_GROUP as RTE_IPV4_MAX_LOCAL_GROUP. - rename IPV4_MIN_MCAST as RTE_IPV4_MIN_MCAST. - rename IPV4_MAX_MCAST as RTE_IPV4_MAX_MCAST. - rename IS_IPV4_MCAST as RTE_IS_IPV4_MCAST. - rename IPV6_HDR_FL_SHIFT as RTE_IPV6_HDR_FL_SHIFT. - rename IPV6_HDR_TC_SHIFT as RTE_IPV6_HDR_TC_SHIFT. - rename IPV6_HDR_FL_MASK as RTE_IPV6_HDR_FL_MASK. - rename IPV6_HDR_TC_MASK as RTE_IPV6_HDR_TC_MASK. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/flowgen.c | 4 +- app/test-pmd/testpmd.c | 8 +- .../prog_guide/packet_classif_access_ctrl.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +-- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +-- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 4 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/i40e/i40e_flow.c | 4 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow_verbs.c | 16 +-- drivers/net/tap/tap_bpf_program.c | 6 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 +- examples/flow_classify/flow_classify.c | 2 +- examples/ip_fragmentation/main.c | 16 +-- examples/ip_reassembly/main.c | 16 +-- examples/ipv4_multicast/main.c | 32 +++--- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 24 ++-- examples/l3fwd-vf/main.c | 24 ++-- examples/l3fwd/l3fwd_em.c | 20 ++-- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/performance-thread/l3fwd-thread/main.c | 32 +++--- lib/librte_gro/gro_tcp4.c | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 4 +- lib/librte_gso/gso_common.h | 4 +- lib/librte_ip_frag/rte_ip_frag.h | 4 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 16 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 8 +- lib/librte_net/rte_ip.h | 50 ++++----- lib/librte_net/rte_net.c | 6 +- lib/librte_port/rte_port_ras.c | 4 +- test/test-acl/main.c | 2 +- test/test/test_acl.c | 8 +- test/test/test_acl.h | 122 ++++++++++----------- test/test/test_efd.c | 20 ++-- test/test/test_flow_classify.c | 8 +- test/test/test_hash.c | 20 ++-- test/test/test_link_bonding_mode4.c | 4 +- test/test/test_lpm.c | 76 ++++++------- test/test/test_lpm_perf.c | 10 +- test/test/test_member.c | 20 ++-- test/test/test_sched.c | 2 +- test/test/test_table_acl.c | 8 +- test/test/test_thash.c | 10 +- 46 files changed, 343 insertions(+), 343 deletions(-) diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index e62601541..0405fe9b6 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -72,8 +72,8 @@ /* hardcoded configuration (for now) */ static unsigned cfg_n_flows = 1024; -static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); -static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); +static uint32_t cfg_ip_src = RTE_IPv4(10, 254, 0, 0); +static uint32_t cfg_ip_dst = RTE_IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; static struct rte_ether_addr cfg_ether_src = diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 6b02c0c10..2576387a5 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -454,8 +454,8 @@ struct vxlan_encap_conf vxlan_encap_conf = { .vni = "\x00\x00\x00", .udp_src = 0, .udp_dst = RTE_BE16(4789), - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" @@ -469,8 +469,8 @@ struct nvgre_encap_conf nvgre_encap_conf = { .select_ipv4 = 1, .select_vlan = 0, .tni = "\x00\x00\x00", - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 6887e4dc6..010ec045d 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -419,7 +419,7 @@ Classify with Multiple Categories .data = {.userdata = 1, .category_mask = 3, .priority = 1}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,0,0),. mask_range.u32 = 16,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,0,0),. mask_range.u32 = 16,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -433,7 +433,7 @@ Classify with Multiple Categories .data = {.userdata = 2, .category_mask = 1, .priority = 2}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,1,0),. mask_range.u32 = 24,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,1,0),. mask_range.u32 = 24,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -447,7 +447,7 @@ Classify with Multiple Categories .data = {.userdata = 3, .category_mask = 2, .priority = 3}, /* source IPv4 */ - .field[1] = {.value.u32 = IPv4(10,1,1,1),. mask_range.u32 = 32,}, + .field[1] = {.value.u32 = RTE_IPv4(10,1,1,1),. mask_range.u32 = 32,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, diff --git a/doc/guides/sample_app_ug/ip_frag.rst b/doc/guides/sample_app_ug/ip_frag.rst index 7914a977a..222bdd748 100644 --- a/doc/guides/sample_app_ug/ip_frag.rst +++ b/doc/guides/sample_app_ug/ip_frag.rst @@ -104,14 +104,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ip_reassembly.rst b/doc/guides/sample_app_ug/ip_reassembly.rst index 18912cd2f..db303d362 100644 --- a/doc/guides/sample_app_ug/ip_reassembly.rst +++ b/doc/guides/sample_app_ug/ip_reassembly.rst @@ -107,14 +107,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 0d89be96e..a6175b3eb 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -155,7 +155,7 @@ if the routing table has any ports assigned to the destination address: .. code-block:: c - if (!IS_IPV4_MCAST(dest_addr) || + if (!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 2aa94d7c2..dd7d3fb20 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -856,8 +856,8 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, if (likely(rte_ipv4_frag_pkt_is_fragmented(ipv4_hdr) == 0)) { ip_hdr_offset = (ipv4_hdr->version_ihl - & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { tcp_hdr = (struct tcp_hdr *) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 6cf4259fe..eaeed9fee 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1970,7 +1970,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); - if ((frag_field & IPV4_HDR_DF_FLAG) != 0) { + if ((frag_field & RTE_IPV4_HDR_DF_FLAG) != 0) { m->packet_type |= RTE_PTYPE_L4_NONFRAG; /* If IPv4 header has DF flag enabled and TSO support is diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index d7a1000d8..7d08078a6 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2607,8 +2607,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, /* Check if it is fragment. */ frag_off = ipv4_spec->hdr.fragment_offset; frag_off = rte_be_to_cpu_16(frag_off); - if (frag_off & IPV4_HDR_OFFSET_MASK || - frag_off & IPV4_HDR_MF_FLAG) + if (frag_off & RTE_IPV4_HDR_OFFSET_MASK || + frag_off & RTE_IPV4_HDR_MF_FLAG) pctype = I40E_FILTER_PCTYPE_FRAG_IPV4; /* Get the filter info */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 46f3f5d5d..6d9224d4f 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4488,7 +4488,7 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool) /* MAXDESC * SRRCTL.BSIZEPKT must not exceed 64 KB minus one */ uint16_t maxdesc = - IPV4_MAX_PKT_LEN / + RTE_IPV4_MAX_PKT_LEN / (mp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM); if (maxdesc >= 16) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 4de4759e7..925e17157 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -370,17 +370,17 @@ flow_verbs_translate_item_ipv6(const struct rte_flow_item *item, vtc_flow_val = rte_be_to_cpu_32(spec->hdr.vtc_flow); vtc_flow_mask = rte_be_to_cpu_32(mask->hdr.vtc_flow); ipv6.val.flow_label = - rte_cpu_to_be_32((vtc_flow_val & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.val.traffic_class = (vtc_flow_val & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_val & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.val.traffic_class = (vtc_flow_val & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.val.next_hdr = spec->hdr.proto; ipv6.val.hop_limit = spec->hdr.hop_limits; ipv6.mask.flow_label = - rte_cpu_to_be_32((vtc_flow_mask & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.mask.traffic_class = (vtc_flow_mask & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_mask & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.mask.traffic_class = (vtc_flow_mask & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.mask.next_hdr = mask->hdr.proto; ipv6.mask.hop_limit = mask->hdr.hop_limits; /* Remove unwanted bits from values. */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index db3ed8798..0886b0fb2 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -19,7 +19,7 @@ #include "tap_rss.h" /** Create IPv4 address */ -#define IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -157,11 +157,11 @@ rss_l3_l4(struct __sk_buff *skb) __u8 *src_dst_addr = data + off + offsetof(struct iphdr, saddr); __u8 *src_dst_port = data + off + sizeof(struct iphdr); struct ipv4_l3_l4_tuple v4_tuple = { - .src_addr = IPv4(*(src_dst_addr + 0), + .src_addr = RTE_IPv4(*(src_dst_addr + 0), *(src_dst_addr + 1), *(src_dst_addr + 2), *(src_dst_addr + 3)), - .dst_addr = IPv4(*(src_dst_addr + 4), + .dst_addr = RTE_IPv4(*(src_dst_addr + 4), *(src_dst_addr + 5), *(src_dst_addr + 6), *(src_dst_addr + 7)), diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 9f22d273c..3bbf9adf7 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -682,8 +682,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, - sizeof(struct tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); - hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index c75a410f4..e68d0f694 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -379,7 +379,7 @@ parse_ipv4_net(char *in, uint32_t *addr, uint32_t *mask_len) if (get_cb_field(&in, &m, 0, sizeof(uint32_t) * CHAR_BIT, 0)) return -EINVAL; - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; } diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 42b1d2cb0..6585323a2 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -160,14 +160,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 00a95e07a..97c499425 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -190,14 +190,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index c97c11e75..34306aebe 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -138,21 +138,21 @@ struct mcast_group_params { }; static struct mcast_group_params mcast_group_table[] = { - {IPv4(224,0,0,101), 0x1}, - {IPv4(224,0,0,102), 0x2}, - {IPv4(224,0,0,103), 0x3}, - {IPv4(224,0,0,104), 0x4}, - {IPv4(224,0,0,105), 0x5}, - {IPv4(224,0,0,106), 0x6}, - {IPv4(224,0,0,107), 0x7}, - {IPv4(224,0,0,108), 0x8}, - {IPv4(224,0,0,109), 0x9}, - {IPv4(224,0,0,110), 0xA}, - {IPv4(224,0,0,111), 0xB}, - {IPv4(224,0,0,112), 0xC}, - {IPv4(224,0,0,113), 0xD}, - {IPv4(224,0,0,114), 0xE}, - {IPv4(224,0,0,115), 0xF}, + {RTE_IPv4(224,0,0,101), 0x1}, + {RTE_IPv4(224,0,0,102), 0x2}, + {RTE_IPv4(224,0,0,103), 0x3}, + {RTE_IPv4(224,0,0,104), 0x4}, + {RTE_IPv4(224,0,0,105), 0x5}, + {RTE_IPv4(224,0,0,106), 0x6}, + {RTE_IPv4(224,0,0,107), 0x7}, + {RTE_IPv4(224,0,0,108), 0x8}, + {RTE_IPv4(224,0,0,109), 0x9}, + {RTE_IPv4(224,0,0,110), 0xA}, + {RTE_IPv4(224,0,0,111), 0xB}, + {RTE_IPv4(224,0,0,112), 0xC}, + {RTE_IPv4(224,0,0,113), 0xD}, + {RTE_IPv4(224,0,0,114), 0xE}, + {RTE_IPv4(224,0,0,115), 0xF}, }; #define N_MCAST_GROUPS \ @@ -325,7 +325,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) * Check that it is a valid multicast address and * we have some active ports assigned to it. */ - if(!IS_IPV4_MCAST(dest_addr) || + if(!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 7dac6de2d..1fd6482b0 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -400,8 +400,8 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); - ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) - * IPV4_IHL_MULTIPLIER; + ipdata_offset += (ip_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) + * RTE_IPV4_IHL_MULTIPLIER; /* Zero pad data to be crypto'd so it is block aligned */ diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index b0e933e03..bad6aae8c 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -897,7 +897,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index abbfcc29f..f78aeab53 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -236,10 +236,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -278,14 +278,14 @@ struct ipv4_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define IPV4_L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index ebb2378dd..5e3809b8d 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -201,10 +201,10 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; typedef struct rte_hash lookup_struct_t; @@ -234,14 +234,14 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index fb55e196d..b0e08f842 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -99,10 +99,10 @@ struct ipv6_l3fwd_em_route { }; static struct ipv4_l3fwd_em_route ipv4_l3fwd_em_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_em_route ipv6_l3fwd_em_route_array[] = { @@ -424,19 +424,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_em_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_em_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_em_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_em_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); @@ -574,8 +574,8 @@ em_parse_ptype(struct rte_mbuf *m) l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr = (struct rte_ipv4_hdr *)l3; - hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hdr_len = (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 881b0c7c0..de9fd9ab3 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -40,14 +40,14 @@ struct ipv6_l3fwd_lpm_route { }; static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = { diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index da5c66203..9b5684ea6 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -380,10 +380,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -503,14 +503,14 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -3134,19 +3134,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 1c2fe713c..3ed8cda02 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -231,7 +231,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 4426d82ad..80d2d5288 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -339,11 +339,11 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(outer_ipv4_hdr->fragment_offset); - outer_is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + outer_is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; outer_ip_id = outer_is_atomic ? 0 : rte_be_to_cpu_16(outer_ipv4_hdr->packet_id); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index ecce5da06..e5c8d83e7 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -12,8 +12,8 @@ #include <rte_tcp.h> #include <rte_udp.h> -#define IS_FRAGMENTED(frag_off) (((frag_off) & IPV4_HDR_OFFSET_MASK) != 0 \ - || ((frag_off) & IPV4_HDR_MF_FLAG) == IPV4_HDR_MF_FLAG) +#define IS_FRAGMENTED(frag_off) (((frag_off) & RTE_IPV4_HDR_OFFSET_MASK) != 0 \ + || ((frag_off) & RTE_IPV4_HDR_MF_FLAG) == RTE_IPV4_HDR_MF_FLAG) #define TCP_HDR_PSH_MASK ((uint8_t)0x08) #define TCP_HDR_FIN_MASK ((uint8_t)0x01) diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 148507a4d..28ba33dac 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -299,8 +299,8 @@ rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); return ip_flag != 0 || ip_ofs != 0; } diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index 2c781724a..f7c956ee1 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -12,22 +12,22 @@ #include "ip_frag_common.h" /* Fragment Offset */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_MASK (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_MASK (1 << IPV4_HDR_MF_SHIFT) +#define IPV4_HDR_DF_MASK (1 << RTE_IPV4_HDR_DF_SHIFT) +#define IPV4_HDR_MF_MASK (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) +#define IPV4_HDR_FO_ALIGN (1 << RTE_IPV4_HDR_FO_SHIFT) static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); - fofs = (uint16_t)(fofs + (dofs >> IPV4_HDR_FO_SHIFT)); - fofs = (uint16_t)(fofs | mf << IPV4_HDR_MF_SHIFT); + fofs = (uint16_t)(fofs + (dofs >> RTE_IPV4_HDR_FO_SHIFT)); + fofs = (uint16_t)(fofs | mf << RTE_IPV4_HDR_MF_SHIFT); dst->fragment_offset = rte_cpu_to_be_16(fofs); dst->total_length = rte_cpu_to_be_16(len); dst->hdr_checksum = 0; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 35f7d85cd..97af349bb 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -72,7 +72,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_DF_FLAG)); + rte_cpu_to_be_16(RTE_IPV4_HDR_DF_FLAG)); ip_hdr->hdr_checksum = 0; return m; @@ -106,8 +106,8 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, uint16_t flag_offset, ip_ofs, ip_flag; flag_offset = rte_be_to_cpu_16(ip_hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); psd = (unaligned_uint64_t *)&ip_hdr->src_addr; /* use first 8 bytes only */ @@ -115,7 +115,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, key.id = ip_hdr->packet_id; key.key_len = IPV4_KEYLEN; - ip_ofs *= IPV4_HDR_OFFSET_UNITS; + ip_ofs *= RTE_IPV4_HDR_OFFSET_UNITS; ip_len = (uint16_t)(rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len); diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index 986fd137c..e57932120 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -42,52 +42,52 @@ struct rte_ipv4_hdr { } __attribute__((__packed__)); /** Create IPv4 address */ -#define IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) /** Maximal IPv4 packet length (including a header) */ -#define IPV4_MAX_PKT_LEN 65535 +#define RTE_IPV4_MAX_PKT_LEN 65535 /** Internet header length mask for version_ihl field */ -#define IPV4_HDR_IHL_MASK (0x0f) +#define RTE_IPV4_HDR_IHL_MASK (0x0f) /** * Internet header length field multiplier (IHL field specifies overall header * length in number of 4-byte words) */ -#define IPV4_IHL_MULTIPLIER (4) +#define RTE_IPV4_IHL_MULTIPLIER (4) /* Fragment Offset * Flags. */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_FLAG (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_FLAG (1 << IPV4_HDR_MF_SHIFT) +#define RTE_IPV4_HDR_DF_FLAG (1 << RTE_IPV4_HDR_DF_SHIFT) +#define RTE_IPV4_HDR_MF_FLAG (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_OFFSET_MASK ((1 << IPV4_HDR_MF_SHIFT) - 1) +#define RTE_IPV4_HDR_OFFSET_MASK ((1 << RTE_IPV4_HDR_MF_SHIFT) - 1) -#define IPV4_HDR_OFFSET_UNITS 8 +#define RTE_IPV4_HDR_OFFSET_UNITS 8 /* * IPv4 address types */ -#define IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ -#define IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ -#define IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ -#define IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ -#define IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ -#define IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ +#define RTE_IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ +#define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ +#define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ +#define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ +#define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ +#define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ /* * IPv4 Multicast-related macros */ -#define IPV4_MIN_MCAST IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ -#define IPV4_MAX_MCAST IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ +#define RTE_IPV4_MIN_MCAST RTE_IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ +#define RTE_IPV4_MAX_MCAST RTE_IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ -#define IS_IPV4_MCAST(x) \ - ((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ +#define RTE_IS_IPV4_MCAST(x) \ + ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ /** * @internal Calculate a sum of all words in the buffer. @@ -345,10 +345,10 @@ struct rte_ipv6_hdr { } __attribute__((__packed__)); /* IPv6 vtc_flow: IPv / TC / flow_label */ -#define IPV6_HDR_FL_SHIFT 0 -#define IPV6_HDR_TC_SHIFT 20 -#define IPV6_HDR_FL_MASK ((1u << IPV6_HDR_TC_SHIFT) - 1) -#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT) +#define RTE_IPV6_HDR_FL_SHIFT 0 +#define RTE_IPV6_HDR_TC_SHIFT 20 +#define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1) +#define RTE_IPV6_HDR_TC_MASK (0xf << RTE_IPV6_HDR_TC_SHIFT) /** * Process the pseudo-header checksum of an IPv6 header. diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index dc2a66725..617395fe6 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -296,7 +296,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (ip4h->fragment_offset & rte_cpu_to_be_16( - IPV4_HDR_OFFSET_MASK | IPV4_HDR_MF_FLAG)) { + RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_L4_FRAG; hdr_lens->l4_len = 0; return pkt_type; @@ -427,8 +427,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_INNER_L4_MASK) == 0) return pkt_type; if (ip4h->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_OFFSET_MASK | - IPV4_HDR_MF_FLAG)) { + rte_cpu_to_be_16(RTE_IPV4_HDR_OFFSET_MASK | + RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_INNER_L4_FRAG; hdr_lens->inner_l4_len = 0; return pkt_type; diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index 2e807e805..0d02f97e5 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -155,8 +155,8 @@ process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); - uint16_t frag_offset = (uint16_t)(frag_field & IPV4_HDR_OFFSET_MASK); - uint16_t frag_flag = (uint16_t)(frag_field & IPV4_HDR_MF_FLAG); + uint16_t frag_offset = (uint16_t)(frag_field & RTE_IPV4_HDR_OFFSET_MASK); + uint16_t frag_flag = (uint16_t)(frag_field & RTE_IPV4_HDR_MF_FLAG); /* If it is a fragmented packet, then try to reassemble */ if ((frag_flag == 0) && (frag_offset == 0)) diff --git a/test/test-acl/main.c b/test/test-acl/main.c index 648525af5..4bf533cc0 100644 --- a/test/test-acl/main.c +++ b/test/test-acl/main.c @@ -624,7 +624,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/test/test/test_acl.c b/test/test/test_acl.c index b1f75d1bc..8663ff031 100644 --- a/test/test/test_acl.c +++ b/test/test/test_acl.c @@ -515,15 +515,15 @@ test_build_ports_range(void) static struct ipv4_7tuple test_data[] = { { .proto = 6, - .ip_src = IPv4(10, 1, 1, 1), - .ip_dst = IPv4(192, 168, 0, 33), + .ip_src = RTE_IPv4(10, 1, 1, 1), + .ip_dst = RTE_IPv4(192, 168, 0, 33), .port_dst = 53, .allow = 1, }, { .proto = 6, - .ip_src = IPv4(127, 84, 33, 1), - .ip_dst = IPv4(1, 2, 3, 4), + .ip_src = RTE_IPv4(127, 84, 33, 1), + .ip_dst = RTE_IPv4(1, 2, 3, 4), .port_dst = 65281, .allow = 1, }, diff --git a/test/test/test_acl.h b/test/test/test_acl.h index bbb0447a8..b071f47c3 100644 --- a/test/test/test_acl.h +++ b/test/test/test_acl.h @@ -82,13 +82,13 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { { .data = {.userdata = 1, .category_mask = 1, .priority = 1}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 24, }, { .data = {.userdata = 2, .category_mask = 1, .priority = 1}, - .dst_addr = IPv4(10,0,0,0), + .dst_addr = RTE_IPv4(10,0,0,0), .dst_mask_len = 24, }, /* test src and dst ports */ @@ -124,8 +124,8 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { * results using the wrong data layout. */ struct ipv4_7tuple invalid_layout_data[] = { - {.ip_src = IPv4(10,0,1,0)}, /* should not match */ - {.ip_src = IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ + {.ip_src = RTE_IPv4(10,0,1,0)}, /* should not match */ + {.ip_src = RTE_IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ {.port_src = 100, .allow = 4}, /* should match 4 */ {.port_dst = 0xf, .allow = 6}, /* should match 6 */ }; @@ -142,7 +142,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 1, .category_mask = ACL_ALLOW_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,0,0), + .dst_addr = RTE_IPv4(192,168,0,0), .dst_mask_len = 16, .src_port_low = 0, .src_port_high = 0xffff, @@ -153,7 +153,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 2, .category_mask = ACL_ALLOW_MASK, .priority = 330}, - .dst_addr = IPv4(192,168,1,0), + .dst_addr = RTE_IPv4(192,168,1,0), .dst_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -164,7 +164,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 3, .category_mask = ACL_DENY_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,1,50), + .dst_addr = RTE_IPv4(192,168,1,50), .dst_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -177,7 +177,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 4, .category_mask = ACL_ALLOW_MASK, .priority = 240}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 8, .src_port_low = 0, .src_port_high = 0xffff, @@ -188,7 +188,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 5, .category_mask = ACL_ALLOW_MASK, .priority = 340}, - .src_addr = IPv4(10,1,1,0), + .src_addr = RTE_IPv4(10,1,1,0), .src_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -199,7 +199,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 6, .category_mask = ACL_DENY_MASK, .priority = 240}, - .src_addr = IPv4(10,1,1,1), + .src_addr = RTE_IPv4(10,1,1,1), .src_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -393,9 +393,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { .data = {.userdata = 24, .category_mask = ACL_ALLOW_MASK, .priority = 400}, /** make sure that unmasked bytes don't fail! */ - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 16, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 24, .proto = 0x5, .proto_mask = 0xff, @@ -411,9 +411,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 25, .category_mask = ACL_DENY_MASK, .priority = 400}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 24, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 16, .proto = 0x5, .proto_mask = 0xff, @@ -429,9 +429,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 26, .category_mask = ACL_ALLOW_MASK, .priority = 500}, - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 8, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 32, .proto = 0x5, .proto_mask = 0xff, @@ -445,9 +445,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 27, .category_mask = ACL_DENY_MASK, .priority = 500}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 32, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 8, .proto = 0x5, .proto_mask = 0xff, @@ -463,20 +463,20 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { /* data for ACL unit test */ struct ipv4_7tuple acl_test_data[] = { /* testing single rule aspects */ - {.ip_src = IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ - {.ip_src = IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ - {.ip_src = IPv4(10,1,1,1), .allow = 5, + {.ip_src = RTE_IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ + {.ip_src = RTE_IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ + {.ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 6}, /* should match 5, 6 */ - {.ip_dst = IPv4(10,0,0,0)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,2)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,1)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,0,0,0)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,2)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,1)}, /* should not match */ - {.ip_src = IPv4(192,168,2,50)}, /* should not match */ - {.ip_src = IPv4(192,168,1,2)}, /* should not match */ - {.ip_src = IPv4(192,168,1,50)}, /* should not match */ - {.ip_dst = IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ - {.ip_dst = IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ - {.ip_dst = IPv4(192,168,1,50), .allow = 2, + {.ip_src = RTE_IPv4(192,168,2,50)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,2)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,50)}, /* should not match */ + {.ip_dst = RTE_IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ + {.ip_dst = RTE_IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ + {.ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 3}, /* should match 2, 3 */ {.vlan = 0x64, .allow = 7}, /* should match 7 */ @@ -515,20 +515,20 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .allow = 22, .deny = 23}, /* should match 22, 23 */ /* testing matching multiple rules at once */ - {.vlan = 0x5, .ip_src = IPv4(10,1,1,1), + {.vlan = 0x5, .ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 9}, /* should match 5, 9 */ - {.vlan = 0x5, .ip_src = IPv4(192,168,2,50), + {.vlan = 0x5, .ip_src = RTE_IPv4(192,168,2,50), .allow = 8, .deny = 9}, /* should match 8, 9 */ - {.vlan = 0x55, .ip_src = IPv4(192,168,1,49), + {.vlan = 0x55, .ip_src = RTE_IPv4(192,168,1,49), .allow = 8}, /* should match 8 */ {.port_dst = 80, .port_src = 1024, .allow = 13, .deny = 20}, /* should match 13,20 */ {.port_dst = 79, .port_src = 1024, .allow = 14, .deny = 20}, /* should match 14,20 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,2,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,2,50), .allow = 1, .deny = 23}, /* should match 1, 23 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,1,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 23}, /* should match 2, 23 */ {.vlan = 0x64, .domain = 0x5, .allow = 11, .deny = 12}, /* should match 11, 12 */ @@ -537,16 +537,16 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .port_dst = 80, .allow = 13, .deny = 23}, /* should match 13, 23 */ {.proto = 0x51, .port_src = 5000}, /* should not match */ - {.ip_src = IPv4(192,168,1,50), - .ip_dst = IPv4(10,0,0,0), + {.ip_src = RTE_IPv4(192,168,1,50), + .ip_dst = RTE_IPv4(10,0,0,0), .proto = 0x51, .port_src = 5000, .port_dst = 5000}, /* should not match */ /* test full packet rules */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -556,8 +556,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 24 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -567,8 +567,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 25 }, /* should match 13, 25 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -577,8 +577,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 26 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -587,8 +587,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 27 }, /* should match 13, 27 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -597,8 +597,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 13, 23 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -610,8 +610,8 @@ struct ipv4_7tuple acl_test_data[] = { /* visual separator! */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x55, .vlan = 0x8000, .domain = 0x6464, @@ -620,8 +620,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x55, .vlan = 0x8100, .domain = 0x6464, @@ -630,8 +630,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -639,8 +639,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -648,8 +648,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -657,8 +657,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x50, .vlan = 0x6466, .port_src = 12345, diff --git a/test/test/test_efd.c b/test/test/test_efd.c index ced091aab..0f90c923a 100644 --- a/test/test/test_efd.c +++ b/test/test/test_efd.c @@ -60,36 +60,36 @@ static void print_key_info(__attribute__((unused)) const char *msg, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index 96e371691..ad6c481fe 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -95,7 +95,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" */ static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, IPv4(2, 2, 2, 3), IPv4(2, 2, 2, 7)} + { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, RTE_IPv4(2, 2, 2, 3), RTE_IPv4(2, 2, 2, 7)} }; static const struct rte_flow_item_ipv4 ipv4_mask_24 = { .hdr = { @@ -131,7 +131,7 @@ static struct rte_flow_item end_item_bad = { -1, 0, 0, 0 }; * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" */ static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, IPv4(1, 2, 3, 4), IPv4(5, 6, 7, 8)} + { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, RTE_IPv4(1, 2, 3, 4), RTE_IPv4(5, 6, 7, 8)} }; static struct rte_flow_item_tcp tcp_spec_1 = { @@ -149,8 +149,8 @@ static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" */ static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, IPv4(11, 12, 13, 14), - IPv4(15, 16, 17, 18)} + { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, RTE_IPv4(11, 12, 13, 14), + RTE_IPv4(15, 16, 17, 18)} }; static struct rte_flow_item_sctp sctp_spec_1 = { diff --git a/test/test/test_hash.c b/test/test/test_hash.c index b3db9fd10..2ba79b749 100644 --- a/test/test/test_hash.c +++ b/test/test/test_hash.c @@ -106,32 +106,32 @@ static void print_key_info(__attribute__((unused)) const char *msg, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index fba629d43..4968cd91c 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -728,8 +728,8 @@ generate_packets(struct rte_ether_addr *src_mac, uint16_t src_port = 10, dst_port = 20; - uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; - uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; + uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = RTE_IPv4(192, 168, 0, 1) }; + uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; diff --git a/test/test/test_lpm.c b/test/test/test_lpm.c index 5d697dd0f..0f24631ac 100644 --- a/test/test/test_lpm.c +++ b/test/test/test_lpm.c @@ -165,7 +165,7 @@ test3(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop = 100; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop = 100; uint8_t depth = 24; int32_t status = 0; @@ -203,7 +203,7 @@ test4(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0); + uint32_t ip = RTE_IPv4(0, 0, 0, 0); uint8_t depth = 24; int32_t status = 0; @@ -242,7 +242,7 @@ test5(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_return = 0; int32_t status = 0; /* rte_lpm_lookup: lpm == NULL */ @@ -276,7 +276,7 @@ test6(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 24; int32_t status = 0; @@ -315,7 +315,7 @@ test7(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 32; int32_t status = 0; @@ -366,7 +366,7 @@ test8(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip1 = IPv4(127, 255, 255, 255), ip2 = IPv4(128, 0, 0, 0); + uint32_t ip1 = RTE_IPv4(127, 255, 255, 255), ip2 = RTE_IPv4(128, 0, 0, 0); uint32_t next_hop_add, next_hop_return; uint8_t depth; int32_t status = 0; @@ -457,7 +457,7 @@ test9(void) int32_t status = 0; /* Add & lookup to hit invalid TBL24 entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -479,7 +479,7 @@ test9(void) rte_lpm_delete_all(lpm); /* Add & lookup to hit valid TBL24 entry not extended */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 23; next_hop_add = 100; @@ -515,7 +515,7 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with invalid TBL8 * entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -525,7 +525,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 5); + ip = RTE_IPv4(128, 0, 0, 5); depth = 32; next_hop_add = 101; @@ -541,7 +541,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -558,11 +558,11 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with valid TBL8 * entry */ - ip_1 = IPv4(128, 0, 0, 0); + ip_1 = RTE_IPv4(128, 0, 0, 0); depth_1 = 25; next_hop_add_1 = 101; - ip_2 = IPv4(128, 0, 0, 5); + ip_2 = RTE_IPv4(128, 0, 0, 5); depth_2 = 32; next_hop_add_2 = 102; @@ -629,7 +629,7 @@ test10(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 16; next_hop_add = 100; @@ -647,7 +647,7 @@ test10(void) rte_lpm_delete_all(lpm); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 25; next_hop_add = 100; @@ -665,14 +665,14 @@ test10(void) /* Add rule that extends a TBL24 valid entry & lookup for both rules * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -682,13 +682,13 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -697,7 +697,7 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -711,7 +711,7 @@ test10(void) /* Add rule that updates the next hop in TBL24 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -740,7 +740,7 @@ test10(void) /* Add rule that updates the next hop in TBL8 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -768,7 +768,7 @@ test10(void) /* Delete a rule that is not present in the TBL24 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -781,7 +781,7 @@ test10(void) /* Delete a rule that is not present in the TBL8 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -818,14 +818,14 @@ test11(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -835,13 +835,13 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -850,7 +850,7 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -889,7 +889,7 @@ test12(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -944,7 +944,7 @@ test13(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add_1 = 100; @@ -1014,10 +1014,10 @@ test14(void) depth = 32; next_hop_add = 100; - ip = IPv4(0, 0, 0, 0); + ip = RTE_IPv4(0, 0, 0, 0); /* Add 256 rules that require a tbl8 extension */ - for (; ip <= IPv4(0, 0, 255, 0); ip += 256) { + for (; ip <= RTE_IPv4(0, 0, 255, 0); ip += 256) { status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); @@ -1028,7 +1028,7 @@ test14(void) /* All tbl8 extensions have been used above. Try to add one more and * we get a fail */ - ip = IPv4(1, 0, 0, 0); + ip = RTE_IPv4(1, 0, 0, 0); depth = 32; status = rte_lpm_add(lpm, ip, depth, next_hop_add); @@ -1125,9 +1125,9 @@ test17(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - const uint32_t ip_10_32 = IPv4(10, 10, 10, 2); - const uint32_t ip_10_24 = IPv4(10, 10, 10, 0); - const uint32_t ip_20_25 = IPv4(10, 10, 20, 2); + const uint32_t ip_10_32 = RTE_IPv4(10, 10, 10, 2); + const uint32_t ip_10_24 = RTE_IPv4(10, 10, 10, 0); + const uint32_t ip_20_25 = RTE_IPv4(10, 10, 20, 2); const uint8_t d_ip_10_32 = 32, d_ip_10_24 = 24, d_ip_20_25 = 25; @@ -1221,7 +1221,7 @@ test18(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(192, 168, 100, 100); + ip = RTE_IPv4(192, 168, 100, 100); depth = 28; next_hop = 1; rte_lpm_add(lpm, ip, depth, next_hop); diff --git a/test/test/test_lpm_perf.c b/test/test/test_lpm_perf.c index 3b98ce0c8..b54650367 100644 --- a/test/test/test_lpm_perf.c +++ b/test/test/test_lpm_perf.c @@ -285,11 +285,11 @@ static void generate_large_route_rule_table(void) * they are 4 rules with private local IP address and 1 all-zeros prefix * with depth = 8. */ - insert_rule_in_random_pos(IPv4(0, 0, 0, 0), 8); - insert_rule_in_random_pos(IPv4(10, 2, 23, 147), 32); - insert_rule_in_random_pos(IPv4(192, 168, 100, 10), 24); - insert_rule_in_random_pos(IPv4(192, 168, 25, 100), 24); - insert_rule_in_random_pos(IPv4(192, 168, 129, 124), 32); + insert_rule_in_random_pos(RTE_IPv4(0, 0, 0, 0), 8); + insert_rule_in_random_pos(RTE_IPv4(10, 2, 23, 147), 32); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 100, 10), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 25, 100), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 129, 124), 32); } static void diff --git a/test/test/test_member.c b/test/test/test_member.c index e2a3932f2..53287fcaf 100644 --- a/test/test/test_member.c +++ b/test/test/test_member.c @@ -41,36 +41,36 @@ struct flow_key { /* Keys used by unit test functions */ static struct flow_key keys[NUM_SAMPLES] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/test/test/test_sched.c b/test/test/test_sched.c index 1611fc64c..8b063d2e3 100644 --- a/test/test/test_sched.c +++ b/test/test/test_sched.c @@ -92,7 +92,7 @@ prepare_pkt(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(RTE_ETHER_TYPE_IPv4); - ip_hdr->dst_addr = IPv4(0,0,TC,QUEUE); + ip_hdr->dst_addr = RTE_IPv4(0,0,TC,QUEUE); rte_sched_port_pkt_write(mbuf, SUBPORT, PIPE, TC, QUEUE, e_RTE_METER_YELLOW); diff --git a/test/test/test_table_acl.c b/test/test/test_table_acl.c index 33e2f6ee6..a851deaac 100644 --- a/test/test/test_table_acl.c +++ b/test/test/test_table_acl.c @@ -6,7 +6,7 @@ #include "test_table.h" #include "test_table_acl.h" -#define IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -115,7 +115,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; @@ -661,8 +661,8 @@ test_pipeline_single_filter(int expected_count) sizeof(struct ipv4_5tuple)); five_tuple.proto = j; - five_tuple.ip_src = rte_bswap32(IPv4(192, 168, j, 1)); - five_tuple.ip_dst = rte_bswap32(IPv4(10, 4, j, 1)); + five_tuple.ip_src = rte_bswap32(RTE_IPv4(192, 168, j, 1)); + five_tuple.ip_dst = rte_bswap32(RTE_IPv4(10, 4, j, 1)); five_tuple.port_src = rte_bswap16(100 + j); five_tuple.port_dst = rte_bswap16(200 + j); diff --git a/test/test/test_thash.c b/test/test/test_thash.c index bf332c9e9..3724ea5be 100644 --- a/test/test/test_thash.c +++ b/test/test/test_thash.c @@ -59,15 +59,15 @@ struct test_thash_v6 { /*From 82599 Datasheet 7.1.2.8.3 RSS Verification Suite*/ struct test_thash_v4 v4_tbl[] = { -{IPv4(161, 142, 100, 80), IPv4(66, 9, 149, 187), +{RTE_IPv4(161, 142, 100, 80), RTE_IPv4(66, 9, 149, 187), 1766, 2794, 0x323e8fc2, 0x51ccc178}, -{IPv4(65, 69, 140, 83), IPv4(199, 92, 111, 2), +{RTE_IPv4(65, 69, 140, 83), RTE_IPv4(199, 92, 111, 2), 4739, 14230, 0xd718262a, 0xc626b0ea}, -{IPv4(12, 22, 207, 184), IPv4(24, 19, 198, 95), +{RTE_IPv4(12, 22, 207, 184), RTE_IPv4(24, 19, 198, 95), 38024, 12898, 0xd2d0a5de, 0x5c2b394a}, -{IPv4(209, 142, 163, 6), IPv4(38, 27, 205, 30), +{RTE_IPv4(209, 142, 163, 6), RTE_IPv4(38, 27, 205, 30), 2217, 48228, 0x82989176, 0xafc7327f}, -{IPv4(202, 188, 127, 2), IPv4(153, 39, 163, 191), +{RTE_IPv4(202, 188, 127, 2), RTE_IPv4(153, 39, 163, 191), 1303, 44251, 0x5d1809c5, 0x10e828a2}, }; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 12/14] net: add rte prefix to sctp structure 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (10 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 11/14] net: add rte prefix to ip defines Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 13/14] net: add rte prefix to tcp structure Olivier Matz ` (8 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct sctp_hdr as struct rte_sctp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 4 ++-- drivers/net/avf/avf_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 4 ++-- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- examples/tep_termination/vxlan.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_sctp.h | 2 +- lib/librte_vhost/virtio_net.c | 4 ++-- test/test/packet_burst_generator.c | 6 +++--- test/test/packet_burst_generator.h | 2 +- test/test/test_flow_classify.c | 2 +- 16 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 23f16bab3..d8b892941 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -361,7 +361,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -428,7 +428,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_TCP_SEG; } else if (info->l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *)((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ diff --git a/drivers/net/avf/avf_rxtx.c b/drivers/net/avf/avf_rxtx.c index 9203b74b8..157744937 100644 --- a/drivers/net/avf/avf_rxtx.c +++ b/drivers/net/avf/avf_rxtx.c @@ -1422,7 +1422,7 @@ avf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= AVF_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << AVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index e0834ab58..8b6fddbd7 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -295,7 +295,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; default: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_RSV | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index ddfa52776..96a3aac87 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -148,7 +148,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -169,7 +169,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, input->flow.ip4_flow.proto = 132; enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP || @@ -236,7 +236,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -257,7 +257,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, input->flow.ipv6_flow.proto = 132; enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP || diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index ede89c8f8..d3cbbd4c7 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -833,9 +833,9 @@ enic_copy_item_sctp_v2(const struct rte_flow_item *item, mask = &rte_flow_item_sctp_mask; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index b20f30fb4..14a82426e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -801,7 +801,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload, *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -841,8 +841,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -886,8 +886,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1091,7 +1091,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; struct rte_ipv6_hdr *gtp_ipv6; @@ -1138,8 +1138,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->dst_port = fdir_input->flow.tcp4_flow.src_port; tcp->data_off = I40E_FDIR_TCP_DEFAULT_DATAOFF; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1175,8 +1175,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->src_port = fdir_input->flow.udp6_flow.dst_port; tcp->dst_port = fdir_input->flow.udp6_flow.src_port; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 1227a4daa..82bbac2ce 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -303,7 +303,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 6d9224d4f..eb41f5ed0 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -432,7 +432,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_SCTP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 8088d9412..07a53abc3 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -77,7 +77,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; info->l2_len = sizeof(struct rte_ether_hdr); @@ -126,7 +126,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i tcp_hdr->cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *)((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; ol_flags |= PKT_TX_SCTP_CKSUM; } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 4e0a84aff..23f7cb9b5 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -723,7 +723,7 @@ static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { * Matches a SCTP header. */ struct rte_flow_item_sctp { - struct sctp_hdr hdr; /**< SCTP header definition. */ + struct rte_sctp_hdr hdr; /**< SCTP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 617395fe6..3e9d2d23d 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -351,7 +351,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = (th->data_off & 0xf0) >> 2; return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_SCTP) { - hdr_lens->l4_len = sizeof(struct sctp_hdr); + hdr_lens->l4_len = sizeof(struct rte_sctp_hdr); return pkt_type; } else { uint32_t prev_off = off; @@ -487,7 +487,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = (th->data_off & 0xf0) >> 2; } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_SCTP) { - hdr_lens->inner_l4_len = sizeof(struct sctp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_sctp_hdr); } else { hdr_lens->inner_l4_len = 0; } diff --git a/lib/librte_net/rte_sctp.h b/lib/librte_net/rte_sctp.h index bfb7165a6..b3661b0db 100644 --- a/lib/librte_net/rte_sctp.h +++ b/lib/librte_net/rte_sctp.h @@ -23,7 +23,7 @@ extern "C" { /** * SCTP Header */ -struct sctp_hdr { +struct rte_sctp_hdr { uint16_t src_port; /**< Source port. */ uint16_t dst_port; /**< Destin port. */ uint32_t tag; /**< Validation tag. */ diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 9736a7339..cbfc1a627 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -252,7 +252,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: - net_hdr->csum_offset = (offsetof(struct sctp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_sctp_hdr, cksum)); break; } @@ -1031,7 +1031,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; - case (offsetof(struct sctp_hdr, cksum)): + case (offsetof(struct rte_sctp_hdr, cksum)): if (l4_proto == IPPROTO_SCTP) m->ol_flags |= PKT_TX_SCTP_CKSUM; break; diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index 886b5f8ac..9aa07e176 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -121,7 +121,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, } uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -394,7 +394,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; default: @@ -416,7 +416,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; default: diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index 93efee1f5..98185c162 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -42,7 +42,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index ad6c481fe..85228486d 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -565,7 +565,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct sctp_hdr pkt_sctp_hdr; + struct rte_sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); uint16_t src_port = 10; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 13/14] net: add rte prefix to tcp structure 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (11 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 12/14] net: add rte prefix to sctp structure Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 14/14] net: add rte prefix to udp structure Olivier Matz ` (7 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct tcp_hdr as struct rte_tcp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 12 ++++++------ doc/guides/sample_app_ug/flow_classify.rst | 4 ++-- drivers/net/avf/avf_rxtx.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 14 +++++++------- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/mlx5/mlx5_flow_tcf.c | 4 ++-- drivers/net/qede/qede_filter.c | 12 ++++++------ drivers/net/sfc/sfc_ef10_tx.c | 4 ++-- drivers/net/sfc/sfc_tso.c | 4 ++-- drivers/net/softnic/rte_eth_softnic_pipeline.c | 8 ++++---- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 4 ++-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 14 +++++++------- examples/flow_classify/flow_classify.c | 4 ++-- examples/ip_pipeline/pipeline.c | 8 ++++---- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 4 ++-- examples/vhost/main.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_tcp4.c | 4 ++-- lib/librte_gro/gro_tcp4.h | 8 ++++---- lib/librte_gro/gro_vxlan_tcp4.c | 6 +++--- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/gso_tcp4.c | 4 ++-- lib/librte_gso/gso_tunnel_tcp4.c | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_net.c | 8 ++++---- lib/librte_net/rte_net.h | 6 +++--- lib/librte_net/rte_tcp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 8 ++++---- lib/librte_vhost/virtio_net.c | 6 +++--- test/test/packet_burst_generator.c | 10 +++++----- test/test/packet_burst_generator.h | 2 +- test/test/test_flow_classify.c | 6 +++--- 44 files changed, 126 insertions(+), 126 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index d8b892941..bcff65eee 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -102,14 +102,14 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) static void parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4; info->l4_proto = ipv4_hdr->next_proto_id; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else info->l4_len = 0; @@ -119,14 +119,14 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) static void parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv6_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else info->l4_len = 0; @@ -360,7 +360,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -414,7 +414,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_UDP_SEG; } else if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 8172a96c4..1b354c31a 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -126,7 +126,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -136,7 +136,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/avf/avf_rxtx.c b/drivers/net/avf/avf_rxtx.c index 157744937..d3a63e6c0 100644 --- a/drivers/net/avf/avf_rxtx.c +++ b/drivers/net/avf/avf_rxtx.c @@ -1417,7 +1417,7 @@ avf_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= AVF_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << AVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index dd7d3fb20..8a6d52ea9 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -835,7 +835,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, int i; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { @@ -860,7 +860,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *) + tcp_hdr = (struct rte_tcp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); l4hash = HASH_L4_PORTS(tcp_hdr); @@ -878,7 +878,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l3hash = ipv6_hash(ipv6_hdr); if (ipv6_hdr->proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)(ipv6_hdr + 1); + tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 9aa31ad42..fb7f3cd52 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -218,7 +218,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + + struct rte_tcp_hdr *tcp_hdr = (struct rte_tcp_hdr *)(l3_hdr + mbuf->l3_len); tcp_hdr->cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 84c0c537b..27146607c 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -247,7 +247,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, break; case PKT_TX_TCP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct tcp_hdr, cksum)); + offsetof(struct rte_tcp_hdr, cksum)); cmd_len |= E1000_TXD_CMD_TCP; cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 8b6fddbd7..9046d21a9 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -290,7 +290,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index eaeed9fee..198d731c9 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -74,7 +74,7 @@ #define TEST_BIT(val, bit_shift) (val & (1UL << bit_shift)) #define GET_L4_HDR_LEN(mbuf) \ - ((rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, \ + ((rte_pktmbuf_mtod_offset(mbuf, struct rte_tcp_hdr *, \ mbuf->l3_len + mbuf->l2_len)->data_off) >> 4) #define ENA_RX_RSS_TABLE_LOG_SIZE 7 diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 96a3aac87..c9d898044 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -132,7 +132,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -146,7 +146,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); @@ -221,7 +221,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -234,7 +234,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, tcp_val.dst_port = input->flow.tcp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index d3cbbd4c7..fd5b2d190 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -448,7 +448,7 @@ enic_copy_item_tcp_v1(const struct rte_flow_item *item, const struct rte_flow_item_tcp *spec = item->spec; const struct rte_flow_item_tcp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct tcp_hdr supported_mask = { + struct rte_tcp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -785,19 +785,19 @@ enic_copy_item_tcp_v2(const struct rte_flow_item *item, if (*inner_ofst == 0) { memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); } else { /* Inner IPv6 header. Mask/Val start at *inner_ofst into L5 */ - if ((*inner_ofst + sizeof(struct tcp_hdr)) > + if ((*inner_ofst + sizeof(struct rte_tcp_hdr)) > FILTER_GENERIC_1_KEY_LEN) return ENOTSUP; memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst], - mask, sizeof(struct tcp_hdr)); + mask, sizeof(struct rte_tcp_hdr)); memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst], - spec, sizeof(struct tcp_hdr)); - *inner_ofst += sizeof(struct tcp_hdr); + spec, sizeof(struct rte_tcp_hdr)); + *inner_ofst += sizeof(struct rte_tcp_hdr); } return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 14a82426e..46dfa79b7 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -800,7 +800,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload, *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ @@ -828,8 +828,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -873,8 +873,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1090,7 +1090,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload = NULL; unsigned char *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; @@ -1127,8 +1127,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp4_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1164,8 +1164,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp6_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 82bbac2ce..e5f18538f 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -298,7 +298,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index eb41f5ed0..036acaa14 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -425,7 +425,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index d99e2c526..76af6a8b6 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2563,11 +2563,11 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp4_flow.src_port, .dst_port = input->flow.tcp4_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2593,11 +2593,11 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp6_flow.src_port, .dst_port = input->flow.tcp6_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index f287762a4..7cfc72cdf 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -452,8 +452,8 @@ flow_tcf_pedit_key_set_tp_port(const struct rte_flow_action *actions, /* offset of src/dst port is same for TCP and UDP */ p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC ? - offsetof(struct tcp_hdr, src_port) : - offsetof(struct tcp_hdr, dst_port); + offsetof(struct rte_tcp_hdr, src_port) : + offsetof(struct rte_tcp_hdr, dst_port); p_parser->keys[idx].mask = 0xFFFF0000; p_parser->keys[idx].val = (__u32)((const struct rte_flow_action_set_tp *) diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 34299b993..cd762cddb 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -460,7 +460,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; uint16_t len; raw_pkt = (uint8_t *)buff; @@ -496,13 +496,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, ip->total_length += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct tcp_hdr); + ip->total_length += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; @@ -528,11 +528,11 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, len += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index e52de8ebd..06dc5b6e4 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -329,7 +329,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, size_t header_len = m_seg->l2_len + m_seg->l3_len + m_seg->l4_len; /* Offset of the payload in the last segment that contains the header */ size_t in_off = 0; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; uint16_t packet_id; uint32_t sent_seq; uint8_t *hdr_addr; @@ -437,7 +437,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, return EINVAL; } - th = (const struct tcp_hdr *)(hdr_addr + tcph_off); + th = (const struct rte_tcp_hdr *)(hdr_addr + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index cfa5c037a..2675ee19e 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -95,7 +95,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, unsigned int *pkt_descs, size_t *pkt_len) { uint8_t *tsoh; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; efsys_dma_addr_t header_paddr; uint16_t packet_id; uint32_t sent_seq; @@ -158,7 +158,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, } /* Handle TCP header */ - th = (const struct tcp_hdr *)(tsoh + tcph_off); + th = (const struct rte_tcp_hdr *)(tsoh + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 4e6735c75..9e85f461b 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -620,7 +620,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -630,7 +630,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -717,7 +717,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -727,7 +727,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 3d7f56a9a..dd19f0119 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -475,7 +475,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) - *l4_cksum = &((struct tcp_hdr *)l4_hdr)->cksum; + *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else return; **l4_cksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index b36450871..429beded8 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -318,7 +318,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) m->l4_len)) { struct rte_ipv4_hdr *iph; struct rte_ipv6_hdr *ip6h; - struct tcp_hdr *th; + struct rte_tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; @@ -373,7 +373,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, case PKT_TX_TCP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct tcp_hdr, cksum); + hdr->csum_offset = offsetof(struct rte_tcp_hdr, cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 3bbf9adf7..8726eabb9 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -539,7 +539,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, switch (txm->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct tcp_hdr, cksum); + gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); @@ -667,7 +667,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, uint32_t hlen, slen; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; char *ptr; RTE_ASSERT(rcd->tcp); @@ -679,7 +679,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) return hw->mtu - sizeof(struct rte_ipv4_hdr) - - sizeof(struct tcp_hdr); + - sizeof(struct rte_tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * @@ -687,7 +687,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - - sizeof(struct tcp_hdr); + sizeof(struct rte_tcp_hdr); ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); hlen += sizeof(struct rte_ipv6_hdr); @@ -699,11 +699,11 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } } - if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) - return hw->mtu - hlen - sizeof(struct tcp_hdr) + + if (unlikely(slen < hlen + sizeof(struct rte_tcp_hdr))) + return hw->mtu - hlen - sizeof(struct rte_tcp_hdr) + sizeof(struct rte_ether_hdr); - tcp_hdr = (struct tcp_hdr *)(ptr + hlen); + tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; if (rxm->udata64 > 1) diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index e68d0f694..75a66fd5b 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -133,7 +133,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -143,7 +143,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index 1e44fe37c..e0a8e9a6b 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -664,7 +664,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -674,7 +674,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -761,7 +761,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -771,7 +771,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index f78aeab53..72d2c53e1 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -485,7 +485,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -495,7 +495,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); @@ -524,7 +524,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -535,7 +535,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 5e3809b8d..d57ac262b 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -366,7 +366,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -376,7 +376,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 07a53abc3..261332adf 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -76,7 +76,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -112,7 +112,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); /* Put PKT_TX_TCP_SEG bit setting before get_psd_sum(), because * it depends on PKT_TX_TCP_SEG to calculate pseudo-header * checksum. diff --git a/examples/vhost/main.c b/examples/vhost/main.c index d7ee4530e..a973cb4b1 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -879,7 +879,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; struct rte_ipv4_hdr *ipv4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); l3_hdr = (char *)eth_hdr + m->l2_len; @@ -890,7 +890,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) m->ol_flags |= PKT_TX_IP_CKSUM; } - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + m->l3_len); tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags); } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 23f7cb9b5..cea95b98a 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -704,7 +704,7 @@ static const struct rte_flow_item_udp rte_flow_item_udp_mask = { * Matches a TCP header. */ struct rte_flow_item_tcp { - struct tcp_hdr hdr; /**< TCP header definition. */ + struct rte_tcp_hdr hdr; /**< TCP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 3ed8cda02..73dbb8dd5 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -196,7 +196,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t tcp_dl, ip_id, hdr_len, frag_off; uint8_t is_atomic; @@ -209,7 +209,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; /* diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index e33b65083..63f06bec4 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -255,7 +255,7 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, */ static inline int check_seq_option(struct gro_tcp4_item *item, - struct tcp_hdr *tcph, + struct rte_tcp_hdr *tcph, uint32_t sent_seq, uint16_t ip_id, uint16_t tcp_hl, @@ -265,16 +265,16 @@ check_seq_option(struct gro_tcp4_item *item, { struct rte_mbuf *pkt_orig = item->firstseg; struct rte_ipv4_hdr *iph_orig; - struct tcp_hdr *tcph_orig; + struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); - tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); + tcph_orig = (struct rte_tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; /* Check if TCP option fields equal */ - len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct tcp_hdr); + len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct rte_tcp_hdr); if ((tcp_hl != tcp_hl_orig) || ((len > 0) && (memcmp(tcph + 1, tcph_orig + 1, len) != 0))) diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 80d2d5288..3cfe20f75 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -207,7 +207,7 @@ is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, static inline int check_vxlan_seq_option(struct gro_vxlan_tcp4_item *item, - struct tcp_hdr *tcp_hdr, + struct rte_tcp_hdr *tcp_hdr, uint32_t sent_seq, uint16_t outer_ip_id, uint16_t ip_id, @@ -291,7 +291,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; @@ -315,7 +315,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* * Don't process the packet which has FIN, SYN, RST, PSH, URG, diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index e5c8d83e7..a35030153 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -71,9 +71,9 @@ static inline void update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, uint8_t non_tail) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; - tcp_hdr = (struct tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + tcp_hdr = (struct rte_tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l4_offset); tcp_hdr->sent_seq = rte_cpu_to_be_32(sent_seq); if (likely(non_tail)) diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index ad0cce6f9..ade172ac7 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -10,7 +10,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; @@ -18,7 +18,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index f5a19bc43..e0384c26d 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -10,7 +10,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; uint16_t outer_ipv4_offset, inner_ipv4_offset; @@ -32,7 +32,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index ee879968c..8f65adf1c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,7 +19,7 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 3e9d2d23d..9712c75ac 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -341,8 +341,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = sizeof(struct udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) @@ -477,8 +477,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = sizeof(struct udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 84f8dfe1c..4c27f4611 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -114,7 +114,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -149,7 +149,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) (ol_flags & PKT_TX_TCP_SEG)) { if (ol_flags & PKT_TX_IPV4) { /* non-TSO tcp or TSO */ - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + m->l3_len); tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -157,7 +157,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ - tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, + tcp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_tcp_hdr *, inner_l3_offset + m->l3_len); tcp_hdr->cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h index 91f58987b..4bcda5565 100644 --- a/lib/librte_net/rte_tcp.h +++ b/lib/librte_net/rte_tcp.h @@ -23,7 +23,7 @@ extern "C" { /** * TCP Header */ -struct tcp_hdr { +struct rte_tcp_hdr { uint16_t src_port; /**< TCP source port. */ uint16_t dst_port; /**< TCP destination port. */ uint32_t sent_seq; /**< TX data sequence number. */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index c7b04d6f5..15bbdd674 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -1293,7 +1293,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1332,7 +1332,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1379,7 +1379,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, @@ -1407,7 +1407,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index cbfc1a627..11e76386c 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -244,7 +244,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) switch (csum_l4) { case PKT_TX_TCP_CKSUM: - net_hdr->csum_offset = (offsetof(struct tcp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_tcp_hdr, cksum)); break; case PKT_TX_UDP_CKSUM: @@ -1014,7 +1014,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) { uint16_t l4_proto = 0; void *l4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; if (hdr->flags == 0 && hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE) return; @@ -1023,7 +1023,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (hdr->flags == VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (hdr->csum_start == (m->l2_len + m->l3_len)) { switch (hdr->csum_offset) { - case (offsetof(struct tcp_hdr, cksum)): + case (offsetof(struct rte_tcp_hdr, cksum)): if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index 9aa07e176..5730f8129 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -106,14 +106,14 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, } uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct tcp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_tcp_hdr)); - memset(tcp_hdr, 0, sizeof(struct tcp_hdr)); + memset(tcp_hdr, 0, sizeof(struct rte_tcp_hdr)); tcp_hdr->src_port = rte_cpu_to_be_16(src_port); tcp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -389,7 +389,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: @@ -411,7 +411,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index 98185c162..5cfe0c600 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -38,7 +38,7 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index 85228486d..1a79326b8 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -74,7 +74,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -84,7 +84,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -528,7 +528,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct tcp_hdr pkt_tcp_hdr; + struct rte_tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); uint16_t src_port = 16; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC 14/14] net: add rte prefix to udp structure 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (12 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 13/14] net: add rte prefix to tcp structure Olivier Matz @ 2018-10-24 8:18 ` Olivier Matz 2018-10-24 8:32 ` [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (6 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:18 UTC (permalink / raw) To: dev Add 'rte_' prefix to structures: - rename struct udp_hdr as struct rte_udp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 20 ++++++++++---------- app/test-pmd/flowgen.c | 4 ++-- app/test-pmd/txonly.c | 8 ++++---- app/test-pmd/util.c | 6 +++--- drivers/net/avf/avf_rxtx.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 14 +++++++------- drivers/net/i40e/i40e_fdir.c | 24 ++++++++++++------------ drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/qede/qede_filter.c | 14 +++++++------- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 2 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 16 ++++++++-------- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 10 +++++----- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_ether.h | 4 ++-- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_net.h | 6 +++--- lib/librte_net/rte_udp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 32 ++++++++++++++++---------------- lib/librte_vhost/virtio_net.c | 6 +++--- test/test/packet_burst_generator.c | 12 ++++++------ test/test/packet_burst_generator.h | 4 ++-- test/test/test_flow_classify.c | 2 +- test/test/test_link_bonding.c | 4 ++-- test/test/test_link_bonding_mode4.c | 2 +- test/test/test_pmd_perf.c | 2 +- 38 files changed, 128 insertions(+), 128 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index bcff65eee..532d1e569 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -172,7 +172,7 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) /* Parse a vxlan header */ static void -parse_vxlan(struct udp_hdr *udp_hdr, +parse_vxlan(struct rte_udp_hdr *udp_hdr, struct testpmd_offload_info *info, uint32_t pkt_type) { @@ -192,7 +192,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, info->outer_l4_proto = info->l4_proto; eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); @@ -201,7 +201,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, /* Parse a vxlan-gpe header */ static void -parse_vxlan_gpe(struct udp_hdr *udp_hdr, +parse_vxlan_gpe(struct rte_udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; @@ -215,7 +215,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, return; vxlan_gpe_hdr = (struct rte_vxlan_gpe_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == RTE_VXLAN_GPE_TYPE_IPV4) { @@ -359,7 +359,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -399,7 +399,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, return 0; /* packet type not supported, nothing to do */ if (info->l4_proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info->l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; @@ -451,7 +451,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint64_t ol_flags = 0; if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPv4)) { @@ -474,7 +474,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, return ol_flags; } - udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len); /* outer UDP checksum is done in software. In the other side, for * UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be @@ -772,9 +772,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* check if it's a supported tunnel */ if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info.l3_len); parse_vxlan_gpe(udp_hdr, &info); if (info.is_tunnel) { diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 0405fe9b6..0a202467b 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -121,7 +121,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ip_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags; uint16_t nb_rx; @@ -193,7 +193,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) sizeof(*ip_hdr)); /* Initialize UDP header. */ - udp_hdr = (struct udp_hdr *)(ip_hdr + 1); + udp_hdr = (struct rte_udp_hdr *)(ip_hdr + 1); udp_hdr->src_port = rte_cpu_to_be_16(cfg_udp_src); udp_hdr->dst_port = rte_cpu_to_be_16(cfg_udp_dst); udp_hdr->dgram_cksum = 0; /* No UDP checksum. */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 5d76e471e..dd70d96a8 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -52,7 +52,7 @@ #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ -static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ +static struct rte_udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ static void copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt, @@ -93,7 +93,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) static void setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, - struct udp_hdr *udp_hdr, + struct rte_udp_hdr *udp_hdr, uint16_t pkt_data_len) { uint16_t *ptr16; @@ -103,7 +103,7 @@ setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, /* * Initialize UDP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(UDP_SRC_PORT); udp_hdr->dst_port = rte_cpu_to_be_16(UDP_DST_PORT); udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt_len); @@ -298,7 +298,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - sizeof(struct udp_hdr))); + sizeof(struct rte_udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index fe8b18bd3..cd0495802 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -104,7 +104,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (is_encapsulation) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; uint8_t l4_len; @@ -129,9 +129,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], } if (l4_proto == IPPROTO_UDP) { udp_hdr = rte_pktmbuf_mtod_offset(mb, - struct udp_hdr *, + struct rte_udp_hdr *, l2_len + l3_len); - l4_len = sizeof(struct udp_hdr); + l4_len = sizeof(struct rte_udp_hdr); vxlan_hdr = rte_pktmbuf_mtod_offset(mb, struct rte_vxlan_hdr *, l2_len + l3_len + l4_len); diff --git a/drivers/net/avf/avf_rxtx.c b/drivers/net/avf/avf_rxtx.c index d3a63e6c0..5aebbd3fe 100644 --- a/drivers/net/avf/avf_rxtx.c +++ b/drivers/net/avf/avf_rxtx.c @@ -1427,7 +1427,7 @@ avf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= AVF_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << AVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; default: diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 8a6d52ea9..a1409cdb3 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -834,7 +834,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, size_t vlan_offset; int i; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; @@ -866,7 +866,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *) + udp_hdr = (struct rte_udp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); l4hash = HASH_L4_PORTS(udp_hdr); @@ -881,7 +881,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); + udp_hdr = (struct rte_udp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(udp_hdr); } } diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index fb7f3cd52..a50cc4cd6 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -229,7 +229,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) tcp_hdr); } else if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) { - struct udp_hdr *udp_hdr = (struct udp_hdr *)(l3_hdr + + struct rte_udp_hdr *udp_hdr = (struct rte_udp_hdr *)(l3_hdr + mbuf->l3_len); udp_hdr->dgram_cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 27146607c..e81ac204b 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -242,7 +242,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, switch (flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct udp_hdr, dgram_cksum)); + offsetof(struct rte_udp_hdr, dgram_cksum)); cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; case PKT_TX_TCP_CKSUM: diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 9046d21a9..acf6b98e3 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -285,7 +285,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct udp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_udp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index c9d898044..faab12d92 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -116,7 +116,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, memset(gp, 0, sizeof(*gp)); if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP) { - struct udp_hdr udp_mask, udp_val; + struct rte_udp_hdr udp_mask, udp_val; memset(&udp_mask, 0, sizeof(udp_mask)); memset(&udp_val, 0, sizeof(udp_val)); @@ -130,7 +130,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, - &udp_mask, &udp_val, sizeof(struct udp_hdr)); + &udp_mask, &udp_val, sizeof(struct rte_udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); @@ -206,7 +206,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { - struct udp_hdr udp_mask, udp_val; + struct rte_udp_hdr udp_mask, udp_val; memset(&udp_mask, 0, sizeof(udp_mask)); memset(&udp_val, 0, sizeof(udp_val)); @@ -219,7 +219,7 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, udp_val.dst_port = input->flow.udp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, - &udp_mask, &udp_val, sizeof(struct udp_hdr)); + &udp_mask, &udp_val, sizeof(struct rte_udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index fd5b2d190..2787bc895 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -397,7 +397,7 @@ enic_copy_item_udp_v1(const struct rte_flow_item *item, const struct rte_flow_item_udp *spec = item->spec; const struct rte_flow_item_udp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct udp_hdr supported_mask = { + struct rte_udp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -735,19 +735,19 @@ enic_copy_item_udp_v2(const struct rte_flow_item *item, if (*inner_ofst == 0) { memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); } else { /* Inner IPv6 header. Mask/Val start at *inner_ofst into L5 */ - if ((*inner_ofst + sizeof(struct udp_hdr)) > + if ((*inner_ofst + sizeof(struct rte_udp_hdr)) > FILTER_GENERIC_1_KEY_LEN) return ENOTSUP; memcpy(&gp->layer[FILTER_GENERIC_1_L5].mask[*inner_ofst], - mask, sizeof(struct udp_hdr)); + mask, sizeof(struct rte_udp_hdr)); memcpy(&gp->layer[FILTER_GENERIC_1_L5].val[*inner_ofst], - spec, sizeof(struct udp_hdr)); - *inner_ofst += sizeof(struct udp_hdr); + spec, sizeof(struct rte_udp_hdr)); + *inner_ofst += sizeof(struct rte_udp_hdr); } return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 46dfa79b7..40f25febf 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -799,7 +799,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *raw_pkt) { unsigned char *payload, *ptr; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; @@ -815,8 +815,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, /* fill the L4 head */ switch (fdir_input->flow_type) { case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -860,8 +860,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1089,7 +1089,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload = NULL; unsigned char *ptr; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; @@ -1116,8 +1116,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, /* fill the L4 head */ if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1153,8 +1153,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, payload = raw_pkt + len; set_idx = I40E_FLXPLD_L3_IDX; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1206,12 +1206,12 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 || cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); gtp = (struct rte_flow_item_gtp *) - ((unsigned char *)udp + sizeof(struct udp_hdr)); + ((unsigned char *)udp + sizeof(struct rte_udp_hdr)); gtp->msg_len = rte_cpu_to_be_16(I40E_FDIR_GTP_DEFAULT_LEN); gtp->teid = fdir_input->flow.gtp_flow.teid; diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index e5f18538f..df7b7dc6d 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -308,7 +308,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; default: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 036acaa14..1f77257e1 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -418,7 +418,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_UDP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct udp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_udp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 76af6a8b6..c8c32658d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2548,11 +2548,11 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, /* Handle L4. */ switch (fdir_filter->input.flow_type) { case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: - attributes->l4.udp.hdr = (struct udp_hdr){ + attributes->l4.udp.hdr = (struct rte_udp_hdr){ .src_port = input->flow.udp4_flow.src_port, .dst_port = input->flow.udp4_flow.dst_port, }; - attributes->l4_mask.udp.hdr = (struct udp_hdr){ + attributes->l4_mask.udp.hdr = (struct rte_udp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2578,11 +2578,11 @@ mlx5_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - attributes->l4.udp.hdr = (struct udp_hdr){ + attributes->l4.udp.hdr = (struct rte_udp_hdr){ .src_port = input->flow.udp6_flow.src_port, .dst_port = input->flow.udp6_flow.dst_port, }; - attributes->l4_mask.udp.hdr = (struct udp_hdr){ + attributes->l4_mask.udp.hdr = (struct rte_udp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index cd762cddb..33eb9fc39 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -459,7 +459,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, uint8_t *raw_pkt; struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; uint16_t len; @@ -487,13 +487,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; /* UDP */ if (arfs->tuple.ip_proto == IPPROTO_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->dst_port = arfs->tuple.dst_port; udp->src_port = arfs->tuple.src_port; - udp->dgram_len = sizeof(struct udp_hdr); - len += sizeof(struct udp_hdr); + udp->dgram_len = sizeof(struct rte_udp_hdr); + len += sizeof(struct rte_udp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct udp_hdr); + ip->total_length += sizeof(struct rte_udp_hdr); params->udp = true; } else { /* TCP */ tcp = (struct rte_tcp_hdr *)(raw_pkt + len); @@ -522,10 +522,10 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; /* UDP */ if (arfs->tuple.ip_proto == IPPROTO_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->src_port = arfs->tuple.src_port; udp->dst_port = arfs->tuple.dst_port; - len += sizeof(struct udp_hdr); + len += sizeof(struct rte_udp_hdr); params->udp = true; } else { /* TCP */ tcp = (struct rte_tcp_hdr *)(raw_pkt + len); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index dd19f0119..6af14193d 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -473,7 +473,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, l4_hdr = packet + l2_len + l3_len; if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) - *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; + *l4_cksum = &((struct rte_udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 429beded8..ce00a6b58 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -366,7 +366,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, switch (cookie->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct udp_hdr, + hdr->csum_offset = offsetof(struct rte_udp_hdr, dgram_cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 8726eabb9..4f5594c6b 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -542,7 +542,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); + gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_udp_hdr, dgram_cksum); break; default: PMD_TX_LOG(WARNING, "requested cksum offload not supported %#llx", diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 72d2c53e1..0e50f55c6 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -486,7 +486,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, { struct ipv4_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; key.ip_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); @@ -502,7 +502,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); @@ -525,7 +525,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, { struct ipv6_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; memcpy(key.ip_dst, ipv6_hdr->dst_addr, IPV6_ADDR_LEN); @@ -542,7 +542,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d57ac262b..0ef469c29 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -367,7 +367,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, { struct ipv4_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; key.ip_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); @@ -383,7 +383,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 261332adf..166cd8a31 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -75,7 +75,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i uint16_t ethertype; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -107,7 +107,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i return 0; /* packet type not supported, nothing to do */ if (l4_proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info->l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); ol_flags |= PKT_TX_UDP_CKSUM; udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); @@ -139,7 +139,7 @@ decapsulation(struct rte_mbuf *pkt) { uint8_t l4_proto = 0; uint16_t outer_header_len; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; union tunnel_offload_info info = { .data = 0 }; struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); @@ -148,7 +148,7 @@ decapsulation(struct rte_mbuf *pkt) if (l4_proto != IPPROTO_UDP) return -1; - udp_hdr = (struct udp_hdr *)((char *)phdr + + udp_hdr = (struct rte_udp_hdr *)((char *)phdr + info.outer_l2_len + info.outer_l3_len); /** check udp destination port, 4789 is the default vxlan port @@ -158,7 +158,7 @@ decapsulation(struct rte_mbuf *pkt) (pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0) return -1; outer_header_len = info.outer_l2_len + info.outer_l3_len - + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr); + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr); rte_pktmbuf_adj(pkt, outer_header_len); @@ -177,10 +177,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) - + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; /* convert TX queue ID to vport ID */ @@ -224,7 +224,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*UDP HEADER*/ udp->dgram_cksum = 0; udp->dgram_len = rte_cpu_to_be_16(old_len - + sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); udp->dst_port = rte_cpu_to_be_16(vxdev.dst_port); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index cea95b98a..c27d590a1 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -685,7 +685,7 @@ static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = { * Matches a UDP header. */ struct rte_flow_item_udp { - struct udp_hdr hdr; /**< UDP header definition. */ + struct rte_udp_hdr hdr; /**< UDP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */ diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 3cfe20f75..a2b30e3de 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -263,7 +263,7 @@ static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { struct rte_ipv4_hdr *ipv4_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; @@ -275,7 +275,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the outer UDP header. */ len -= pkt->outer_l3_len; - udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + pkt->outer_l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + pkt->outer_l3_len); udp_hdr->dgram_len = rte_cpu_to_be_16(len); /* Update the inner IPv4 header. */ @@ -292,7 +292,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct rte_tcp_hdr *tcp_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; uint16_t tcp_dl, frag_off, outer_ip_id, ip_id; @@ -308,10 +308,10 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); - udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); vxlan_hdr = (struct rte_vxlan_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index a35030153..48ad1686f 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -46,9 +46,9 @@ static inline void update_udp_header(struct rte_mbuf *pkt, uint16_t udp_offset) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + udp_hdr = (struct rte_udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + udp_offset); udp_hdr->dgram_len = rte_cpu_to_be_16(pkt->pkt_len - udp_offset); } diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 8f65adf1c..3aab297f4 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -23,7 +23,7 @@ extern "C" { /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index f279cf33c..737a2614d 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -307,7 +307,7 @@ struct rte_vxlan_hdr { #define RTE_ETHER_TYPE_TEB 0x6558 /**< Transparent Ethernet Bridging. */ #define RTE_ETHER_TYPE_LLDP 0x88CC /**< LLDP Protocol. */ -#define RTE_ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) +#define RTE_ETHER_VXLAN_HLEN (sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -331,7 +331,7 @@ struct rte_vxlan_gpe_hdr { #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) + \ +#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 9712c75ac..ffd15eaf3 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -338,7 +338,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) { - hdr_lens->l4_len = sizeof(struct udp_hdr); + hdr_lens->l4_len = sizeof(struct rte_udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { const struct rte_tcp_hdr *th; @@ -474,7 +474,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_UDP) { - hdr_lens->inner_l4_len = sizeof(struct udp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { const struct rte_tcp_hdr *th; diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 4c27f4611..d67d6ab19 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -115,7 +115,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct rte_tcp_hdr *tcp_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; if ((ol_flags & PKT_TX_OUTER_IP_CKSUM) || @@ -132,7 +132,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) if ((ol_flags & PKT_TX_UDP_CKSUM) == PKT_TX_UDP_CKSUM) { if (ol_flags & PKT_TX_IPV4) { - udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + m->l3_len); udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -140,7 +140,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ - udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, + udp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *, inner_l3_offset + m->l3_len); udp_hdr->dgram_cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_udp.h b/lib/librte_net/rte_udp.h index ba033955c..1c3437c5f 100644 --- a/lib/librte_net/rte_udp.h +++ b/lib/librte_net/rte_udp.h @@ -23,7 +23,7 @@ extern "C" { /** * UDP Header */ -struct udp_hdr { +struct rte_udp_hdr { uint16_t src_port; /**< UDP source port. */ uint16_t dst_port; /**< UDP destination port. */ uint16_t dgram_len; /**< UDP datagram length */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 15bbdd674..36cefcf31 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -505,7 +505,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -513,14 +513,14 @@ struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -528,7 +528,7 @@ struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -963,13 +963,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length); @@ -993,13 +993,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length); @@ -1023,10 +1023,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length); @@ -1049,10 +1049,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length); @@ -1311,7 +1311,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t ip_cksum, udp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1350,7 +1350,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t ip_cksum, udp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1392,7 +1392,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t udp_cksum; udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum, @@ -1420,7 +1420,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t udp_cksum; udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 11e76386c..eaa078a8d 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -248,7 +248,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) cksum)); break; case PKT_TX_UDP_CKSUM: - net_hdr->csum_offset = (offsetof(struct udp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_udp_hdr, dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: @@ -1027,7 +1027,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; - case (offsetof(struct udp_hdr, dgram_cksum)): + case (offsetof(struct rte_udp_hdr, dgram_cksum)): if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; @@ -1053,7 +1053,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) case VIRTIO_NET_HDR_GSO_UDP: m->ol_flags |= PKT_TX_UDP_SEG; m->tso_segsz = hdr->gso_size; - m->l4_len = sizeof(struct udp_hdr); + m->l4_len = sizeof(struct rte_udp_hdr); break; default: RTE_LOG(WARNING, VHOST_DATA, diff --git a/test/test/packet_burst_generator.c b/test/test/packet_burst_generator.c index 5730f8129..305ed3d0d 100644 --- a/test/test/packet_burst_generator.c +++ b/test/test/packet_burst_generator.c @@ -90,12 +90,12 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma } uint16_t -initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, +initialize_udp_header(struct rte_udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(src_port); udp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -126,7 +126,7 @@ initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); sctp_hdr->src_port = rte_cpu_to_be_16(src_port); sctp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -257,7 +257,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, + uint8_t ipv4, struct rte_udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { int i, nb_pkt = 0; @@ -384,7 +384,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, - sizeof(struct udp_hdr), pkt, + sizeof(struct rte_udp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_TCP: @@ -406,7 +406,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, - sizeof(struct udp_hdr), pkt, + sizeof(struct rte_udp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_TCP: diff --git a/test/test/packet_burst_generator.h b/test/test/packet_burst_generator.h index 5cfe0c600..1ad444b2c 100644 --- a/test/test/packet_burst_generator.h +++ b/test/test/packet_burst_generator.h @@ -34,7 +34,7 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma uint32_t opcode); uint16_t -initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, +initialize_udp_header(struct rte_udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t @@ -60,7 +60,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, + uint8_t ipv4, struct rte_udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); int diff --git a/test/test/test_flow_classify.c b/test/test/test_flow_classify.c index 1a79326b8..a9d32cd37 100644 --- a/test/test/test_flow_classify.c +++ b/test/test/test_flow_classify.c @@ -491,7 +491,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); uint16_t src_port = 32; diff --git a/test/test/test_link_bonding.c b/test/test/test_link_bonding.c index 924de81ae..7d3d19034 100644 --- a/test/test/test_link_bonding.c +++ b/test/test/test_link_bonding.c @@ -80,13 +80,13 @@ struct link_bonding_unittest_params { struct rte_ether_hdr *pkt_eth_hdr; struct rte_ipv4_hdr *pkt_ipv4_hdr; struct rte_ipv6_hdr *pkt_ipv6_hdr; - struct udp_hdr *pkt_udp_hdr; + struct rte_udp_hdr *pkt_udp_hdr; }; static struct rte_ipv4_hdr pkt_ipv4_hdr; static struct rte_ipv6_hdr pkt_ipv6_hdr; -static struct udp_hdr pkt_udp_hdr; +static struct rte_udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { .bonded_port_id = -1, diff --git a/test/test/test_link_bonding_mode4.c b/test/test/test_link_bonding_mode4.c index 4968cd91c..e3eab892c 100644 --- a/test/test/test_link_bonding_mode4.c +++ b/test/test/test_link_bonding_mode4.c @@ -732,7 +732,7 @@ generate_packets(struct rte_ether_addr *src_mac, uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; union { struct rte_ipv4_hdr v4; struct rte_ipv6_hdr v6; diff --git a/test/test/test_pmd_perf.c b/test/test/test_pmd_perf.c index 3246b7ab6..b5635900b 100644 --- a/test/test/test_pmd_perf.c +++ b/test/test/test_pmd_perf.c @@ -184,7 +184,7 @@ init_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (13 preceding siblings ...) 2018-10-24 8:18 ` [dpdk-dev] [RFC 14/14] net: add rte prefix to udp structure Olivier Matz @ 2018-10-24 8:32 ` Olivier Matz 2018-10-24 14:56 ` Wiles, Keith ` (5 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-24 8:32 UTC (permalink / raw) To: dev On Wed, Oct 24, 2018 at 10:18:19AM +0200, Olivier Matz wrote: > This RFC targets 19.02. > > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > This was discussed in [1], and more recently at the techboard. Sorry, the reference was missing: [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (14 preceding siblings ...) 2018-10-24 8:32 ` [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz @ 2018-10-24 14:56 ` Wiles, Keith 2018-10-26 7:22 ` Olivier Matz 2018-10-24 16:09 ` Stephen Hemminger ` (4 subsequent siblings) 20 siblings, 1 reply; 107+ messages in thread From: Wiles, Keith @ 2018-10-24 14:56 UTC (permalink / raw) To: Olivier Matz; +Cc: dpdk-dev > On Oct 24, 2018, at 1:18 AM, Olivier Matz <olivier.matz@6wind.com> wrote: > > This RFC targets 19.02. > > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > This was discussed in [1], and more recently at the techboard. > > Before sending the deprecation notice (target for this is 18.11), > here is a draft that can be discussed. > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > One question I'm asking is how can we manage the transition. > Initially, I hoped it was possible to have a compat layer during > one release (supporting both prefixed and unprefixed names), but > now that the patch is done, it seems the impact is too big, and > impacts too many libraries. > > Few examples: > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > - many rte_flow structures use the rte_ prefixed net structures > - the mac field of virtio_net structure is rte_ether_addr > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > ... > > Therefore, it is clear that doing this would break the compilation > of many external applications. > > Another drawback we need to take in account: it will make the > backport of patches more difficult, although this is something > that could be tempered by a script. > > While it is obviously better to have a good namespace convention, > we need to identify the issues we have today before deciding it's > worth doing the change. > > Comments? I did not see the deprecation notice in the patches below, but I could have missed it. > > > Things that are missing in RFC: > - test with FreeBSD > - manually fix some indentation issues > > > Olivier Matz (14): > net: add rte prefix to arp structures > net: add rte prefix to arp defines > net: add rte prefix to ether structures > net: add rte prefix to ether functions > net: add rte prefix to ether defines > net: add rte prefix to esp structure > net: add rte prefix to gre structure > net: add rte prefix to icmp structure > net: add rte prefix to icmp defines > net: add rte prefix to ip structure > net: add rte prefix to ip defines > net: add rte prefix to sctp structure > net: add rte prefix to tcp structure > net: add rte prefix to udp structure > > app/pdump/main.c | 2 +- > app/test-eventdev/test_perf_common.c | 2 +- > app/test-eventdev/test_pipeline_common.c | 2 +- > app/test-pmd/cmdline.c | 66 ++--- > app/test-pmd/cmdline_flow.c | 10 +- > app/test-pmd/config.c | 34 +-- > app/test-pmd/csumonly.c | 156 +++++----- > app/test-pmd/flowgen.c | 30 +- > app/test-pmd/icmpecho.c | 120 ++++---- > app/test-pmd/ieee1588fwd.c | 18 +- > app/test-pmd/macfwd.c | 12 +- > app/test-pmd/macswap.c | 16 +- > app/test-pmd/parameters.c | 6 +- > app/test-pmd/testpmd.c | 22 +- > app/test-pmd/testpmd.h | 18 +- > app/test-pmd/txonly.c | 36 +-- > app/test-pmd/util.c | 34 +-- > doc/guides/prog_guide/bbdev.rst | 6 +- > .../prog_guide/packet_classif_access_ctrl.rst | 18 +- > doc/guides/prog_guide/rte_flow.rst | 4 +- > doc/guides/sample_app_ug/flow_classify.rst | 28 +- > doc/guides/sample_app_ug/flow_filtering.rst | 6 +- > doc/guides/sample_app_ug/ip_frag.rst | 16 +- > doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- > doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- > doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- > .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- > doc/guides/sample_app_ug/l3_forward.rst | 12 +- > doc/guides/sample_app_ug/link_status_intr.rst | 6 +- > doc/guides/sample_app_ug/ptpclient.rst | 6 +- > doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- > doc/guides/sample_app_ug/server_node_efd.rst | 12 +- > doc/guides/sample_app_ug/skeleton.rst | 4 +- > doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- > drivers/bus/dpaa/base/fman/fman.c | 2 +- > drivers/bus/dpaa/base/fman/fman_hw.c | 2 +- > drivers/bus/dpaa/include/fman.h | 2 +- > drivers/bus/dpaa/include/netcfg.h | 4 +- > drivers/net/af_packet/rte_eth_af_packet.c | 2 +- > drivers/net/ark/ark_ethdev.c | 16 +- > drivers/net/ark/ark_ext.h | 4 +- > drivers/net/ark/ark_global.h | 4 +- > drivers/net/atlantic/atl_ethdev.c | 20 +- > drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- > drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- > drivers/net/avf/avf.h | 4 +- > drivers/net/avf/avf_ethdev.c | 50 ++-- > drivers/net/avf/avf_rxtx.c | 14 +- > drivers/net/avf/avf_vchnl.c | 8 +- > drivers/net/avf/base/avf_adminq_cmd.h | 4 +- > drivers/net/avf/base/avf_common.c | 12 +- > drivers/net/avf/base/avf_prototype.h | 4 +- > drivers/net/avp/avp_ethdev.c | 20 +- > drivers/net/avp/rte_avp_common.h | 2 +- > drivers/net/axgbe/axgbe_dev.c | 4 +- > drivers/net/axgbe/axgbe_ethdev.c | 10 +- > drivers/net/axgbe/axgbe_ethdev.h | 4 +- > drivers/net/axgbe/axgbe_rxtx.c | 2 +- > drivers/net/bnx2x/bnx2x.c | 16 +- > drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- > drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- > drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- > drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- > drivers/net/bnx2x/ecore_sp.h | 2 +- > drivers/net/bnxt/bnxt.h | 4 +- > drivers/net/bnxt/bnxt_ethdev.c | 70 ++--- > drivers/net/bnxt/bnxt_filter.c | 4 +- > drivers/net/bnxt/bnxt_filter.h | 8 +- > drivers/net/bnxt/bnxt_flow.c | 26 +- > drivers/net/bnxt/bnxt_hwrm.c | 40 +-- > drivers/net/bnxt/bnxt_hwrm.h | 2 +- > 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 | 14 +- > drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- > drivers/net/bonding/rte_eth_bond.h | 2 +- > drivers/net/bonding/rte_eth_bond_8023ad.c | 26 +- > drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- > drivers/net/bonding/rte_eth_bond_alb.c | 78 ++--- > drivers/net/bonding/rte_eth_bond_alb.h | 10 +- > drivers/net/bonding/rte_eth_bond_api.c | 2 +- > drivers/net/bonding/rte_eth_bond_args.c | 2 +- > drivers/net/bonding/rte_eth_bond_pmd.c | 194 ++++++------- > drivers/net/bonding/rte_eth_bond_private.h | 6 +- > drivers/net/cxgbe/base/adapter.h | 6 +- > drivers/net/cxgbe/base/t4_hw.c | 8 +- > drivers/net/cxgbe/cxgbe.h | 4 +- > drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- > drivers/net/cxgbe/cxgbe_filter.h | 2 +- > drivers/net/cxgbe/cxgbe_flow.c | 10 +- > drivers/net/cxgbe/cxgbe_main.c | 4 +- > drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- > 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 | 20 +- > drivers/net/dpaa/dpaa_rxtx.c | 22 +- > drivers/net/dpaa2/dpaa2_ethdev.c | 36 +-- > drivers/net/e1000/e1000_ethdev.h | 2 +- > drivers/net/e1000/em_ethdev.c | 34 +-- > drivers/net/e1000/em_rxtx.c | 22 +- > drivers/net/e1000/igb_ethdev.c | 70 ++--- > drivers/net/e1000/igb_flow.c | 12 +- > drivers/net/e1000/igb_pf.c | 16 +- > drivers/net/e1000/igb_rxtx.c | 18 +- > drivers/net/ena/ena_ethdev.c | 16 +- > drivers/net/ena/ena_ethdev.h | 2 +- > drivers/net/enetc/base/enetc_hw.h | 4 +- > drivers/net/enetc/enetc_ethdev.c | 6 +- > drivers/net/enic/enic.h | 2 +- > drivers/net/enic/enic_clsf.c | 40 +-- > drivers/net/enic/enic_ethdev.c | 4 +- > drivers/net/enic/enic_flow.c | 100 +++---- > drivers/net/enic/enic_main.c | 2 +- > drivers/net/enic/enic_res.c | 4 +- > drivers/net/failsafe/failsafe.c | 6 +- > drivers/net/failsafe/failsafe_args.c | 4 +- > drivers/net/failsafe/failsafe_ether.c | 6 +- > drivers/net/failsafe/failsafe_ops.c | 6 +- > drivers/net/failsafe/failsafe_private.h | 4 +- > drivers/net/fm10k/fm10k.h | 2 +- > drivers/net/fm10k/fm10k_ethdev.c | 18 +- > drivers/net/i40e/base/i40e_adminq_cmd.h | 4 +- > drivers/net/i40e/base/i40e_common.c | 12 +- > drivers/net/i40e/base/i40e_prototype.h | 4 +- > drivers/net/i40e/i40e_ethdev.c | 134 ++++----- > drivers/net/i40e/i40e_ethdev.h | 22 +- > drivers/net/i40e/i40e_ethdev_vf.c | 60 ++-- > drivers/net/i40e/i40e_fdir.c | 126 ++++---- > drivers/net/i40e/i40e_flow.c | 58 ++-- > drivers/net/i40e/i40e_pf.c | 18 +- > drivers/net/i40e/i40e_rxtx.c | 28 +- > drivers/net/i40e/i40e_vf_representor.c | 2 +- > drivers/net/i40e/rte_pmd_i40e.c | 30 +- > drivers/net/i40e/rte_pmd_i40e.h | 8 +- > drivers/net/ixgbe/ixgbe_ethdev.c | 94 +++--- > drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- > drivers/net/ixgbe/ixgbe_flow.c | 22 +- > drivers/net/ixgbe/ixgbe_pf.c | 14 +- > drivers/net/ixgbe/ixgbe_rxtx.c | 14 +- > drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- > drivers/net/ixgbe/rte_pmd_ixgbe.c | 10 +- > drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- > drivers/net/kni/rte_eth_kni.c | 4 +- > drivers/net/liquidio/lio_ethdev.c | 22 +- > drivers/net/mlx4/mlx4.c | 4 +- > drivers/net/mlx4/mlx4.h | 8 +- > drivers/net/mlx4/mlx4_ethdev.c | 8 +- > drivers/net/mlx4/mlx4_flow.c | 14 +- > drivers/net/mlx4/mlx4_rxtx.c | 2 +- > drivers/net/mlx5/mlx5.c | 4 +- > drivers/net/mlx5/mlx5.h | 14 +- > drivers/net/mlx5/mlx5_flow.c | 22 +- > drivers/net/mlx5/mlx5_flow_tcf.c | 40 +-- > drivers/net/mlx5/mlx5_flow_verbs.c | 26 +- > drivers/net/mlx5/mlx5_mac.c | 18 +- > drivers/net/mlx5/mlx5_nl.c | 28 +- > drivers/net/mlx5/mlx5_rxtx.c | 6 +- > drivers/net/mlx5/mlx5_rxtx.h | 2 +- > drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- > drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- > drivers/net/mlx5/mlx5_trigger.c | 6 +- > drivers/net/mvneta/mvneta_ethdev.c | 22 +- > drivers/net/mvneta/mvneta_ethdev.h | 2 +- > drivers/net/mvpp2/mrvl_ethdev.c | 22 +- > drivers/net/mvpp2/mrvl_ethdev.h | 2 +- > drivers/net/mvpp2/mrvl_flow.c | 4 +- > drivers/net/netvsc/hn_ethdev.c | 4 +- > drivers/net/netvsc/hn_nvs.c | 2 +- > drivers/net/netvsc/hn_rndis.c | 2 +- > drivers/net/netvsc/hn_rxtx.c | 12 +- > drivers/net/netvsc/hn_var.h | 4 +- > drivers/net/netvsc/hn_vf.c | 12 +- > drivers/net/nfp/nfp_net.c | 20 +- > drivers/net/nfp/nfp_net_pmd.h | 2 +- > drivers/net/null/rte_eth_null.c | 6 +- > drivers/net/octeontx/octeontx_ethdev.c | 8 +- > drivers/net/octeontx/octeontx_ethdev.h | 2 +- > drivers/net/pcap/rte_eth_pcap.c | 22 +- > drivers/net/qede/base/bcm_osal.h | 2 +- > drivers/net/qede/base/ecore_dev.c | 4 +- > drivers/net/qede/qede_ethdev.c | 58 ++-- > drivers/net/qede/qede_ethdev.h | 6 +- > drivers/net/qede/qede_filter.c | 66 ++--- > drivers/net/qede/qede_if.h | 4 +- > drivers/net/qede/qede_main.c | 6 +- > drivers/net/qede/qede_rxtx.c | 32 +- > drivers/net/qede/qede_rxtx.h | 2 +- > drivers/net/ring/rte_eth_ring.c | 4 +- > drivers/net/sfc/sfc.h | 2 +- > drivers/net/sfc/sfc_ef10_tx.c | 8 +- > drivers/net/sfc/sfc_ethdev.c | 20 +- > drivers/net/sfc/sfc_flow.c | 12 +- > drivers/net/sfc/sfc_port.c | 8 +- > drivers/net/sfc/sfc_tso.c | 8 +- > drivers/net/softnic/parser.c | 18 +- > drivers/net/softnic/parser.h | 2 +- > drivers/net/softnic/rte_eth_softnic.c | 2 +- > drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- > drivers/net/szedata2/rte_eth_szedata2.c | 8 +- > drivers/net/tap/rte_eth_tap.c | 58 ++-- > drivers/net/tap/rte_eth_tap.h | 2 +- > drivers/net/tap/tap_bpf_program.c | 14 +- > drivers/net/tap/tap_flow.c | 12 +- > drivers/net/thunderx/base/nicvf_mbox.c | 4 +- > drivers/net/thunderx/base/nicvf_plat.h | 2 +- > drivers/net/thunderx/nicvf_ethdev.c | 18 +- > drivers/net/thunderx/nicvf_struct.h | 2 +- > drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- > drivers/net/vhost/rte_eth_vhost.c | 12 +- > drivers/net/virtio/virtio_ethdev.c | 70 ++--- > drivers/net/virtio/virtio_pci.h | 4 +- > drivers/net/virtio/virtio_rxtx.c | 28 +- > 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 | 12 +- > drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- > drivers/net/vmxnet3/vmxnet3_rxtx.c | 44 +-- > examples/bbdev_app/main.c | 40 +-- > examples/bond/main.c | 78 ++--- > examples/distributor/main.c | 4 +- > examples/ethtool/ethtool-app/ethapp.c | 8 +- > examples/ethtool/ethtool-app/main.c | 10 +- > examples/ethtool/lib/rte_ethtool.c | 8 +- > examples/ethtool/lib/rte_ethtool.h | 6 +- > examples/eventdev_pipeline/main.c | 4 +- > examples/eventdev_pipeline/pipeline_common.h | 10 +- > examples/flow_classify/flow_classify.c | 30 +- > examples/flow_filtering/main.c | 10 +- > examples/ip_fragmentation/main.c | 62 ++-- > examples/ip_pipeline/cli.c | 2 +- > examples/ip_pipeline/kni.c | 2 +- > examples/ip_pipeline/parser.c | 18 +- > examples/ip_pipeline/parser.h | 2 +- > examples/ip_pipeline/pipeline.c | 40 +-- > examples/ip_reassembly/main.c | 50 ++-- > examples/ipsec-secgw/esp.c | 42 +-- > examples/ipsec-secgw/ipsec-secgw.c | 38 +-- > examples/ipsec-secgw/sa.c | 6 +- > examples/ipv4_multicast/main.c | 58 ++-- > examples/kni/main.c | 14 +- > examples/l2fwd-cat/l2fwd-cat.c | 4 +- > examples/l2fwd-crypto/main.c | 26 +- > examples/l2fwd-jobstats/main.c | 8 +- > examples/l2fwd-keepalive/main.c | 8 +- > examples/l2fwd/main.c | 8 +- > examples/l3fwd-acl/main.c | 102 +++---- > examples/l3fwd-power/main.c | 100 +++---- > examples/l3fwd-vf/main.c | 68 ++--- > examples/l3fwd/l3fwd.h | 8 +- > examples/l3fwd/l3fwd_altivec.h | 14 +- > examples/l3fwd/l3fwd_common.h | 4 +- > examples/l3fwd/l3fwd_em.c | 44 +-- > examples/l3fwd/l3fwd_em.h | 20 +- > examples/l3fwd/l3fwd_em_hlm.h | 16 +- > examples/l3fwd/l3fwd_em_hlm_neon.h | 16 +- > examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- > examples/l3fwd/l3fwd_em_sequential.h | 16 +- > examples/l3fwd/l3fwd_lpm.c | 50 ++-- > examples/l3fwd/l3fwd_lpm.h | 20 +- > examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- > examples/l3fwd/l3fwd_lpm_neon.h | 30 +- > examples/l3fwd/l3fwd_lpm_sse.h | 20 +- > examples/l3fwd/l3fwd_neon.h | 14 +- > examples/l3fwd/l3fwd_sse.h | 14 +- > examples/l3fwd/main.c | 20 +- > examples/link_status_interrupt/main.c | 8 +- > examples/load_balancer/runtime.c | 6 +- > .../client_server_mp/mp_server/main.c | 2 +- > examples/packet_ordering/main.c | 2 +- > examples/performance-thread/l3fwd-thread/main.c | 322 ++++++++++----------- > examples/ptpclient/ptpclient.c | 32 +- > examples/qos_meter/main.c | 4 +- > examples/qos_sched/init.c | 2 +- > examples/quota_watermark/qw/main.c | 8 +- > examples/rxtx_callbacks/main.c | 4 +- > examples/server_node_efd/node/node.c | 6 +- > examples/server_node_efd/server/main.c | 8 +- > examples/skeleton/basicfwd.c | 4 +- > examples/tep_termination/main.c | 2 +- > examples/tep_termination/main.h | 2 +- > examples/tep_termination/vxlan.c | 108 +++---- > examples/tep_termination/vxlan.h | 8 +- > examples/tep_termination/vxlan_setup.c | 30 +- > examples/tep_termination/vxlan_setup.h | 2 +- > examples/vhost/main.c | 40 +-- > examples/vhost/main.h | 2 +- > examples/vm_power_manager/channel_monitor.c | 2 +- > .../guest_cli/vm_power_cli_guest.c | 2 +- > examples/vm_power_manager/main.c | 6 +- > examples/vmdq/main.c | 12 +- > examples/vmdq_dcb/main.c | 12 +- > lib/librte_cmdline/cmdline_parse_etheraddr.c | 33 +-- > lib/librte_ethdev/rte_eth_ctrl.h | 12 +- > lib/librte_ethdev/rte_ethdev.c | 56 ++-- > lib/librte_ethdev/rte_ethdev.h | 12 +- > lib/librte_ethdev/rte_ethdev_core.h | 12 +- > lib/librte_ethdev/rte_flow.h | 32 +- > lib/librte_eventdev/rte_event_eth_rx_adapter.c | 32 +- > lib/librte_gro/gro_tcp4.c | 26 +- > lib/librte_gro/gro_tcp4.h | 20 +- > lib/librte_gro/gro_vxlan_tcp4.c | 64 ++-- > lib/librte_gro/gro_vxlan_tcp4.h | 6 +- > lib/librte_gso/gso_common.h | 16 +- > lib/librte_gso/gso_tcp4.c | 12 +- > lib/librte_gso/gso_tunnel_tcp4.c | 14 +- > lib/librte_gso/gso_udp4.c | 8 +- > lib/librte_gso/rte_gso.h | 8 +- > lib/librte_hash/rte_thash.h | 2 +- > lib/librte_ip_frag/rte_ip_frag.h | 12 +- > lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- > lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- > lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 +- > lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- > lib/librte_kni/rte_kni.c | 4 +- > lib/librte_kni/rte_kni.h | 2 +- > lib/librte_net/rte_arp.c | 32 +- > lib/librte_net/rte_arp.h | 36 +-- > lib/librte_net/rte_esp.h | 2 +- > lib/librte_net/rte_ether.h | 178 ++++++------ > lib/librte_net/rte_gre.h | 2 +- > lib/librte_net/rte_icmp.h | 6 +- > lib/librte_net/rte_ip.h | 70 ++--- > lib/librte_net/rte_net.c | 90 +++--- > lib/librte_net/rte_net.h | 22 +- > lib/librte_net/rte_sctp.h | 2 +- > lib/librte_net/rte_tcp.h | 2 +- > lib/librte_net/rte_udp.h | 2 +- > lib/librte_pipeline/rte_table_action.c | 210 +++++++------- > lib/librte_pipeline/rte_table_action.h | 4 +- > lib/librte_port/rte_port_ras.c | 8 +- > lib/librte_port/rte_port_source_sink.c | 6 +- > lib/librte_vhost/vhost.h | 2 +- > lib/librte_vhost/virtio_net.c | 42 +-- > test/test-acl/main.c | 2 +- > test/test-pipeline/pipeline_acl.c | 16 +- > test/test-pipeline/pipeline_hash.c | 12 +- > test/test/packet_burst_generator.c | 126 ++++---- > test/test/packet_burst_generator.h | 26 +- > test/test/test_acl.c | 8 +- > test/test/test_acl.h | 122 ++++---- > test/test/test_cmdline_etheraddr.c | 16 +- > test/test/test_efd.c | 20 +- > test/test/test_event_eth_rx_adapter.c | 2 +- > test/test/test_event_eth_tx_adapter.c | 2 +- > test/test/test_flow_classify.c | 68 ++--- > test/test/test_hash.c | 20 +- > test/test/test_link_bonding.c | 284 +++++++++--------- > test/test/test_link_bonding_mode4.c | 116 ++++---- > test/test/test_link_bonding_rssconf.c | 6 +- > test/test/test_lpm.c | 76 ++--- > test/test/test_lpm_perf.c | 10 +- > test/test/test_member.c | 20 +- > test/test/test_pmd_perf.c | 20 +- > test/test/test_sched.c | 20 +- > test/test/test_table_acl.c | 8 +- > test/test/test_thash.c | 12 +- > test/test/virtual_pmd.c | 6 +- > test/test/virtual_pmd.h | 2 +- > 367 files changed, 3906 insertions(+), 3913 deletions(-) > > -- > 2.11.0 > Regards, Keith ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 14:56 ` Wiles, Keith @ 2018-10-26 7:22 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-26 7:22 UTC (permalink / raw) To: Wiles, Keith; +Cc: dpdk-dev Hi, On Wed, Oct 24, 2018 at 02:56:14PM +0000, Wiles, Keith wrote: > > > > On Oct 24, 2018, at 1:18 AM, Olivier Matz <olivier.matz@6wind.com> wrote: > > > > This RFC targets 19.02. > > > > The rte_net headers conflict with the libc headers, because > > some definitions are duplicated, sometimes with few differences. > > This was discussed in [1], and more recently at the techboard. > > > > Before sending the deprecation notice (target for this is 18.11), > > here is a draft that can be discussed. > > > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > > and defines in rte_net library. This is a big changeset, that will > > break the API of many functions, but not the ABI. > > > > One question I'm asking is how can we manage the transition. > > Initially, I hoped it was possible to have a compat layer during > > one release (supporting both prefixed and unprefixed names), but > > now that the patch is done, it seems the impact is too big, and > > impacts too many libraries. > > > > Few examples: > > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > > - many rte_flow structures use the rte_ prefixed net structures > > - the mac field of virtio_net structure is rte_ether_addr > > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > > ... > > > > Therefore, it is clear that doing this would break the compilation > > of many external applications. > > > > Another drawback we need to take in account: it will make the > > backport of patches more difficult, although this is something > > that could be tempered by a script. > > > > While it is obviously better to have a good namespace convention, > > we need to identify the issues we have today before deciding it's > > worth doing the change. > > > > Comments? > > I did not see the deprecation notice in the patches below, but I could have missed it. I will send it only if we reach a consensus about the need to apply the patchset. Regards Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (15 preceding siblings ...) 2018-10-24 14:56 ` Wiles, Keith @ 2018-10-24 16:09 ` Stephen Hemminger 2018-10-24 16:39 ` Bruce Richardson ` (3 subsequent siblings) 20 siblings, 0 replies; 107+ messages in thread From: Stephen Hemminger @ 2018-10-24 16:09 UTC (permalink / raw) To: Olivier Matz; +Cc: dev On Wed, 24 Oct 2018 10:18:19 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > This RFC targets 19.02. > > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > This was discussed in [1], and more recently at the techboard. > > Before sending the deprecation notice (target for this is 18.11), > here is a draft that can be discussed. > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > One question I'm asking is how can we manage the transition. > Initially, I hoped it was possible to have a compat layer during > one release (supporting both prefixed and unprefixed names), but > now that the patch is done, it seems the impact is too big, and > impacts too many libraries. > > Few examples: > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > - many rte_flow structures use the rte_ prefixed net structures > - the mac field of virtio_net structure is rte_ether_addr > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > ... > > Therefore, it is clear that doing this would break the compilation > of many external applications. > > Another drawback we need to take in account: it will make the > backport of patches more difficult, although this is something > that could be tempered by a script. > > While it is obviously better to have a good namespace convention, > we need to identify the issues we have today before deciding it's > worth doing the change. > > Comments? > > > Things that are missing in RFC: > - test with FreeBSD > - manually fix some indentation issues > > > Olivier Matz (14): > net: add rte prefix to arp structures > net: add rte prefix to arp defines > net: add rte prefix to ether structures > net: add rte prefix to ether functions > net: add rte prefix to ether defines > net: add rte prefix to esp structure > net: add rte prefix to gre structure > net: add rte prefix to icmp structure > net: add rte prefix to icmp defines > net: add rte prefix to ip structure > net: add rte prefix to ip defines > net: add rte prefix to sctp structure > net: add rte prefix to tcp structure > net: add rte prefix to udp structure > > app/pdump/main.c | 2 +- > app/test-eventdev/test_perf_common.c | 2 +- > app/test-eventdev/test_pipeline_common.c | 2 +- > app/test-pmd/cmdline.c | 66 ++--- > app/test-pmd/cmdline_flow.c | 10 +- > app/test-pmd/config.c | 34 +-- > app/test-pmd/csumonly.c | 156 +++++----- > app/test-pmd/flowgen.c | 30 +- > app/test-pmd/icmpecho.c | 120 ++++---- > app/test-pmd/ieee1588fwd.c | 18 +- > app/test-pmd/macfwd.c | 12 +- > app/test-pmd/macswap.c | 16 +- > app/test-pmd/parameters.c | 6 +- > app/test-pmd/testpmd.c | 22 +- > app/test-pmd/testpmd.h | 18 +- > app/test-pmd/txonly.c | 36 +-- > app/test-pmd/util.c | 34 +-- > doc/guides/prog_guide/bbdev.rst | 6 +- > .../prog_guide/packet_classif_access_ctrl.rst | 18 +- > doc/guides/prog_guide/rte_flow.rst | 4 +- > doc/guides/sample_app_ug/flow_classify.rst | 28 +- > doc/guides/sample_app_ug/flow_filtering.rst | 6 +- > doc/guides/sample_app_ug/ip_frag.rst | 16 +- > doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- > doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- > doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- > .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- > doc/guides/sample_app_ug/l3_forward.rst | 12 +- > doc/guides/sample_app_ug/link_status_intr.rst | 6 +- > doc/guides/sample_app_ug/ptpclient.rst | 6 +- > doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- > doc/guides/sample_app_ug/server_node_efd.rst | 12 +- > doc/guides/sample_app_ug/skeleton.rst | 4 +- > doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- > drivers/bus/dpaa/base/fman/fman.c | 2 +- > drivers/bus/dpaa/base/fman/fman_hw.c | 2 +- > drivers/bus/dpaa/include/fman.h | 2 +- > drivers/bus/dpaa/include/netcfg.h | 4 +- > drivers/net/af_packet/rte_eth_af_packet.c | 2 +- > drivers/net/ark/ark_ethdev.c | 16 +- > drivers/net/ark/ark_ext.h | 4 +- > drivers/net/ark/ark_global.h | 4 +- > drivers/net/atlantic/atl_ethdev.c | 20 +- > drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- > drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- > drivers/net/avf/avf.h | 4 +- > drivers/net/avf/avf_ethdev.c | 50 ++-- > drivers/net/avf/avf_rxtx.c | 14 +- > drivers/net/avf/avf_vchnl.c | 8 +- > drivers/net/avf/base/avf_adminq_cmd.h | 4 +- > drivers/net/avf/base/avf_common.c | 12 +- > drivers/net/avf/base/avf_prototype.h | 4 +- > drivers/net/avp/avp_ethdev.c | 20 +- > drivers/net/avp/rte_avp_common.h | 2 +- > drivers/net/axgbe/axgbe_dev.c | 4 +- > drivers/net/axgbe/axgbe_ethdev.c | 10 +- > drivers/net/axgbe/axgbe_ethdev.h | 4 +- > drivers/net/axgbe/axgbe_rxtx.c | 2 +- > drivers/net/bnx2x/bnx2x.c | 16 +- > drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- > drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- > drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- > drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- > drivers/net/bnx2x/ecore_sp.h | 2 +- > drivers/net/bnxt/bnxt.h | 4 +- > drivers/net/bnxt/bnxt_ethdev.c | 70 ++--- > drivers/net/bnxt/bnxt_filter.c | 4 +- > drivers/net/bnxt/bnxt_filter.h | 8 +- > drivers/net/bnxt/bnxt_flow.c | 26 +- > drivers/net/bnxt/bnxt_hwrm.c | 40 +-- > drivers/net/bnxt/bnxt_hwrm.h | 2 +- > 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 | 14 +- > drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- > drivers/net/bonding/rte_eth_bond.h | 2 +- > drivers/net/bonding/rte_eth_bond_8023ad.c | 26 +- > drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- > drivers/net/bonding/rte_eth_bond_alb.c | 78 ++--- > drivers/net/bonding/rte_eth_bond_alb.h | 10 +- > drivers/net/bonding/rte_eth_bond_api.c | 2 +- > drivers/net/bonding/rte_eth_bond_args.c | 2 +- > drivers/net/bonding/rte_eth_bond_pmd.c | 194 ++++++------- > drivers/net/bonding/rte_eth_bond_private.h | 6 +- > drivers/net/cxgbe/base/adapter.h | 6 +- > drivers/net/cxgbe/base/t4_hw.c | 8 +- > drivers/net/cxgbe/cxgbe.h | 4 +- > drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- > drivers/net/cxgbe/cxgbe_filter.h | 2 +- > drivers/net/cxgbe/cxgbe_flow.c | 10 +- > drivers/net/cxgbe/cxgbe_main.c | 4 +- > drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- > 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 | 20 +- > drivers/net/dpaa/dpaa_rxtx.c | 22 +- > drivers/net/dpaa2/dpaa2_ethdev.c | 36 +-- > drivers/net/e1000/e1000_ethdev.h | 2 +- > drivers/net/e1000/em_ethdev.c | 34 +-- > drivers/net/e1000/em_rxtx.c | 22 +- > drivers/net/e1000/igb_ethdev.c | 70 ++--- > drivers/net/e1000/igb_flow.c | 12 +- > drivers/net/e1000/igb_pf.c | 16 +- > drivers/net/e1000/igb_rxtx.c | 18 +- > drivers/net/ena/ena_ethdev.c | 16 +- > drivers/net/ena/ena_ethdev.h | 2 +- > drivers/net/enetc/base/enetc_hw.h | 4 +- > drivers/net/enetc/enetc_ethdev.c | 6 +- > drivers/net/enic/enic.h | 2 +- > drivers/net/enic/enic_clsf.c | 40 +-- > drivers/net/enic/enic_ethdev.c | 4 +- > drivers/net/enic/enic_flow.c | 100 +++---- > drivers/net/enic/enic_main.c | 2 +- > drivers/net/enic/enic_res.c | 4 +- > drivers/net/failsafe/failsafe.c | 6 +- > drivers/net/failsafe/failsafe_args.c | 4 +- > drivers/net/failsafe/failsafe_ether.c | 6 +- > drivers/net/failsafe/failsafe_ops.c | 6 +- > drivers/net/failsafe/failsafe_private.h | 4 +- > drivers/net/fm10k/fm10k.h | 2 +- > drivers/net/fm10k/fm10k_ethdev.c | 18 +- > drivers/net/i40e/base/i40e_adminq_cmd.h | 4 +- > drivers/net/i40e/base/i40e_common.c | 12 +- > drivers/net/i40e/base/i40e_prototype.h | 4 +- > drivers/net/i40e/i40e_ethdev.c | 134 ++++----- > drivers/net/i40e/i40e_ethdev.h | 22 +- > drivers/net/i40e/i40e_ethdev_vf.c | 60 ++-- > drivers/net/i40e/i40e_fdir.c | 126 ++++---- > drivers/net/i40e/i40e_flow.c | 58 ++-- > drivers/net/i40e/i40e_pf.c | 18 +- > drivers/net/i40e/i40e_rxtx.c | 28 +- > drivers/net/i40e/i40e_vf_representor.c | 2 +- > drivers/net/i40e/rte_pmd_i40e.c | 30 +- > drivers/net/i40e/rte_pmd_i40e.h | 8 +- > drivers/net/ixgbe/ixgbe_ethdev.c | 94 +++--- > drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- > drivers/net/ixgbe/ixgbe_flow.c | 22 +- > drivers/net/ixgbe/ixgbe_pf.c | 14 +- > drivers/net/ixgbe/ixgbe_rxtx.c | 14 +- > drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- > drivers/net/ixgbe/rte_pmd_ixgbe.c | 10 +- > drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- > drivers/net/kni/rte_eth_kni.c | 4 +- > drivers/net/liquidio/lio_ethdev.c | 22 +- > drivers/net/mlx4/mlx4.c | 4 +- > drivers/net/mlx4/mlx4.h | 8 +- > drivers/net/mlx4/mlx4_ethdev.c | 8 +- > drivers/net/mlx4/mlx4_flow.c | 14 +- > drivers/net/mlx4/mlx4_rxtx.c | 2 +- > drivers/net/mlx5/mlx5.c | 4 +- > drivers/net/mlx5/mlx5.h | 14 +- > drivers/net/mlx5/mlx5_flow.c | 22 +- > drivers/net/mlx5/mlx5_flow_tcf.c | 40 +-- > drivers/net/mlx5/mlx5_flow_verbs.c | 26 +- > drivers/net/mlx5/mlx5_mac.c | 18 +- > drivers/net/mlx5/mlx5_nl.c | 28 +- > drivers/net/mlx5/mlx5_rxtx.c | 6 +- > drivers/net/mlx5/mlx5_rxtx.h | 2 +- > drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- > drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- > drivers/net/mlx5/mlx5_trigger.c | 6 +- > drivers/net/mvneta/mvneta_ethdev.c | 22 +- > drivers/net/mvneta/mvneta_ethdev.h | 2 +- > drivers/net/mvpp2/mrvl_ethdev.c | 22 +- > drivers/net/mvpp2/mrvl_ethdev.h | 2 +- > drivers/net/mvpp2/mrvl_flow.c | 4 +- > drivers/net/netvsc/hn_ethdev.c | 4 +- > drivers/net/netvsc/hn_nvs.c | 2 +- > drivers/net/netvsc/hn_rndis.c | 2 +- > drivers/net/netvsc/hn_rxtx.c | 12 +- > drivers/net/netvsc/hn_var.h | 4 +- > drivers/net/netvsc/hn_vf.c | 12 +- > drivers/net/nfp/nfp_net.c | 20 +- > drivers/net/nfp/nfp_net_pmd.h | 2 +- > drivers/net/null/rte_eth_null.c | 6 +- > drivers/net/octeontx/octeontx_ethdev.c | 8 +- > drivers/net/octeontx/octeontx_ethdev.h | 2 +- > drivers/net/pcap/rte_eth_pcap.c | 22 +- > drivers/net/qede/base/bcm_osal.h | 2 +- > drivers/net/qede/base/ecore_dev.c | 4 +- > drivers/net/qede/qede_ethdev.c | 58 ++-- > drivers/net/qede/qede_ethdev.h | 6 +- > drivers/net/qede/qede_filter.c | 66 ++--- > drivers/net/qede/qede_if.h | 4 +- > drivers/net/qede/qede_main.c | 6 +- > drivers/net/qede/qede_rxtx.c | 32 +- > drivers/net/qede/qede_rxtx.h | 2 +- > drivers/net/ring/rte_eth_ring.c | 4 +- > drivers/net/sfc/sfc.h | 2 +- > drivers/net/sfc/sfc_ef10_tx.c | 8 +- > drivers/net/sfc/sfc_ethdev.c | 20 +- > drivers/net/sfc/sfc_flow.c | 12 +- > drivers/net/sfc/sfc_port.c | 8 +- > drivers/net/sfc/sfc_tso.c | 8 +- > drivers/net/softnic/parser.c | 18 +- > drivers/net/softnic/parser.h | 2 +- > drivers/net/softnic/rte_eth_softnic.c | 2 +- > drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- > drivers/net/szedata2/rte_eth_szedata2.c | 8 +- > drivers/net/tap/rte_eth_tap.c | 58 ++-- > drivers/net/tap/rte_eth_tap.h | 2 +- > drivers/net/tap/tap_bpf_program.c | 14 +- > drivers/net/tap/tap_flow.c | 12 +- > drivers/net/thunderx/base/nicvf_mbox.c | 4 +- > drivers/net/thunderx/base/nicvf_plat.h | 2 +- > drivers/net/thunderx/nicvf_ethdev.c | 18 +- > drivers/net/thunderx/nicvf_struct.h | 2 +- > drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- > drivers/net/vhost/rte_eth_vhost.c | 12 +- > drivers/net/virtio/virtio_ethdev.c | 70 ++--- > drivers/net/virtio/virtio_pci.h | 4 +- > drivers/net/virtio/virtio_rxtx.c | 28 +- > 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 | 12 +- > drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- > drivers/net/vmxnet3/vmxnet3_rxtx.c | 44 +-- > examples/bbdev_app/main.c | 40 +-- > examples/bond/main.c | 78 ++--- > examples/distributor/main.c | 4 +- > examples/ethtool/ethtool-app/ethapp.c | 8 +- > examples/ethtool/ethtool-app/main.c | 10 +- > examples/ethtool/lib/rte_ethtool.c | 8 +- > examples/ethtool/lib/rte_ethtool.h | 6 +- > examples/eventdev_pipeline/main.c | 4 +- > examples/eventdev_pipeline/pipeline_common.h | 10 +- > examples/flow_classify/flow_classify.c | 30 +- > examples/flow_filtering/main.c | 10 +- > examples/ip_fragmentation/main.c | 62 ++-- > examples/ip_pipeline/cli.c | 2 +- > examples/ip_pipeline/kni.c | 2 +- > examples/ip_pipeline/parser.c | 18 +- > examples/ip_pipeline/parser.h | 2 +- > examples/ip_pipeline/pipeline.c | 40 +-- > examples/ip_reassembly/main.c | 50 ++-- > examples/ipsec-secgw/esp.c | 42 +-- > examples/ipsec-secgw/ipsec-secgw.c | 38 +-- > examples/ipsec-secgw/sa.c | 6 +- > examples/ipv4_multicast/main.c | 58 ++-- > examples/kni/main.c | 14 +- > examples/l2fwd-cat/l2fwd-cat.c | 4 +- > examples/l2fwd-crypto/main.c | 26 +- > examples/l2fwd-jobstats/main.c | 8 +- > examples/l2fwd-keepalive/main.c | 8 +- > examples/l2fwd/main.c | 8 +- > examples/l3fwd-acl/main.c | 102 +++---- > examples/l3fwd-power/main.c | 100 +++---- > examples/l3fwd-vf/main.c | 68 ++--- > examples/l3fwd/l3fwd.h | 8 +- > examples/l3fwd/l3fwd_altivec.h | 14 +- > examples/l3fwd/l3fwd_common.h | 4 +- > examples/l3fwd/l3fwd_em.c | 44 +-- > examples/l3fwd/l3fwd_em.h | 20 +- > examples/l3fwd/l3fwd_em_hlm.h | 16 +- > examples/l3fwd/l3fwd_em_hlm_neon.h | 16 +- > examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- > examples/l3fwd/l3fwd_em_sequential.h | 16 +- > examples/l3fwd/l3fwd_lpm.c | 50 ++-- > examples/l3fwd/l3fwd_lpm.h | 20 +- > examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- > examples/l3fwd/l3fwd_lpm_neon.h | 30 +- > examples/l3fwd/l3fwd_lpm_sse.h | 20 +- > examples/l3fwd/l3fwd_neon.h | 14 +- > examples/l3fwd/l3fwd_sse.h | 14 +- > examples/l3fwd/main.c | 20 +- > examples/link_status_interrupt/main.c | 8 +- > examples/load_balancer/runtime.c | 6 +- > .../client_server_mp/mp_server/main.c | 2 +- > examples/packet_ordering/main.c | 2 +- > examples/performance-thread/l3fwd-thread/main.c | 322 ++++++++++----------- > examples/ptpclient/ptpclient.c | 32 +- > examples/qos_meter/main.c | 4 +- > examples/qos_sched/init.c | 2 +- > examples/quota_watermark/qw/main.c | 8 +- > examples/rxtx_callbacks/main.c | 4 +- > examples/server_node_efd/node/node.c | 6 +- > examples/server_node_efd/server/main.c | 8 +- > examples/skeleton/basicfwd.c | 4 +- > examples/tep_termination/main.c | 2 +- > examples/tep_termination/main.h | 2 +- > examples/tep_termination/vxlan.c | 108 +++---- > examples/tep_termination/vxlan.h | 8 +- > examples/tep_termination/vxlan_setup.c | 30 +- > examples/tep_termination/vxlan_setup.h | 2 +- > examples/vhost/main.c | 40 +-- > examples/vhost/main.h | 2 +- > examples/vm_power_manager/channel_monitor.c | 2 +- > .../guest_cli/vm_power_cli_guest.c | 2 +- > examples/vm_power_manager/main.c | 6 +- > examples/vmdq/main.c | 12 +- > examples/vmdq_dcb/main.c | 12 +- > lib/librte_cmdline/cmdline_parse_etheraddr.c | 33 +-- > lib/librte_ethdev/rte_eth_ctrl.h | 12 +- > lib/librte_ethdev/rte_ethdev.c | 56 ++-- > lib/librte_ethdev/rte_ethdev.h | 12 +- > lib/librte_ethdev/rte_ethdev_core.h | 12 +- > lib/librte_ethdev/rte_flow.h | 32 +- > lib/librte_eventdev/rte_event_eth_rx_adapter.c | 32 +- > lib/librte_gro/gro_tcp4.c | 26 +- > lib/librte_gro/gro_tcp4.h | 20 +- > lib/librte_gro/gro_vxlan_tcp4.c | 64 ++-- > lib/librte_gro/gro_vxlan_tcp4.h | 6 +- > lib/librte_gso/gso_common.h | 16 +- > lib/librte_gso/gso_tcp4.c | 12 +- > lib/librte_gso/gso_tunnel_tcp4.c | 14 +- > lib/librte_gso/gso_udp4.c | 8 +- > lib/librte_gso/rte_gso.h | 8 +- > lib/librte_hash/rte_thash.h | 2 +- > lib/librte_ip_frag/rte_ip_frag.h | 12 +- > lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- > lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- > lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 +- > lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- > lib/librte_kni/rte_kni.c | 4 +- > lib/librte_kni/rte_kni.h | 2 +- > lib/librte_net/rte_arp.c | 32 +- > lib/librte_net/rte_arp.h | 36 +-- > lib/librte_net/rte_esp.h | 2 +- > lib/librte_net/rte_ether.h | 178 ++++++------ > lib/librte_net/rte_gre.h | 2 +- > lib/librte_net/rte_icmp.h | 6 +- > lib/librte_net/rte_ip.h | 70 ++--- > lib/librte_net/rte_net.c | 90 +++--- > lib/librte_net/rte_net.h | 22 +- > lib/librte_net/rte_sctp.h | 2 +- > lib/librte_net/rte_tcp.h | 2 +- > lib/librte_net/rte_udp.h | 2 +- > lib/librte_pipeline/rte_table_action.c | 210 +++++++------- > lib/librte_pipeline/rte_table_action.h | 4 +- > lib/librte_port/rte_port_ras.c | 8 +- > lib/librte_port/rte_port_source_sink.c | 6 +- > lib/librte_vhost/vhost.h | 2 +- > lib/librte_vhost/virtio_net.c | 42 +-- > test/test-acl/main.c | 2 +- > test/test-pipeline/pipeline_acl.c | 16 +- > test/test-pipeline/pipeline_hash.c | 12 +- > test/test/packet_burst_generator.c | 126 ++++---- > test/test/packet_burst_generator.h | 26 +- > test/test/test_acl.c | 8 +- > test/test/test_acl.h | 122 ++++---- > test/test/test_cmdline_etheraddr.c | 16 +- > test/test/test_efd.c | 20 +- > test/test/test_event_eth_rx_adapter.c | 2 +- > test/test/test_event_eth_tx_adapter.c | 2 +- > test/test/test_flow_classify.c | 68 ++--- > test/test/test_hash.c | 20 +- > test/test/test_link_bonding.c | 284 +++++++++--------- > test/test/test_link_bonding_mode4.c | 116 ++++---- > test/test/test_link_bonding_rssconf.c | 6 +- > test/test/test_lpm.c | 76 ++--- > test/test/test_lpm_perf.c | 10 +- > test/test/test_member.c | 20 +- > test/test/test_pmd_perf.c | 20 +- > test/test/test_sched.c | 20 +- > test/test/test_table_acl.c | 8 +- > test/test/test_thash.c | 12 +- > test/test/virtual_pmd.c | 6 +- > test/test/virtual_pmd.h | 2 +- > 367 files changed, 3906 insertions(+), 3913 deletions(-) > The Linux network developers and Glibc have already agreed on how to handle overlap. Perhaps that policy could be used/extended rather than breaking every userspace application. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (16 preceding siblings ...) 2018-10-24 16:09 ` Stephen Hemminger @ 2018-10-24 16:39 ` Bruce Richardson 2018-10-26 7:20 ` Olivier Matz 2018-10-24 18:38 ` Stephen Hemminger ` (2 subsequent siblings) 20 siblings, 1 reply; 107+ messages in thread From: Bruce Richardson @ 2018-10-24 16:39 UTC (permalink / raw) To: Olivier Matz; +Cc: dev On Wed, Oct 24, 2018 at 10:18:19AM +0200, Olivier Matz wrote: > This RFC targets 19.02. > > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > This was discussed in [1], and more recently at the techboard. > > Before sending the deprecation notice (target for this is 18.11), > here is a draft that can be discussed. > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > One question I'm asking is how can we manage the transition. > Initially, I hoped it was possible to have a compat layer during > one release (supporting both prefixed and unprefixed names), but > now that the patch is done, it seems the impact is too big, and > impacts too many libraries. > > Few examples: > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > - many rte_flow structures use the rte_ prefixed net structures > - the mac field of virtio_net structure is rte_ether_addr > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > ... > > Therefore, it is clear that doing this would break the compilation > of many external applications. > Can you clarify a bit as to why we can't keep around compatibility versions of the headers, alongside the new versions? I'm not following the logic above. Can we not introduce completely new headers with the replacements while leaving the old ones intact? /Bruce ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 16:39 ` Bruce Richardson @ 2018-10-26 7:20 ` Olivier Matz 2018-10-26 10:15 ` Bruce Richardson 0 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2018-10-26 7:20 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev Hi, On Wed, Oct 24, 2018 at 05:39:09PM +0100, Bruce Richardson wrote: > On Wed, Oct 24, 2018 at 10:18:19AM +0200, Olivier Matz wrote: > > This RFC targets 19.02. > > > > The rte_net headers conflict with the libc headers, because > > some definitions are duplicated, sometimes with few differences. > > This was discussed in [1], and more recently at the techboard. > > > > Before sending the deprecation notice (target for this is 18.11), > > here is a draft that can be discussed. > > > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > > and defines in rte_net library. This is a big changeset, that will > > break the API of many functions, but not the ABI. > > > > One question I'm asking is how can we manage the transition. > > Initially, I hoped it was possible to have a compat layer during > > one release (supporting both prefixed and unprefixed names), but > > now that the patch is done, it seems the impact is too big, and > > impacts too many libraries. > > > > Few examples: > > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > > - many rte_flow structures use the rte_ prefixed net structures > > - the mac field of virtio_net structure is rte_ether_addr > > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > > ... > > > > Therefore, it is clear that doing this would break the compilation > > of many external applications. > > > > Can you clarify a bit as to why we can't keep around compatibility versions > of the headers, alongside the new versions? I'm not following the logic > above. Can we not introduce completely new headers with the replacements > while leaving the old ones intact? This is something I tried to do, it is not in the RFC because it was not satisfying, but you can find it there: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff;h=ba1e8e498306 With this patch, the usage of unprefixed structures, defines and functions in rte net is still possible by an external application, except if RTE_NET_NO_COMPAT is defined. However, functions and structures that are not in librte_net (the examples from my previous mail, quoted above) use the rte_ prefixed structures in their prototypes. For instance, an application that use rte_eth_macaddr_get() will no compile anymore because it will pass a (struct ether_addr *) instead of a (struct rte_ether_addr *). I don't see any good mean to fix this. Maybe we can do something with defines, but I don't think it is possible to provide both APIs for functions like rte_eth_macaddr_get(). I'm also not convinced it will be that helpful. At the end, if the patchset is applied, we want the applications to switch to the new API. To ease the transition, we can provide a script to patch an application, very similar to the one I use to generate the patchset. Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-26 7:20 ` Olivier Matz @ 2018-10-26 10:15 ` Bruce Richardson 2018-10-26 11:28 ` Olivier Matz 0 siblings, 1 reply; 107+ messages in thread From: Bruce Richardson @ 2018-10-26 10:15 UTC (permalink / raw) To: Olivier Matz; +Cc: dev On Fri, Oct 26, 2018 at 09:20:15AM +0200, Olivier Matz wrote: > Hi, > > On Wed, Oct 24, 2018 at 05:39:09PM +0100, Bruce Richardson wrote: > > On Wed, Oct 24, 2018 at 10:18:19AM +0200, Olivier Matz wrote: > > > This RFC targets 19.02. > > > > > > The rte_net headers conflict with the libc headers, because > > > some definitions are duplicated, sometimes with few differences. > > > This was discussed in [1], and more recently at the techboard. > > > > > > Before sending the deprecation notice (target for this is 18.11), > > > here is a draft that can be discussed. > > > > > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > > > and defines in rte_net library. This is a big changeset, that will > > > break the API of many functions, but not the ABI. > > > > > > One question I'm asking is how can we manage the transition. > > > Initially, I hoped it was possible to have a compat layer during > > > one release (supporting both prefixed and unprefixed names), but > > > now that the patch is done, it seems the impact is too big, and > > > impacts too many libraries. > > > > > > Few examples: > > > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > > > - many rte_flow structures use the rte_ prefixed net structures > > > - the mac field of virtio_net structure is rte_ether_addr > > > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > > > ... > > > > > > Therefore, it is clear that doing this would break the compilation > > > of many external applications. > > > > > > > Can you clarify a bit as to why we can't keep around compatibility versions > > of the headers, alongside the new versions? I'm not following the logic > > above. Can we not introduce completely new headers with the replacements > > while leaving the old ones intact? > > This is something I tried to do, it is not in the RFC because it was > not satisfying, but you can find it there: > > http://git.droids-corp.org/?p=dpdk.git;a=commitdiff;h=ba1e8e498306 > > With this patch, the usage of unprefixed structures, defines and > functions in rte net is still possible by an external application, > except if RTE_NET_NO_COMPAT is defined. > > However, functions and structures that are not in librte_net (the > examples from my previous mail, quoted above) use the rte_ prefixed > structures in their prototypes. For instance, an application that use > rte_eth_macaddr_get() will no compile anymore because it will pass > a (struct ether_addr *) instead of a (struct rte_ether_addr *). > > I don't see any good mean to fix this. Maybe we can do something with > defines, but I don't think it is possible to provide both APIs for > functions like rte_eth_macaddr_get(). I'm also not convinced it will be > that helpful. At the end, if the patchset is applied, we want the > applications to switch to the new API. To ease the transition, we can > provide a script to patch an application, very similar to the one I use > to generate the patchset. > Out of interest, about how many non rte_net functions are we talking about here? ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-26 10:15 ` Bruce Richardson @ 2018-10-26 11:28 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-26 11:28 UTC (permalink / raw) To: Bruce Richardson; +Cc: dev On Fri, Oct 26, 2018 at 11:15:14AM +0100, Bruce Richardson wrote: > On Fri, Oct 26, 2018 at 09:20:15AM +0200, Olivier Matz wrote: > > Hi, > > > > On Wed, Oct 24, 2018 at 05:39:09PM +0100, Bruce Richardson wrote: > > > On Wed, Oct 24, 2018 at 10:18:19AM +0200, Olivier Matz wrote: > > > > This RFC targets 19.02. > > > > > > > > The rte_net headers conflict with the libc headers, because > > > > some definitions are duplicated, sometimes with few differences. > > > > This was discussed in [1], and more recently at the techboard. > > > > > > > > Before sending the deprecation notice (target for this is 18.11), > > > > here is a draft that can be discussed. > > > > > > > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > > > > and defines in rte_net library. This is a big changeset, that will > > > > break the API of many functions, but not the ABI. > > > > > > > > One question I'm asking is how can we manage the transition. > > > > Initially, I hoped it was possible to have a compat layer during > > > > one release (supporting both prefixed and unprefixed names), but > > > > now that the patch is done, it seems the impact is too big, and > > > > impacts too many libraries. > > > > > > > > Few examples: > > > > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > > > > - many rte_flow structures use the rte_ prefixed net structures > > > > - the mac field of virtio_net structure is rte_ether_addr > > > > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > > > > ... > > > > > > > > Therefore, it is clear that doing this would break the compilation > > > > of many external applications. > > > > > > > > > > Can you clarify a bit as to why we can't keep around compatibility versions > > > of the headers, alongside the new versions? I'm not following the logic > > > above. Can we not introduce completely new headers with the replacements > > > while leaving the old ones intact? > > > > This is something I tried to do, it is not in the RFC because it was > > not satisfying, but you can find it there: > > > > http://git.droids-corp.org/?p=dpdk.git;a=commitdiff;h=ba1e8e498306 > > > > With this patch, the usage of unprefixed structures, defines and > > functions in rte net is still possible by an external application, > > except if RTE_NET_NO_COMPAT is defined. > > > > However, functions and structures that are not in librte_net (the > > examples from my previous mail, quoted above) use the rte_ prefixed > > structures in their prototypes. For instance, an application that use > > rte_eth_macaddr_get() will no compile anymore because it will pass > > a (struct ether_addr *) instead of a (struct rte_ether_addr *). > > > > I don't see any good mean to fix this. Maybe we can do something with > > defines, but I don't think it is possible to provide both APIs for > > functions like rte_eth_macaddr_get(). I'm also not convinced it will be > > that helpful. At the end, if the patchset is applied, we want the > > applications to switch to the new API. To ease the transition, we can > > provide a script to patch an application, very similar to the one I use > > to generate the patchset. > > > > Out of interest, about how many non rte_net functions are we talking about here? I didn't count, but many. And not only functions, also structures. To give an idea, here is the output of: git diff origin/master..HEAD lib/ | filterdiff -i '*.h' -x 'a/lib/librte_net/*' diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h index 5ea8ae24c..821d971cd 100644 --- a/lib/librte_ethdev/rte_eth_ctrl.h +++ b/lib/librte_ethdev/rte_eth_ctrl.h @@ -110,7 +110,7 @@ struct rte_eth_mac_filter { uint8_t is_vf; /**< 1 for VF, 0 for port dev */ uint16_t dst_id; /**< VF ID, available when is_vf is 1*/ enum rte_mac_filter_type filter_type; /**< MAC filter type */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; /** @@ -126,7 +126,7 @@ struct rte_eth_mac_filter { * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. */ struct rte_eth_ethertype_filter { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ uint16_t ether_type; /**< Ether type to match */ uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ uint16_t queue; /**< Queue assigned to when match*/ @@ -265,8 +265,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ /** Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP @@ -473,7 +473,7 @@ struct rte_eth_sctpv6_flow { * A structure used to define the input for MAC VLAN flow */ struct rte_eth_mac_vlan_flow { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** @@ -493,7 +493,7 @@ struct rte_eth_tunnel_flow { enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */ /** Tunnel ID to match. TNI, VNI... in big endian. */ uint32_t tunnel_id; - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index fb40c89e0..5deb4e38e 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2159,7 +2159,7 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, * A pointer to a structure of type *ether_addr* to be filled with * the Ethernet address of the Ethernet device. */ -void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr); +void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Retrieve the contextual information of an Ethernet device. @@ -2843,7 +2843,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, * - (-ENOSPC) if no more MAC addresses can be added. * - (-EINVAL) if MAC address is invalid. */ -int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, +int rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool); /** @@ -2859,7 +2859,7 @@ int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, * - (-ENODEV) if *port* invalid. * - (-EADDRINUSE) if attempting to remove the default MAC address */ -int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); +int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Set the default MAC address. @@ -2875,7 +2875,7 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); * - (-EINVAL) if MAC address is invalid. */ int rte_eth_dev_default_mac_addr_set(uint16_t port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device. @@ -2936,7 +2936,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port_id, * - (-EIO) if device is removed. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on); /** @@ -3479,7 +3479,7 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id, * - (-ENOSPC) if *port_id* has not enough multicast filtering resources. */ int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /** diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 0d28fd902..fa518620e 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -250,17 +250,17 @@ typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); /**< @internal Remove MAC address from receive address register */ typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint8_t on); /**< @internal Set a Unicast Hash bitmap */ @@ -292,7 +292,7 @@ typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, /**< @internal Delete tunneling UDP port */ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /**< @internal set the list of multicast addresses on an Ethernet device */ @@ -597,10 +597,10 @@ struct rte_eth_dev_data { /**< Common rx buffer size handled by all queues */ uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */ - struct ether_addr* mac_addrs;/**< Device Ethernet Link address. */ + struct rte_ether_addr* mac_addrs;/**< Device Ethernet Link address. */ uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR]; /** bitmap array of associating Ethernet MAC addresses to pools */ - struct ether_addr* hash_mac_addrs; + struct rte_ether_addr* hash_mac_addrs; /** Device Ethernet MAC addresses of hash filtering. */ uint16_t port_id; /**< Device [external] port identifier. */ __extension__ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 26e2fcfa0..c27d590a1 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -577,8 +577,8 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = { * same order as on the wire. */ struct rte_flow_item_eth { - struct ether_addr dst; /**< Destination MAC. */ - struct ether_addr src; /**< Source MAC. */ + struct rte_ether_addr dst; /**< Destination MAC. */ + struct rte_ether_addr src; /**< Source MAC. */ rte_be16_t type; /**< EtherType or TPID. */ }; @@ -597,7 +597,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 { @@ -621,7 +621,7 @@ static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { * Note: IPv4 options are handled by dedicated pattern items. */ struct rte_flow_item_ipv4 { - struct ipv4_hdr hdr; /**< IPv4 header definition. */ + struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ @@ -643,7 +643,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { * RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ struct rte_flow_item_ipv6 { - struct ipv6_hdr hdr; /**< IPv6 header definition. */ + struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ @@ -666,7 +666,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { * Matches an ICMP header. */ struct rte_flow_item_icmp { - struct icmp_hdr hdr; /**< ICMP header definition. */ + struct rte_icmp_hdr hdr; /**< ICMP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */ @@ -685,7 +685,7 @@ static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = { * Matches a UDP header. */ struct rte_flow_item_udp { - struct udp_hdr hdr; /**< UDP header definition. */ + struct rte_udp_hdr hdr; /**< UDP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */ @@ -704,7 +704,7 @@ static const struct rte_flow_item_udp rte_flow_item_udp_mask = { * Matches a TCP header. */ struct rte_flow_item_tcp { - struct tcp_hdr hdr; /**< TCP header definition. */ + struct rte_tcp_hdr hdr; /**< TCP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ @@ -723,7 +723,7 @@ static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { * Matches a SCTP header. */ struct rte_flow_item_sctp { - struct sctp_hdr hdr; /**< SCTP header definition. */ + struct rte_sctp_hdr hdr; /**< SCTP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ @@ -761,7 +761,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 { /** @@ -908,7 +908,7 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { * Matches an ESP header. */ struct rte_flow_item_esp { - struct esp_hdr hdr; /**< ESP header definition. */ + struct rte_esp_hdr hdr; /**< ESP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */ @@ -974,9 +974,9 @@ struct rte_flow_item_arp_eth_ipv4 { uint8_t hln; /**< Hardware address length, normally 6. */ uint8_t pln; /**< Protocol address length, normally 4. */ rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ - struct ether_addr sha; /**< Sender hardware address. */ + struct rte_ether_addr sha; /**< Sender hardware address. */ rte_be32_t spa; /**< Sender IPv4 address. */ - struct ether_addr tha; /**< Target hardware address. */ + struct rte_ether_addr tha; /**< Target hardware address. */ rte_be32_t tpa; /**< Target IPv4 address. */ }; @@ -1120,7 +1120,7 @@ rte_flow_item_icmp6_nd_opt_mask = { struct rte_flow_item_icmp6_nd_opt_sla_eth { uint8_t type; /**< ND option type, normally 1. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr sla; /**< Source Ethernet LLA. */ + struct rte_ether_addr sla; /**< Source Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */ @@ -1145,7 +1145,7 @@ rte_flow_item_icmp6_nd_opt_sla_eth_mask = { struct rte_flow_item_icmp6_nd_opt_tla_eth { uint8_t type; /**< ND option type, normally 2. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr tla; /**< Target Ethernet LLA. */ + struct rte_ether_addr tla; /**< Target Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */ @@ -2036,7 +2036,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_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 6bb30cdb9..63f06bec4 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -19,8 +19,8 @@ /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { - struct ether_addr eth_saddr; - struct ether_addr eth_daddr; + struct rte_ether_addr eth_saddr; + struct rte_ether_addr eth_daddr; uint32_t ip_src_addr; uint32_t ip_dst_addr; @@ -182,8 +182,8 @@ uint32_t gro_tcp4_tbl_pkt_count(void *tbl); static inline int is_same_tcp4_flow(struct tcp4_flow_key k1, struct tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && - is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && + return (rte_is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && + rte_is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && (k1.ip_src_addr == k2.ip_src_addr) && (k1.ip_dst_addr == k2.ip_dst_addr) && (k1.recv_ack == k2.recv_ack) && @@ -255,7 +255,7 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, */ static inline int check_seq_option(struct gro_tcp4_item *item, - struct tcp_hdr *tcph, + struct rte_tcp_hdr *tcph, uint32_t sent_seq, uint16_t ip_id, uint16_t tcp_hl, @@ -264,17 +264,17 @@ check_seq_option(struct gro_tcp4_item *item, uint8_t is_atomic) { struct rte_mbuf *pkt_orig = item->firstseg; - struct ipv4_hdr *iph_orig; - struct tcp_hdr *tcph_orig; + struct rte_ipv4_hdr *iph_orig; + struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + + iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); - tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); + tcph_orig = (struct rte_tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; /* Check if TCP option fields equal */ - len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct tcp_hdr); + len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct rte_tcp_hdr); if ((tcp_hl != tcp_hl_orig) || ((len > 0) && (memcmp(tcph + 1, tcph_orig + 1, len) != 0))) diff --git a/lib/librte_gro/gro_vxlan_tcp4.h b/lib/librte_gro/gro_vxlan_tcp4.h index 0cafb9211..7832942a6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.h +++ b/lib/librte_gro/gro_vxlan_tcp4.h @@ -12,10 +12,10 @@ /* Header fields representing a VxLAN flow */ struct vxlan_tcp4_flow_key { struct tcp4_flow_key inner_key; - struct vxlan_hdr vxlan_hdr; + struct rte_vxlan_hdr vxlan_hdr; - struct ether_addr outer_eth_saddr; - struct ether_addr outer_eth_daddr; + struct rte_ether_addr outer_eth_saddr; + struct rte_ether_addr outer_eth_daddr; uint32_t outer_ip_src_addr; uint32_t outer_ip_dst_addr; diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 6cd764ff5..48ad1686f 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -12,8 +12,8 @@ #include <rte_tcp.h> #include <rte_udp.h> -#define IS_FRAGMENTED(frag_off) (((frag_off) & IPV4_HDR_OFFSET_MASK) != 0 \ - || ((frag_off) & IPV4_HDR_MF_FLAG) == IPV4_HDR_MF_FLAG) +#define IS_FRAGMENTED(frag_off) (((frag_off) & RTE_IPV4_HDR_OFFSET_MASK) != 0 \ + || ((frag_off) & RTE_IPV4_HDR_MF_FLAG) == RTE_IPV4_HDR_MF_FLAG) #define TCP_HDR_PSH_MASK ((uint8_t)0x08) #define TCP_HDR_FIN_MASK ((uint8_t)0x01) @@ -46,9 +46,9 @@ static inline void update_udp_header(struct rte_mbuf *pkt, uint16_t udp_offset) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + udp_hdr = (struct rte_udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + udp_offset); udp_hdr->dgram_len = rte_cpu_to_be_16(pkt->pkt_len - udp_offset); } @@ -71,9 +71,9 @@ static inline void update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, uint8_t non_tail) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; - tcp_hdr = (struct tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + tcp_hdr = (struct rte_tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l4_offset); tcp_hdr->sent_seq = rte_cpu_to_be_32(sent_seq); if (likely(non_tail)) @@ -98,9 +98,9 @@ update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, static inline void update_ipv4_header(struct rte_mbuf *pkt, uint16_t l3_offset, uint16_t id) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l3_offset); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - l3_offset); ipv4_hdr->packet_id = rte_cpu_to_be_16(id); diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index a626a11e3..3aab297f4 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -18,12 +18,12 @@ extern "C" { #include <rte_mbuf.h> /* Minimum GSO segment size for TCP based packets. */ -#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) +#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ -#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) +#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h index a6ddb7bf7..adbaf8f70 100644 --- a/lib/librte_hash/rte_thash.h +++ b/lib/librte_hash/rte_thash.h @@ -168,7 +168,7 @@ rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len) * Pointer to rte_ipv6_tuple structure */ static inline void -rte_thash_load_v6_addrs(const struct ipv6_hdr *orig, union rte_thash_tuple *targ) +rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig, union rte_thash_tuple *targ) { #ifdef RTE_ARCH_X86 __m128i ipv6 = _mm_loadu_si128((const __m128i *)orig->src_addr); diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 7f425f610..28ba33dac 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -210,7 +210,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr); /** @@ -225,7 +225,7 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * present. */ static inline struct ipv6_extension_fragment * -rte_ipv6_frag_get_ipv6_fragment_header(struct ipv6_hdr *hdr) +rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr) { if (hdr->proto == IPPROTO_FRAGMENT) { return (struct ipv6_extension_fragment *) ++hdr; @@ -284,7 +284,7 @@ int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr); + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr); /** * Check if the IPv4 packet is fragmented @@ -295,12 +295,12 @@ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * 1 if fragmented, 0 if not fragmented */ static inline int -rte_ipv4_frag_pkt_is_fragmented(const struct ipv4_hdr * hdr) { +rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); return ip_flag != 0 || ip_ofs != 0; } diff --git a/lib/librte_kni/rte_kni.h b/lib/librte_kni/rte_kni.h index 601abdfc6..ce86b19a2 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_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index c96061291..400bd5e2c 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -384,8 +384,8 @@ enum rte_table_action_encap_type { /** Pre-computed Ethernet header fields for encapsulation action. */ struct rte_table_action_ether_hdr { - struct ether_addr da; /**< Destination address. */ - struct ether_addr sa; /**< Source address. */ + struct rte_ether_addr da; /**< Destination address. */ + struct rte_ether_addr sa; /**< Source address. */ }; /** Pre-computed VLAN header fields for encapsulation action. */ diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index b4abad30c..064ebb951 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -356,7 +356,7 @@ struct virtio_net { uint64_t log_size; uint64_t log_base; uint64_t log_addr; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t mtu; struct vhost_device_ops const *notify_ops; ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (17 preceding siblings ...) 2018-10-24 16:39 ` Bruce Richardson @ 2018-10-24 18:38 ` Stephen Hemminger 2018-10-26 7:56 ` Olivier Matz 2018-12-20 21:59 ` Ferruh Yigit 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz 20 siblings, 1 reply; 107+ messages in thread From: Stephen Hemminger @ 2018-10-24 18:38 UTC (permalink / raw) To: Olivier Matz; +Cc: dev On Wed, 24 Oct 2018 10:18:19 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > This RFC targets 19.02. > > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > This was discussed in [1], and more recently at the techboard. > > Before sending the deprecation notice (target for this is 18.11), > here is a draft that can be discussed. > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > One question I'm asking is how can we manage the transition. > Initially, I hoped it was possible to have a compat layer during > one release (supporting both prefixed and unprefixed names), but > now that the patch is done, it seems the impact is too big, and > impacts too many libraries. > > Few examples: > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > - many rte_flow structures use the rte_ prefixed net structures > - the mac field of virtio_net structure is rte_ether_addr > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > ... > > Therefore, it is clear that doing this would break the compilation > of many external applications. > > Another drawback we need to take in account: it will make the > backport of patches more difficult, although this is something > that could be tempered by a script. > > While it is obviously better to have a good namespace convention, > we need to identify the issues we have today before deciding it's > worth doing the change. > > Comments? > > > Things that are missing in RFC: > - test with FreeBSD > - manually fix some indentation issues > > > Olivier Matz (14): > net: add rte prefix to arp structures > net: add rte prefix to arp defines > net: add rte prefix to ether structures > net: add rte prefix to ether functions > net: add rte prefix to ether defines > net: add rte prefix to esp structure > net: add rte prefix to gre structure > net: add rte prefix to icmp structure > net: add rte prefix to icmp defines > net: add rte prefix to ip structure > net: add rte prefix to ip defines > net: add rte prefix to sctp structure > net: add rte prefix to tcp structure > net: add rte prefix to udp structure > > app/pdump/main.c | 2 +- > app/test-eventdev/test_perf_common.c | 2 +- > app/test-eventdev/test_pipeline_common.c | 2 +- > app/test-pmd/cmdline.c | 66 ++--- > app/test-pmd/cmdline_flow.c | 10 +- > app/test-pmd/config.c | 34 +-- > app/test-pmd/csumonly.c | 156 +++++----- > app/test-pmd/flowgen.c | 30 +- > app/test-pmd/icmpecho.c | 120 ++++---- > app/test-pmd/ieee1588fwd.c | 18 +- > app/test-pmd/macfwd.c | 12 +- > app/test-pmd/macswap.c | 16 +- > app/test-pmd/parameters.c | 6 +- > app/test-pmd/testpmd.c | 22 +- > app/test-pmd/testpmd.h | 18 +- > app/test-pmd/txonly.c | 36 +-- > app/test-pmd/util.c | 34 +-- > doc/guides/prog_guide/bbdev.rst | 6 +- > .../prog_guide/packet_classif_access_ctrl.rst | 18 +- > doc/guides/prog_guide/rte_flow.rst | 4 +- > doc/guides/sample_app_ug/flow_classify.rst | 28 +- > doc/guides/sample_app_ug/flow_filtering.rst | 6 +- > doc/guides/sample_app_ug/ip_frag.rst | 16 +- > doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- > doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- > doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- > .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- > doc/guides/sample_app_ug/l3_forward.rst | 12 +- > doc/guides/sample_app_ug/link_status_intr.rst | 6 +- > doc/guides/sample_app_ug/ptpclient.rst | 6 +- > doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- > doc/guides/sample_app_ug/server_node_efd.rst | 12 +- > doc/guides/sample_app_ug/skeleton.rst | 4 +- > doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- > drivers/bus/dpaa/base/fman/fman.c | 2 +- > drivers/bus/dpaa/base/fman/fman_hw.c | 2 +- > drivers/bus/dpaa/include/fman.h | 2 +- > drivers/bus/dpaa/include/netcfg.h | 4 +- > drivers/net/af_packet/rte_eth_af_packet.c | 2 +- > drivers/net/ark/ark_ethdev.c | 16 +- > drivers/net/ark/ark_ext.h | 4 +- > drivers/net/ark/ark_global.h | 4 +- > drivers/net/atlantic/atl_ethdev.c | 20 +- > drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- > drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- > drivers/net/avf/avf.h | 4 +- > drivers/net/avf/avf_ethdev.c | 50 ++-- > drivers/net/avf/avf_rxtx.c | 14 +- > drivers/net/avf/avf_vchnl.c | 8 +- > drivers/net/avf/base/avf_adminq_cmd.h | 4 +- > drivers/net/avf/base/avf_common.c | 12 +- > drivers/net/avf/base/avf_prototype.h | 4 +- > drivers/net/avp/avp_ethdev.c | 20 +- > drivers/net/avp/rte_avp_common.h | 2 +- > drivers/net/axgbe/axgbe_dev.c | 4 +- > drivers/net/axgbe/axgbe_ethdev.c | 10 +- > drivers/net/axgbe/axgbe_ethdev.h | 4 +- > drivers/net/axgbe/axgbe_rxtx.c | 2 +- > drivers/net/bnx2x/bnx2x.c | 16 +- > drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- > drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- > drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- > drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- > drivers/net/bnx2x/ecore_sp.h | 2 +- > drivers/net/bnxt/bnxt.h | 4 +- > drivers/net/bnxt/bnxt_ethdev.c | 70 ++--- > drivers/net/bnxt/bnxt_filter.c | 4 +- > drivers/net/bnxt/bnxt_filter.h | 8 +- > drivers/net/bnxt/bnxt_flow.c | 26 +- > drivers/net/bnxt/bnxt_hwrm.c | 40 +-- > drivers/net/bnxt/bnxt_hwrm.h | 2 +- > 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 | 14 +- > drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- > drivers/net/bonding/rte_eth_bond.h | 2 +- > drivers/net/bonding/rte_eth_bond_8023ad.c | 26 +- > drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- > drivers/net/bonding/rte_eth_bond_alb.c | 78 ++--- > drivers/net/bonding/rte_eth_bond_alb.h | 10 +- > drivers/net/bonding/rte_eth_bond_api.c | 2 +- > drivers/net/bonding/rte_eth_bond_args.c | 2 +- > drivers/net/bonding/rte_eth_bond_pmd.c | 194 ++++++------- > drivers/net/bonding/rte_eth_bond_private.h | 6 +- > drivers/net/cxgbe/base/adapter.h | 6 +- > drivers/net/cxgbe/base/t4_hw.c | 8 +- > drivers/net/cxgbe/cxgbe.h | 4 +- > drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- > drivers/net/cxgbe/cxgbe_filter.h | 2 +- > drivers/net/cxgbe/cxgbe_flow.c | 10 +- > drivers/net/cxgbe/cxgbe_main.c | 4 +- > drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- > 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 | 20 +- > drivers/net/dpaa/dpaa_rxtx.c | 22 +- > drivers/net/dpaa2/dpaa2_ethdev.c | 36 +-- > drivers/net/e1000/e1000_ethdev.h | 2 +- > drivers/net/e1000/em_ethdev.c | 34 +-- > drivers/net/e1000/em_rxtx.c | 22 +- > drivers/net/e1000/igb_ethdev.c | 70 ++--- > drivers/net/e1000/igb_flow.c | 12 +- > drivers/net/e1000/igb_pf.c | 16 +- > drivers/net/e1000/igb_rxtx.c | 18 +- > drivers/net/ena/ena_ethdev.c | 16 +- > drivers/net/ena/ena_ethdev.h | 2 +- > drivers/net/enetc/base/enetc_hw.h | 4 +- > drivers/net/enetc/enetc_ethdev.c | 6 +- > drivers/net/enic/enic.h | 2 +- > drivers/net/enic/enic_clsf.c | 40 +-- > drivers/net/enic/enic_ethdev.c | 4 +- > drivers/net/enic/enic_flow.c | 100 +++---- > drivers/net/enic/enic_main.c | 2 +- > drivers/net/enic/enic_res.c | 4 +- > drivers/net/failsafe/failsafe.c | 6 +- > drivers/net/failsafe/failsafe_args.c | 4 +- > drivers/net/failsafe/failsafe_ether.c | 6 +- > drivers/net/failsafe/failsafe_ops.c | 6 +- > drivers/net/failsafe/failsafe_private.h | 4 +- > drivers/net/fm10k/fm10k.h | 2 +- > drivers/net/fm10k/fm10k_ethdev.c | 18 +- > drivers/net/i40e/base/i40e_adminq_cmd.h | 4 +- > drivers/net/i40e/base/i40e_common.c | 12 +- > drivers/net/i40e/base/i40e_prototype.h | 4 +- > drivers/net/i40e/i40e_ethdev.c | 134 ++++----- > drivers/net/i40e/i40e_ethdev.h | 22 +- > drivers/net/i40e/i40e_ethdev_vf.c | 60 ++-- > drivers/net/i40e/i40e_fdir.c | 126 ++++---- > drivers/net/i40e/i40e_flow.c | 58 ++-- > drivers/net/i40e/i40e_pf.c | 18 +- > drivers/net/i40e/i40e_rxtx.c | 28 +- > drivers/net/i40e/i40e_vf_representor.c | 2 +- > drivers/net/i40e/rte_pmd_i40e.c | 30 +- > drivers/net/i40e/rte_pmd_i40e.h | 8 +- > drivers/net/ixgbe/ixgbe_ethdev.c | 94 +++--- > drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- > drivers/net/ixgbe/ixgbe_flow.c | 22 +- > drivers/net/ixgbe/ixgbe_pf.c | 14 +- > drivers/net/ixgbe/ixgbe_rxtx.c | 14 +- > drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- > drivers/net/ixgbe/rte_pmd_ixgbe.c | 10 +- > drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- > drivers/net/kni/rte_eth_kni.c | 4 +- > drivers/net/liquidio/lio_ethdev.c | 22 +- > drivers/net/mlx4/mlx4.c | 4 +- > drivers/net/mlx4/mlx4.h | 8 +- > drivers/net/mlx4/mlx4_ethdev.c | 8 +- > drivers/net/mlx4/mlx4_flow.c | 14 +- > drivers/net/mlx4/mlx4_rxtx.c | 2 +- > drivers/net/mlx5/mlx5.c | 4 +- > drivers/net/mlx5/mlx5.h | 14 +- > drivers/net/mlx5/mlx5_flow.c | 22 +- > drivers/net/mlx5/mlx5_flow_tcf.c | 40 +-- > drivers/net/mlx5/mlx5_flow_verbs.c | 26 +- > drivers/net/mlx5/mlx5_mac.c | 18 +- > drivers/net/mlx5/mlx5_nl.c | 28 +- > drivers/net/mlx5/mlx5_rxtx.c | 6 +- > drivers/net/mlx5/mlx5_rxtx.h | 2 +- > drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- > drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- > drivers/net/mlx5/mlx5_trigger.c | 6 +- > drivers/net/mvneta/mvneta_ethdev.c | 22 +- > drivers/net/mvneta/mvneta_ethdev.h | 2 +- > drivers/net/mvpp2/mrvl_ethdev.c | 22 +- > drivers/net/mvpp2/mrvl_ethdev.h | 2 +- > drivers/net/mvpp2/mrvl_flow.c | 4 +- > drivers/net/netvsc/hn_ethdev.c | 4 +- > drivers/net/netvsc/hn_nvs.c | 2 +- > drivers/net/netvsc/hn_rndis.c | 2 +- > drivers/net/netvsc/hn_rxtx.c | 12 +- > drivers/net/netvsc/hn_var.h | 4 +- > drivers/net/netvsc/hn_vf.c | 12 +- > drivers/net/nfp/nfp_net.c | 20 +- > drivers/net/nfp/nfp_net_pmd.h | 2 +- > drivers/net/null/rte_eth_null.c | 6 +- > drivers/net/octeontx/octeontx_ethdev.c | 8 +- > drivers/net/octeontx/octeontx_ethdev.h | 2 +- > drivers/net/pcap/rte_eth_pcap.c | 22 +- > drivers/net/qede/base/bcm_osal.h | 2 +- > drivers/net/qede/base/ecore_dev.c | 4 +- > drivers/net/qede/qede_ethdev.c | 58 ++-- > drivers/net/qede/qede_ethdev.h | 6 +- > drivers/net/qede/qede_filter.c | 66 ++--- > drivers/net/qede/qede_if.h | 4 +- > drivers/net/qede/qede_main.c | 6 +- > drivers/net/qede/qede_rxtx.c | 32 +- > drivers/net/qede/qede_rxtx.h | 2 +- > drivers/net/ring/rte_eth_ring.c | 4 +- > drivers/net/sfc/sfc.h | 2 +- > drivers/net/sfc/sfc_ef10_tx.c | 8 +- > drivers/net/sfc/sfc_ethdev.c | 20 +- > drivers/net/sfc/sfc_flow.c | 12 +- > drivers/net/sfc/sfc_port.c | 8 +- > drivers/net/sfc/sfc_tso.c | 8 +- > drivers/net/softnic/parser.c | 18 +- > drivers/net/softnic/parser.h | 2 +- > drivers/net/softnic/rte_eth_softnic.c | 2 +- > drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- > drivers/net/szedata2/rte_eth_szedata2.c | 8 +- > drivers/net/tap/rte_eth_tap.c | 58 ++-- > drivers/net/tap/rte_eth_tap.h | 2 +- > drivers/net/tap/tap_bpf_program.c | 14 +- > drivers/net/tap/tap_flow.c | 12 +- > drivers/net/thunderx/base/nicvf_mbox.c | 4 +- > drivers/net/thunderx/base/nicvf_plat.h | 2 +- > drivers/net/thunderx/nicvf_ethdev.c | 18 +- > drivers/net/thunderx/nicvf_struct.h | 2 +- > drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- > drivers/net/vhost/rte_eth_vhost.c | 12 +- > drivers/net/virtio/virtio_ethdev.c | 70 ++--- > drivers/net/virtio/virtio_pci.h | 4 +- > drivers/net/virtio/virtio_rxtx.c | 28 +- > 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 | 12 +- > drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- > drivers/net/vmxnet3/vmxnet3_rxtx.c | 44 +-- > examples/bbdev_app/main.c | 40 +-- > examples/bond/main.c | 78 ++--- > examples/distributor/main.c | 4 +- > examples/ethtool/ethtool-app/ethapp.c | 8 +- > examples/ethtool/ethtool-app/main.c | 10 +- > examples/ethtool/lib/rte_ethtool.c | 8 +- > examples/ethtool/lib/rte_ethtool.h | 6 +- > examples/eventdev_pipeline/main.c | 4 +- > examples/eventdev_pipeline/pipeline_common.h | 10 +- > examples/flow_classify/flow_classify.c | 30 +- > examples/flow_filtering/main.c | 10 +- > examples/ip_fragmentation/main.c | 62 ++-- > examples/ip_pipeline/cli.c | 2 +- > examples/ip_pipeline/kni.c | 2 +- > examples/ip_pipeline/parser.c | 18 +- > examples/ip_pipeline/parser.h | 2 +- > examples/ip_pipeline/pipeline.c | 40 +-- > examples/ip_reassembly/main.c | 50 ++-- > examples/ipsec-secgw/esp.c | 42 +-- > examples/ipsec-secgw/ipsec-secgw.c | 38 +-- > examples/ipsec-secgw/sa.c | 6 +- > examples/ipv4_multicast/main.c | 58 ++-- > examples/kni/main.c | 14 +- > examples/l2fwd-cat/l2fwd-cat.c | 4 +- > examples/l2fwd-crypto/main.c | 26 +- > examples/l2fwd-jobstats/main.c | 8 +- > examples/l2fwd-keepalive/main.c | 8 +- > examples/l2fwd/main.c | 8 +- > examples/l3fwd-acl/main.c | 102 +++---- > examples/l3fwd-power/main.c | 100 +++---- > examples/l3fwd-vf/main.c | 68 ++--- > examples/l3fwd/l3fwd.h | 8 +- > examples/l3fwd/l3fwd_altivec.h | 14 +- > examples/l3fwd/l3fwd_common.h | 4 +- > examples/l3fwd/l3fwd_em.c | 44 +-- > examples/l3fwd/l3fwd_em.h | 20 +- > examples/l3fwd/l3fwd_em_hlm.h | 16 +- > examples/l3fwd/l3fwd_em_hlm_neon.h | 16 +- > examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- > examples/l3fwd/l3fwd_em_sequential.h | 16 +- > examples/l3fwd/l3fwd_lpm.c | 50 ++-- > examples/l3fwd/l3fwd_lpm.h | 20 +- > examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- > examples/l3fwd/l3fwd_lpm_neon.h | 30 +- > examples/l3fwd/l3fwd_lpm_sse.h | 20 +- > examples/l3fwd/l3fwd_neon.h | 14 +- > examples/l3fwd/l3fwd_sse.h | 14 +- > examples/l3fwd/main.c | 20 +- > examples/link_status_interrupt/main.c | 8 +- > examples/load_balancer/runtime.c | 6 +- > .../client_server_mp/mp_server/main.c | 2 +- > examples/packet_ordering/main.c | 2 +- > examples/performance-thread/l3fwd-thread/main.c | 322 ++++++++++----------- > examples/ptpclient/ptpclient.c | 32 +- > examples/qos_meter/main.c | 4 +- > examples/qos_sched/init.c | 2 +- > examples/quota_watermark/qw/main.c | 8 +- > examples/rxtx_callbacks/main.c | 4 +- > examples/server_node_efd/node/node.c | 6 +- > examples/server_node_efd/server/main.c | 8 +- > examples/skeleton/basicfwd.c | 4 +- > examples/tep_termination/main.c | 2 +- > examples/tep_termination/main.h | 2 +- > examples/tep_termination/vxlan.c | 108 +++---- > examples/tep_termination/vxlan.h | 8 +- > examples/tep_termination/vxlan_setup.c | 30 +- > examples/tep_termination/vxlan_setup.h | 2 +- > examples/vhost/main.c | 40 +-- > examples/vhost/main.h | 2 +- > examples/vm_power_manager/channel_monitor.c | 2 +- > .../guest_cli/vm_power_cli_guest.c | 2 +- > examples/vm_power_manager/main.c | 6 +- > examples/vmdq/main.c | 12 +- > examples/vmdq_dcb/main.c | 12 +- > lib/librte_cmdline/cmdline_parse_etheraddr.c | 33 +-- > lib/librte_ethdev/rte_eth_ctrl.h | 12 +- > lib/librte_ethdev/rte_ethdev.c | 56 ++-- > lib/librte_ethdev/rte_ethdev.h | 12 +- > lib/librte_ethdev/rte_ethdev_core.h | 12 +- > lib/librte_ethdev/rte_flow.h | 32 +- > lib/librte_eventdev/rte_event_eth_rx_adapter.c | 32 +- > lib/librte_gro/gro_tcp4.c | 26 +- > lib/librte_gro/gro_tcp4.h | 20 +- > lib/librte_gro/gro_vxlan_tcp4.c | 64 ++-- > lib/librte_gro/gro_vxlan_tcp4.h | 6 +- > lib/librte_gso/gso_common.h | 16 +- > lib/librte_gso/gso_tcp4.c | 12 +- > lib/librte_gso/gso_tunnel_tcp4.c | 14 +- > lib/librte_gso/gso_udp4.c | 8 +- > lib/librte_gso/rte_gso.h | 8 +- > lib/librte_hash/rte_thash.h | 2 +- > lib/librte_ip_frag/rte_ip_frag.h | 12 +- > lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- > lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- > lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 +- > lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- > lib/librte_kni/rte_kni.c | 4 +- > lib/librte_kni/rte_kni.h | 2 +- > lib/librte_net/rte_arp.c | 32 +- > lib/librte_net/rte_arp.h | 36 +-- > lib/librte_net/rte_esp.h | 2 +- > lib/librte_net/rte_ether.h | 178 ++++++------ > lib/librte_net/rte_gre.h | 2 +- > lib/librte_net/rte_icmp.h | 6 +- > lib/librte_net/rte_ip.h | 70 ++--- > lib/librte_net/rte_net.c | 90 +++--- > lib/librte_net/rte_net.h | 22 +- > lib/librte_net/rte_sctp.h | 2 +- > lib/librte_net/rte_tcp.h | 2 +- > lib/librte_net/rte_udp.h | 2 +- > lib/librte_pipeline/rte_table_action.c | 210 +++++++------- > lib/librte_pipeline/rte_table_action.h | 4 +- > lib/librte_port/rte_port_ras.c | 8 +- > lib/librte_port/rte_port_source_sink.c | 6 +- > lib/librte_vhost/vhost.h | 2 +- > lib/librte_vhost/virtio_net.c | 42 +-- > test/test-acl/main.c | 2 +- > test/test-pipeline/pipeline_acl.c | 16 +- > test/test-pipeline/pipeline_hash.c | 12 +- > test/test/packet_burst_generator.c | 126 ++++---- > test/test/packet_burst_generator.h | 26 +- > test/test/test_acl.c | 8 +- > test/test/test_acl.h | 122 ++++---- > test/test/test_cmdline_etheraddr.c | 16 +- > test/test/test_efd.c | 20 +- > test/test/test_event_eth_rx_adapter.c | 2 +- > test/test/test_event_eth_tx_adapter.c | 2 +- > test/test/test_flow_classify.c | 68 ++--- > test/test/test_hash.c | 20 +- > test/test/test_link_bonding.c | 284 +++++++++--------- > test/test/test_link_bonding_mode4.c | 116 ++++---- > test/test/test_link_bonding_rssconf.c | 6 +- > test/test/test_lpm.c | 76 ++--- > test/test/test_lpm_perf.c | 10 +- > test/test/test_member.c | 20 +- > test/test/test_pmd_perf.c | 20 +- > test/test/test_sched.c | 20 +- > test/test/test_table_acl.c | 8 +- > test/test/test_thash.c | 12 +- > test/test/virtual_pmd.c | 6 +- > test/test/virtual_pmd.h | 2 +- > 367 files changed, 3906 insertions(+), 3913 deletions(-) > Since BSD structures are available on Linux and BSD why is DPDK reinventing? There is no value in doing that. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 18:38 ` Stephen Hemminger @ 2018-10-26 7:56 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2018-10-26 7:56 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev Hi Stephen, On Wed, Oct 24, 2018 at 11:38:12AM -0700, Stephen Hemminger wrote: > On Wed, 24 Oct 2018 10:18:19 +0200 > Olivier Matz <olivier.matz@6wind.com> wrote: > > > This RFC targets 19.02. > > > > The rte_net headers conflict with the libc headers, because > > some definitions are duplicated, sometimes with few differences. > > This was discussed in [1], and more recently at the techboard. > > > > Before sending the deprecation notice (target for this is 18.11), > > here is a draft that can be discussed. > > > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > > and defines in rte_net library. This is a big changeset, that will > > break the API of many functions, but not the ABI. > > > > One question I'm asking is how can we manage the transition. > > Initially, I hoped it was possible to have a compat layer during > > one release (supporting both prefixed and unprefixed names), but > > now that the patch is done, it seems the impact is too big, and > > impacts too many libraries. > > > > Few examples: > > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > > - many rte_flow structures use the rte_ prefixed net structures > > - the mac field of virtio_net structure is rte_ether_addr > > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > > ... > > > > Therefore, it is clear that doing this would break the compilation > > of many external applications. > > > > Another drawback we need to take in account: it will make the > > backport of patches more difficult, although this is something > > that could be tempered by a script. > > > > While it is obviously better to have a good namespace convention, > > we need to identify the issues we have today before deciding it's > > worth doing the change. > > > > Comments? > > > > > > Things that are missing in RFC: > > - test with FreeBSD > > - manually fix some indentation issues > > > > > > Olivier Matz (14): > > net: add rte prefix to arp structures > > net: add rte prefix to arp defines > > net: add rte prefix to ether structures > > net: add rte prefix to ether functions > > net: add rte prefix to ether defines > > net: add rte prefix to esp structure > > net: add rte prefix to gre structure > > net: add rte prefix to icmp structure > > net: add rte prefix to icmp defines > > net: add rte prefix to ip structure > > net: add rte prefix to ip defines > > net: add rte prefix to sctp structure > > net: add rte prefix to tcp structure > > net: add rte prefix to udp structure > > > > Since BSD structures are available on Linux and BSD why is DPDK reinventing? > There is no value in doing that. >From what I see, some structures or defines are a bit different in Linux and FreeBSD. Examples: /* Linux */ struct ether_addr { u_int8_t ether_addr_octet[ETH_ALEN]; } __attribute__ ((__packed__)); /* FreeBSD */ struct ether_addr { u_char octet[ETHER_ADDR_LEN]; } __packed; That's true the compat between Linux and FreeBSD is better than before in glibc. For instance with 7011c2622fe3 ("Remove __FAVOR_BSD.") added in 2013 (glibc 2.19). It seems that MUSL also supports BSD network structures. So, I agree that using BSD structure looks possible, at least for ip/ip6/tcp/udp/icmp/... structures and defines. I think we would still need to provide some network structures for less usual protocols. The question is: are we confident that the support of network BSD struct/defines/funcs is good enough in all libc we (will) want to use? Since DPDK is a network software, it is not that odd to provide our own network structures, because we will have control on them. Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (18 preceding siblings ...) 2018-10-24 18:38 ` Stephen Hemminger @ 2018-12-20 21:59 ` Ferruh Yigit 2018-12-20 23:48 ` Stephen Hemminger 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz 20 siblings, 1 reply; 107+ messages in thread From: Ferruh Yigit @ 2018-12-20 21:59 UTC (permalink / raw) To: Olivier MATZ, dpdk-dev; +Cc: Stephen Hemminger, Keith Wiles, Bruce Richardson On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: > This RFC targets 19.02. > > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > This was discussed in [1], and more recently at the techboard. > > Before sending the deprecation notice (target for this is 18.11), > here is a draft that can be discussed. > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > One question I'm asking is how can we manage the transition. > Initially, I hoped it was possible to have a compat layer during > one release (supporting both prefixed and unprefixed names), but > now that the patch is done, it seems the impact is too big, and > impacts too many libraries. > > Few examples: > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > - many rte_flow structures use the rte_ prefixed net structures > - the mac field of virtio_net structure is rte_ether_addr > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > ... > > Therefore, it is clear that doing this would break the compilation > of many external applications. > > Another drawback we need to take in account: it will make the > backport of patches more difficult, although this is something > that could be tempered by a script. > > While it is obviously better to have a good namespace convention, > we need to identify the issues we have today before deciding it's > worth doing the change. > > Comments? Is there an consensus about the patchset? There was a decision on techboard to go with this change (adding rte_ prefix) [1]. This is something that will affect DPDK consumers. Since many APIs are changing most probably will break API compatibility for many libraries. Meanwhile the conflict with the libc headers mentioned a few times in the past, this is something we need to fix. There are a few comments reluctant to this big modification, but what I understand from Olivier's response both using BSD defines or having compatibility headers in DPDK won't solve the problem completely. And assuming we will continue with this solution, another question is do we still want to push in 19.02 scope? (And from process point of view I think a deprecation notice is not merged for this change in 18.11 scope.) With the prediction of 19.05 will be big and already break API/ABI for some libraries, can we push this into 19.05 as an early merge into repo? And I think this patch will affect LTS releases and will break auto backporting for many fixes because it touches many places, so pushing this change even to next LTS (19.11) can be an option. Olivier, Thomas, What do you think about postponing this to 19.05 or even 19.11 ? [1] https://mails.dpdk.org/archives/dev/2018-October/116695.html > > > Things that are missing in RFC: > - test with FreeBSD > - manually fix some indentation issues > > > Olivier Matz (14): > net: add rte prefix to arp structures > net: add rte prefix to arp defines > net: add rte prefix to ether structures > net: add rte prefix to ether functions > net: add rte prefix to ether defines > net: add rte prefix to esp structure > net: add rte prefix to gre structure > net: add rte prefix to icmp structure > net: add rte prefix to icmp defines > net: add rte prefix to ip structure > net: add rte prefix to ip defines > net: add rte prefix to sctp structure > net: add rte prefix to tcp structure > net: add rte prefix to udp structure ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-12-20 21:59 ` Ferruh Yigit @ 2018-12-20 23:48 ` Stephen Hemminger 2018-12-21 14:38 ` Wiles, Keith 0 siblings, 1 reply; 107+ messages in thread From: Stephen Hemminger @ 2018-12-20 23:48 UTC (permalink / raw) To: Ferruh Yigit; +Cc: Olivier MATZ, dpdk-dev, Keith Wiles, Bruce Richardson On Thu, 20 Dec 2018 21:59:37 +0000 Ferruh Yigit <ferruh.yigit@intel.com> wrote: > On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: > > This RFC targets 19.02. > > > > The rte_net headers conflict with the libc headers, because > > some definitions are duplicated, sometimes with few differences. > > This was discussed in [1], and more recently at the techboard. > > > > Before sending the deprecation notice (target for this is 18.11), > > here is a draft that can be discussed. > > > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > > and defines in rte_net library. This is a big changeset, that will > > break the API of many functions, but not the ABI. > > > > One question I'm asking is how can we manage the transition. > > Initially, I hoped it was possible to have a compat layer during > > one release (supporting both prefixed and unprefixed names), but > > now that the patch is done, it seems the impact is too big, and > > impacts too many libraries. > > > > Few examples: > > - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > > - many rte_flow structures use the rte_ prefixed net structures > > - the mac field of virtio_net structure is rte_ether_addr > > - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > > ... > > > > Therefore, it is clear that doing this would break the compilation > > of many external applications. > > > > Another drawback we need to take in account: it will make the > > backport of patches more difficult, although this is something > > that could be tempered by a script. > > > > While it is obviously better to have a good namespace convention, > > we need to identify the issues we have today before deciding it's > > worth doing the change. > > > > Comments? > > Is there an consensus about the patchset? There was a decision on techboard to > go with this change (adding rte_ prefix) [1]. > > > This is something that will affect DPDK consumers. Since many APIs are changing > most probably will break API compatibility for many libraries. > > Meanwhile the conflict with the libc headers mentioned a few times in the past, > this is something we need to fix. > > There are a few comments reluctant to this big modification, but what I > understand from Olivier's response both using BSD defines or having > compatibility headers in DPDK won't solve the problem completely. > > And assuming we will continue with this solution, another question is do we > still want to push in 19.02 scope? (And from process point of view I think a > deprecation notice is not merged for this change in 18.11 scope.) > > With the prediction of 19.05 will be big and already break API/ABI for some > libraries, can we push this into 19.05 as an early merge into repo? > > And I think this patch will affect LTS releases and will break auto backporting > for many fixes because it touches many places, so pushing this change even to > next LTS (19.11) can be an option. > > > Olivier, Thomas, > > What do you think about postponing this to 19.05 or even 19.11 ? > > > > [1] > https://mails.dpdk.org/archives/dev/2018-October/116695.html > > > > > > > Things that are missing in RFC: > > - test with FreeBSD > > - manually fix some indentation issues > > > > > > Olivier Matz (14): > > net: add rte prefix to arp structures > > net: add rte prefix to arp defines > > net: add rte prefix to ether structures > > net: add rte prefix to ether functions > > net: add rte prefix to ether defines > > net: add rte prefix to esp structure > > net: add rte prefix to gre structure > > net: add rte prefix to icmp structure > > net: add rte prefix to icmp defines > > net: add rte prefix to ip structure > > net: add rte prefix to ip defines > > net: add rte prefix to sctp structure > > net: add rte prefix to tcp structure > > net: add rte prefix to udp structure > > Sigh. Another case where DPDK has to reinvent something because we can't figure out how to do dependent libraries correctly. I would have rather just using the existing Linux, BSD definitions and fixing the DPDK code. It is probably the only viable compromise, but it adds to long term maintenance, and breaks DPDK applications. Neither of which is a good thing. Should this be done by marking the old structure deprecated first? Ideally, spread over three releases: first, tell the users in the documentation it is coming; second, mark the old structures as deprecated causing compiler warnings; third, remove the old definitions. Doing at once is introducing user pain for no gain. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-12-20 23:48 ` Stephen Hemminger @ 2018-12-21 14:38 ` Wiles, Keith 2018-12-21 15:14 ` Ferruh Yigit 0 siblings, 1 reply; 107+ messages in thread From: Wiles, Keith @ 2018-12-21 14:38 UTC (permalink / raw) To: Stephen Hemminger Cc: Yigit, Ferruh, Olivier MATZ, dpdk-dev, Richardson, Bruce > On Dec 20, 2018, at 5:48 PM, Stephen Hemminger <stephen@networkplumber.org> wrote: > > On Thu, 20 Dec 2018 21:59:37 +0000 > Ferruh Yigit <ferruh.yigit@intel.com> wrote: > >> On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: >>> This RFC targets 19.02. >>> >>> The rte_net headers conflict with the libc headers, because >>> some definitions are duplicated, sometimes with few differences. >>> This was discussed in [1], and more recently at the techboard. >>> >>> Before sending the deprecation notice (target for this is 18.11), >>> here is a draft that can be discussed. >>> >>> This RFC adds the rte_ (or RTE_) prefix to all structures, functions >>> and defines in rte_net library. This is a big changeset, that will >>> break the API of many functions, but not the ABI. >>> >>> One question I'm asking is how can we manage the transition. >>> Initially, I hoped it was possible to have a compat layer during >>> one release (supporting both prefixed and unprefixed names), but >>> now that the patch is done, it seems the impact is too big, and >>> impacts too many libraries. >>> >>> Few examples: >>> - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) >>> - many rte_flow structures use the rte_ prefixed net structures >>> - the mac field of virtio_net structure is rte_ether_addr >>> - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) >>> ... >>> >>> Therefore, it is clear that doing this would break the compilation >>> of many external applications. >>> >>> Another drawback we need to take in account: it will make the >>> backport of patches more difficult, although this is something >>> that could be tempered by a script. >>> >>> While it is obviously better to have a good namespace convention, >>> we need to identify the issues we have today before deciding it's >>> worth doing the change. >>> >>> Comments? >> >> Is there an consensus about the patchset? There was a decision on techboard to >> go with this change (adding rte_ prefix) [1]. >> >> >> This is something that will affect DPDK consumers. Since many APIs are changing >> most probably will break API compatibility for many libraries. >> >> Meanwhile the conflict with the libc headers mentioned a few times in the past, >> this is something we need to fix. >> >> There are a few comments reluctant to this big modification, but what I >> understand from Olivier's response both using BSD defines or having >> compatibility headers in DPDK won't solve the problem completely. >> >> And assuming we will continue with this solution, another question is do we >> still want to push in 19.02 scope? (And from process point of view I think a >> deprecation notice is not merged for this change in 18.11 scope.) >> >> With the prediction of 19.05 will be big and already break API/ABI for some >> libraries, can we push this into 19.05 as an early merge into repo? >> >> And I think this patch will affect LTS releases and will break auto backporting >> for many fixes because it touches many places, so pushing this change even to >> next LTS (19.11) can be an option. >> >> >> Olivier, Thomas, >> >> What do you think about postponing this to 19.05 or even 19.11 ? >> >> >> >> [1] >> https://mails.dpdk.org/archives/dev/2018-October/116695.html >> >>> >>> >>> Things that are missing in RFC: >>> - test with FreeBSD >>> - manually fix some indentation issues >>> >>> >>> Olivier Matz (14): >>> net: add rte prefix to arp structures >>> net: add rte prefix to arp defines >>> net: add rte prefix to ether structures >>> net: add rte prefix to ether functions >>> net: add rte prefix to ether defines >>> net: add rte prefix to esp structure >>> net: add rte prefix to gre structure >>> net: add rte prefix to icmp structure >>> net: add rte prefix to icmp defines >>> net: add rte prefix to ip structure >>> net: add rte prefix to ip defines >>> net: add rte prefix to sctp structure >>> net: add rte prefix to tcp structure >>> net: add rte prefix to udp structure >> >> > > Sigh. Another case where DPDK has to reinvent something because > we can't figure out how to do dependent libraries correctly. > I would have rather just using the existing Linux, BSD definitions > and fixing the DPDK code. > > It is probably the only viable compromise, but it adds to long > term maintenance, and breaks DPDK applications. Neither of which > is a good thing. > > Should this be done by marking the old structure deprecated > first? Ideally, spread over three releases: first, tell the users > in the documentation it is coming; second, mark the old structures > as deprecated causing compiler warnings; third, remove the old > definitions. Doing at once is introducing user pain for no gain. +1 Regards, Keith ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-12-21 14:38 ` Wiles, Keith @ 2018-12-21 15:14 ` Ferruh Yigit 2018-12-27 9:35 ` Olivier Matz 0 siblings, 1 reply; 107+ messages in thread From: Ferruh Yigit @ 2018-12-21 15:14 UTC (permalink / raw) To: Wiles, Keith, Stephen Hemminger; +Cc: Olivier MATZ, dpdk-dev, Richardson, Bruce On 12/21/2018 2:38 PM, Wiles, Keith wrote: > > >> On Dec 20, 2018, at 5:48 PM, Stephen Hemminger <stephen@networkplumber.org> wrote: >> >> On Thu, 20 Dec 2018 21:59:37 +0000 >> Ferruh Yigit <ferruh.yigit@intel.com> wrote: >> >>> On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: >>>> This RFC targets 19.02. >>>> >>>> The rte_net headers conflict with the libc headers, because >>>> some definitions are duplicated, sometimes with few differences. >>>> This was discussed in [1], and more recently at the techboard. >>>> >>>> Before sending the deprecation notice (target for this is 18.11), >>>> here is a draft that can be discussed. >>>> >>>> This RFC adds the rte_ (or RTE_) prefix to all structures, functions >>>> and defines in rte_net library. This is a big changeset, that will >>>> break the API of many functions, but not the ABI. >>>> >>>> One question I'm asking is how can we manage the transition. >>>> Initially, I hoped it was possible to have a compat layer during >>>> one release (supporting both prefixed and unprefixed names), but >>>> now that the patch is done, it seems the impact is too big, and >>>> impacts too many libraries. >>>> >>>> Few examples: >>>> - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) >>>> - many rte_flow structures use the rte_ prefixed net structures >>>> - the mac field of virtio_net structure is rte_ether_addr >>>> - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) >>>> ... >>>> >>>> Therefore, it is clear that doing this would break the compilation >>>> of many external applications. >>>> >>>> Another drawback we need to take in account: it will make the >>>> backport of patches more difficult, although this is something >>>> that could be tempered by a script. >>>> >>>> While it is obviously better to have a good namespace convention, >>>> we need to identify the issues we have today before deciding it's >>>> worth doing the change. >>>> >>>> Comments? >>> >>> Is there an consensus about the patchset? There was a decision on techboard to >>> go with this change (adding rte_ prefix) [1]. >>> >>> >>> This is something that will affect DPDK consumers. Since many APIs are changing >>> most probably will break API compatibility for many libraries. >>> >>> Meanwhile the conflict with the libc headers mentioned a few times in the past, >>> this is something we need to fix. >>> >>> There are a few comments reluctant to this big modification, but what I >>> understand from Olivier's response both using BSD defines or having >>> compatibility headers in DPDK won't solve the problem completely. >>> >>> And assuming we will continue with this solution, another question is do we >>> still want to push in 19.02 scope? (And from process point of view I think a >>> deprecation notice is not merged for this change in 18.11 scope.) >>> >>> With the prediction of 19.05 will be big and already break API/ABI for some >>> libraries, can we push this into 19.05 as an early merge into repo? >>> >>> And I think this patch will affect LTS releases and will break auto backporting >>> for many fixes because it touches many places, so pushing this change even to >>> next LTS (19.11) can be an option. >>> >>> >>> Olivier, Thomas, >>> >>> What do you think about postponing this to 19.05 or even 19.11 ? >>> >>> >>> >>> [1] >>> https://mails.dpdk.org/archives/dev/2018-October/116695.html >>> >>>> >>>> >>>> Things that are missing in RFC: >>>> - test with FreeBSD >>>> - manually fix some indentation issues >>>> >>>> >>>> Olivier Matz (14): >>>> net: add rte prefix to arp structures >>>> net: add rte prefix to arp defines >>>> net: add rte prefix to ether structures >>>> net: add rte prefix to ether functions >>>> net: add rte prefix to ether defines >>>> net: add rte prefix to esp structure >>>> net: add rte prefix to gre structure >>>> net: add rte prefix to icmp structure >>>> net: add rte prefix to icmp defines >>>> net: add rte prefix to ip structure >>>> net: add rte prefix to ip defines >>>> net: add rte prefix to sctp structure >>>> net: add rte prefix to tcp structure >>>> net: add rte prefix to udp structure >>> >>> >> >> Sigh. Another case where DPDK has to reinvent something because >> we can't figure out how to do dependent libraries correctly. >> I would have rather just using the existing Linux, BSD definitions >> and fixing the DPDK code. >> >> It is probably the only viable compromise, but it adds to long >> term maintenance, and breaks DPDK applications. Neither of which >> is a good thing. >> >> Should this be done by marking the old structure deprecated >> first? Ideally, spread over three releases: first, tell the users >> in the documentation it is coming; second, mark the old structures >> as deprecated causing compiler warnings; third, remove the old >> definitions. Doing at once is introducing user pain for no gain. > > +1 With the current timeline, readiness of the patch and comments, at least it won't able to make this release, I will update the patchset status as 'Deferred' Should we discuss this again in techboard? ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-12-21 15:14 ` Ferruh Yigit @ 2018-12-27 9:35 ` Olivier Matz 2019-02-13 11:48 ` Yigit, Ferruh 0 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2018-12-27 9:35 UTC (permalink / raw) To: Ferruh Yigit; +Cc: Wiles, Keith, Stephen Hemminger, dpdk-dev, Richardson, Bruce Hi, On Fri, Dec 21, 2018 at 03:14:29PM +0000, Ferruh Yigit wrote: > On 12/21/2018 2:38 PM, Wiles, Keith wrote: > > > > > >> On Dec 20, 2018, at 5:48 PM, Stephen Hemminger <stephen@networkplumber.org> wrote: > >> > >> On Thu, 20 Dec 2018 21:59:37 +0000 > >> Ferruh Yigit <ferruh.yigit@intel.com> wrote: > >> > >>> On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: > >>>> This RFC targets 19.02. > >>>> > >>>> The rte_net headers conflict with the libc headers, because > >>>> some definitions are duplicated, sometimes with few differences. > >>>> This was discussed in [1], and more recently at the techboard. > >>>> > >>>> Before sending the deprecation notice (target for this is 18.11), > >>>> here is a draft that can be discussed. > >>>> > >>>> This RFC adds the rte_ (or RTE_) prefix to all structures, functions > >>>> and defines in rte_net library. This is a big changeset, that will > >>>> break the API of many functions, but not the ABI. > >>>> > >>>> One question I'm asking is how can we manage the transition. > >>>> Initially, I hoped it was possible to have a compat layer during > >>>> one release (supporting both prefixed and unprefixed names), but > >>>> now that the patch is done, it seems the impact is too big, and > >>>> impacts too many libraries. > >>>> > >>>> Few examples: > >>>> - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > >>>> - many rte_flow structures use the rte_ prefixed net structures > >>>> - the mac field of virtio_net structure is rte_ether_addr > >>>> - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > >>>> ... > >>>> > >>>> Therefore, it is clear that doing this would break the compilation > >>>> of many external applications. > >>>> > >>>> Another drawback we need to take in account: it will make the > >>>> backport of patches more difficult, although this is something > >>>> that could be tempered by a script. > >>>> > >>>> While it is obviously better to have a good namespace convention, > >>>> we need to identify the issues we have today before deciding it's > >>>> worth doing the change. > >>>> > >>>> Comments? > >>> > >>> Is there an consensus about the patchset? There was a decision on techboard to > >>> go with this change (adding rte_ prefix) [1]. > >>> > >>> > >>> This is something that will affect DPDK consumers. Since many APIs are changing > >>> most probably will break API compatibility for many libraries. > >>> > >>> Meanwhile the conflict with the libc headers mentioned a few times in the past, > >>> this is something we need to fix. > >>> > >>> There are a few comments reluctant to this big modification, but what I > >>> understand from Olivier's response both using BSD defines or having > >>> compatibility headers in DPDK won't solve the problem completely. > >>> > >>> And assuming we will continue with this solution, another question is do we > >>> still want to push in 19.02 scope? (And from process point of view I think a > >>> deprecation notice is not merged for this change in 18.11 scope.) > >>> > >>> With the prediction of 19.05 will be big and already break API/ABI for some > >>> libraries, can we push this into 19.05 as an early merge into repo? > >>> > >>> And I think this patch will affect LTS releases and will break auto backporting > >>> for many fixes because it touches many places, so pushing this change even to > >>> next LTS (19.11) can be an option. > >>> > >>> > >>> Olivier, Thomas, > >>> > >>> What do you think about postponing this to 19.05 or even 19.11 ? > >>> > >>> > >>> > >>> [1] > >>> https://mails.dpdk.org/archives/dev/2018-October/116695.html > >>> > >>>> > >>>> > >>>> Things that are missing in RFC: > >>>> - test with FreeBSD > >>>> - manually fix some indentation issues > >>>> > >>>> > >>>> Olivier Matz (14): > >>>> net: add rte prefix to arp structures > >>>> net: add rte prefix to arp defines > >>>> net: add rte prefix to ether structures > >>>> net: add rte prefix to ether functions > >>>> net: add rte prefix to ether defines > >>>> net: add rte prefix to esp structure > >>>> net: add rte prefix to gre structure > >>>> net: add rte prefix to icmp structure > >>>> net: add rte prefix to icmp defines > >>>> net: add rte prefix to ip structure > >>>> net: add rte prefix to ip defines > >>>> net: add rte prefix to sctp structure > >>>> net: add rte prefix to tcp structure > >>>> net: add rte prefix to udp structure > >>> > >>> > >> > >> Sigh. Another case where DPDK has to reinvent something because > >> we can't figure out how to do dependent libraries correctly. > >> I would have rather just using the existing Linux, BSD definitions > >> and fixing the DPDK code. It is not that simple. As I said in [1], there are still some differences between gnu libc and freebsd libc. Unfortunatly, the struct ether_addr is one of the most important in dpdk, because it is widely used in APIs (drivers). We can find others differences, for instance in constant definitions in if_arp.h. I also see that some structures are packed in freebsd but not in glibc (ex: icmp6), this could have performance impact. Many protocols that are currently defined in dpdk are missing in glibc: esp, sctp, gre, mpls, ... so we will at least need rte_ structures for these protocols. Supporting other OSes or libc in the future could also increase the gaps. For these reasons think it is reasonable to have a consistent set of network structures in dpdk. [1] https://mails.dpdk.org/archives/dev/2018-October/117258.html > >> It is probably the only viable compromise, but it adds to long > >> term maintenance, and breaks DPDK applications. Neither of which > >> is a good thing. > >> > >> Should this be done by marking the old structure deprecated > >> first? Ideally, spread over three releases: first, tell the users > >> in the documentation it is coming; second, mark the old structures > >> as deprecated causing compiler warnings; third, remove the old > >> definitions. Doing at once is introducing user pain for no gain. > > > > +1 Annoucing the change before doing it is obvious. Marking the old structures as deprecated before removing them is maybe doable (to be checked that it does not cause conflicts with new structures), but it means the conflict with libc headers that we are trying to solve will remain for one more version, for a limited gain. > With the current timeline, readiness of the patch and comments, at least it > won't able to make this release, I will update the patchset status as 'Deferred' > > Should we discuss this again in techboard? We should surely weigh the pros and cons. Especially the additional backport troubles it can bring. Are many people bothered by the current conflict with the libc headers? Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2018-12-27 9:35 ` Olivier Matz @ 2019-02-13 11:48 ` Yigit, Ferruh 2019-02-18 12:37 ` Ferruh Yigit 0 siblings, 1 reply; 107+ messages in thread From: Yigit, Ferruh @ 2019-02-13 11:48 UTC (permalink / raw) To: Olivier Matz, Ferruh Yigit Cc: Wiles, Keith, Stephen Hemminger, dpdk-dev, Richardson, Bruce On 12/27/2018 9:35 AM, Olivier Matz wrote: > Hi, > > On Fri, Dec 21, 2018 at 03:14:29PM +0000, Ferruh Yigit wrote: >> On 12/21/2018 2:38 PM, Wiles, Keith wrote: >>> >>> >>>> On Dec 20, 2018, at 5:48 PM, Stephen Hemminger <stephen@networkplumber.org> wrote: >>>> >>>> On Thu, 20 Dec 2018 21:59:37 +0000 >>>> Ferruh Yigit <ferruh.yigit@intel.com> wrote: >>>> >>>>> On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: >>>>>> This RFC targets 19.02. >>>>>> >>>>>> The rte_net headers conflict with the libc headers, because >>>>>> some definitions are duplicated, sometimes with few differences. >>>>>> This was discussed in [1], and more recently at the techboard. >>>>>> >>>>>> Before sending the deprecation notice (target for this is 18.11), >>>>>> here is a draft that can be discussed. >>>>>> >>>>>> This RFC adds the rte_ (or RTE_) prefix to all structures, functions >>>>>> and defines in rte_net library. This is a big changeset, that will >>>>>> break the API of many functions, but not the ABI. >>>>>> >>>>>> One question I'm asking is how can we manage the transition. >>>>>> Initially, I hoped it was possible to have a compat layer during >>>>>> one release (supporting both prefixed and unprefixed names), but >>>>>> now that the patch is done, it seems the impact is too big, and >>>>>> impacts too many libraries. >>>>>> >>>>>> Few examples: >>>>>> - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) >>>>>> - many rte_flow structures use the rte_ prefixed net structures >>>>>> - the mac field of virtio_net structure is rte_ether_addr >>>>>> - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) >>>>>> ... >>>>>> >>>>>> Therefore, it is clear that doing this would break the compilation >>>>>> of many external applications. >>>>>> >>>>>> Another drawback we need to take in account: it will make the >>>>>> backport of patches more difficult, although this is something >>>>>> that could be tempered by a script. >>>>>> >>>>>> While it is obviously better to have a good namespace convention, >>>>>> we need to identify the issues we have today before deciding it's >>>>>> worth doing the change. >>>>>> >>>>>> Comments? >>>>> >>>>> Is there an consensus about the patchset? There was a decision on techboard to >>>>> go with this change (adding rte_ prefix) [1]. >>>>> >>>>> >>>>> This is something that will affect DPDK consumers. Since many APIs are changing >>>>> most probably will break API compatibility for many libraries. >>>>> >>>>> Meanwhile the conflict with the libc headers mentioned a few times in the past, >>>>> this is something we need to fix. >>>>> >>>>> There are a few comments reluctant to this big modification, but what I >>>>> understand from Olivier's response both using BSD defines or having >>>>> compatibility headers in DPDK won't solve the problem completely. >>>>> >>>>> And assuming we will continue with this solution, another question is do we >>>>> still want to push in 19.02 scope? (And from process point of view I think a >>>>> deprecation notice is not merged for this change in 18.11 scope.) >>>>> >>>>> With the prediction of 19.05 will be big and already break API/ABI for some >>>>> libraries, can we push this into 19.05 as an early merge into repo? >>>>> >>>>> And I think this patch will affect LTS releases and will break auto backporting >>>>> for many fixes because it touches many places, so pushing this change even to >>>>> next LTS (19.11) can be an option. >>>>> >>>>> >>>>> Olivier, Thomas, >>>>> >>>>> What do you think about postponing this to 19.05 or even 19.11 ? >>>>> >>>>> >>>>> >>>>> [1] >>>>> https://mails.dpdk.org/archives/dev/2018-October/116695.html >>>>> >>>>>> >>>>>> >>>>>> Things that are missing in RFC: >>>>>> - test with FreeBSD >>>>>> - manually fix some indentation issues >>>>>> >>>>>> >>>>>> Olivier Matz (14): >>>>>> net: add rte prefix to arp structures >>>>>> net: add rte prefix to arp defines >>>>>> net: add rte prefix to ether structures >>>>>> net: add rte prefix to ether functions >>>>>> net: add rte prefix to ether defines >>>>>> net: add rte prefix to esp structure >>>>>> net: add rte prefix to gre structure >>>>>> net: add rte prefix to icmp structure >>>>>> net: add rte prefix to icmp defines >>>>>> net: add rte prefix to ip structure >>>>>> net: add rte prefix to ip defines >>>>>> net: add rte prefix to sctp structure >>>>>> net: add rte prefix to tcp structure >>>>>> net: add rte prefix to udp structure >>>>> >>>>> >>>> >>>> Sigh. Another case where DPDK has to reinvent something because >>>> we can't figure out how to do dependent libraries correctly. >>>> I would have rather just using the existing Linux, BSD definitions >>>> and fixing the DPDK code. > > > It is not that simple. As I said in [1], there are still some > differences between gnu libc and freebsd libc. Unfortunatly, the struct > ether_addr is one of the most important in dpdk, because it is widely > used in APIs (drivers). > > We can find others differences, for instance in constant definitions in > if_arp.h. I also see that some structures are packed in freebsd but not > in glibc (ex: icmp6), this could have performance impact. > > Many protocols that are currently defined in dpdk are missing in glibc: > esp, sctp, gre, mpls, ... so we will at least need rte_ structures for > these protocols. > > Supporting other OSes or libc in the future could also increase the gaps. > > For these reasons think it is reasonable to have a consistent set of > network structures in dpdk. > > > [1] https://mails.dpdk.org/archives/dev/2018-October/117258.html > > >>>> It is probably the only viable compromise, but it adds to long >>>> term maintenance, and breaks DPDK applications. Neither of which >>>> is a good thing. >>>> >>>> Should this be done by marking the old structure deprecated >>>> first? Ideally, spread over three releases: first, tell the users >>>> in the documentation it is coming; second, mark the old structures >>>> as deprecated causing compiler warnings; third, remove the old >>>> definitions. Doing at once is introducing user pain for no gain. >>> >>> +1 > > Annoucing the change before doing it is obvious. Marking the old > structures as deprecated before removing them is maybe doable (to be > checked that it does not cause conflicts with new structures), but it > means the conflict with libc headers that we are trying to solve will > remain for one more version, for a limited gain. > >> With the current timeline, readiness of the patch and comments, at least it >> won't able to make this release, I will update the patchset status as 'Deferred' >> >> Should we discuss this again in techboard? > > We should surely weigh the pros and cons. Especially the additional > backport troubles it can bring. > > Are many people bothered by the current conflict with the libc headers? This is still open. If we will get these patchset, I suggest it getting early in the 19.05, patch is mechanical but it is huge and will affect almost all other patches under development. So I am not really for pushing this close to RC. Is there any way to decide on this week, at worst next week? Thanks, ferruh ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2019-02-13 11:48 ` Yigit, Ferruh @ 2019-02-18 12:37 ` Ferruh Yigit 2019-02-18 16:58 ` Olivier Matz 0 siblings, 1 reply; 107+ messages in thread From: Ferruh Yigit @ 2019-02-18 12:37 UTC (permalink / raw) To: Yigit, Ferruh, Olivier Matz Cc: Wiles, Keith, Stephen Hemminger, dpdk-dev, Richardson, Bruce On 2/13/2019 11:48 AM, Yigit, Ferruh wrote: > On 12/27/2018 9:35 AM, Olivier Matz wrote: >> Hi, >> >> On Fri, Dec 21, 2018 at 03:14:29PM +0000, Ferruh Yigit wrote: >>> On 12/21/2018 2:38 PM, Wiles, Keith wrote: >>>> >>>> >>>>> On Dec 20, 2018, at 5:48 PM, Stephen Hemminger <stephen@networkplumber.org> wrote: >>>>> >>>>> On Thu, 20 Dec 2018 21:59:37 +0000 >>>>> Ferruh Yigit <ferruh.yigit@intel.com> wrote: >>>>> >>>>>> On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: >>>>>>> This RFC targets 19.02. >>>>>>> >>>>>>> The rte_net headers conflict with the libc headers, because >>>>>>> some definitions are duplicated, sometimes with few differences. >>>>>>> This was discussed in [1], and more recently at the techboard. >>>>>>> >>>>>>> Before sending the deprecation notice (target for this is 18.11), >>>>>>> here is a draft that can be discussed. >>>>>>> >>>>>>> This RFC adds the rte_ (or RTE_) prefix to all structures, functions >>>>>>> and defines in rte_net library. This is a big changeset, that will >>>>>>> break the API of many functions, but not the ABI. >>>>>>> >>>>>>> One question I'm asking is how can we manage the transition. >>>>>>> Initially, I hoped it was possible to have a compat layer during >>>>>>> one release (supporting both prefixed and unprefixed names), but >>>>>>> now that the patch is done, it seems the impact is too big, and >>>>>>> impacts too many libraries. >>>>>>> >>>>>>> Few examples: >>>>>>> - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) >>>>>>> - many rte_flow structures use the rte_ prefixed net structures >>>>>>> - the mac field of virtio_net structure is rte_ether_addr >>>>>>> - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) >>>>>>> ... >>>>>>> >>>>>>> Therefore, it is clear that doing this would break the compilation >>>>>>> of many external applications. >>>>>>> >>>>>>> Another drawback we need to take in account: it will make the >>>>>>> backport of patches more difficult, although this is something >>>>>>> that could be tempered by a script. >>>>>>> >>>>>>> While it is obviously better to have a good namespace convention, >>>>>>> we need to identify the issues we have today before deciding it's >>>>>>> worth doing the change. >>>>>>> >>>>>>> Comments? >>>>>> >>>>>> Is there an consensus about the patchset? There was a decision on techboard to >>>>>> go with this change (adding rte_ prefix) [1]. >>>>>> >>>>>> >>>>>> This is something that will affect DPDK consumers. Since many APIs are changing >>>>>> most probably will break API compatibility for many libraries. >>>>>> >>>>>> Meanwhile the conflict with the libc headers mentioned a few times in the past, >>>>>> this is something we need to fix. >>>>>> >>>>>> There are a few comments reluctant to this big modification, but what I >>>>>> understand from Olivier's response both using BSD defines or having >>>>>> compatibility headers in DPDK won't solve the problem completely. >>>>>> >>>>>> And assuming we will continue with this solution, another question is do we >>>>>> still want to push in 19.02 scope? (And from process point of view I think a >>>>>> deprecation notice is not merged for this change in 18.11 scope.) >>>>>> >>>>>> With the prediction of 19.05 will be big and already break API/ABI for some >>>>>> libraries, can we push this into 19.05 as an early merge into repo? >>>>>> >>>>>> And I think this patch will affect LTS releases and will break auto backporting >>>>>> for many fixes because it touches many places, so pushing this change even to >>>>>> next LTS (19.11) can be an option. >>>>>> >>>>>> >>>>>> Olivier, Thomas, >>>>>> >>>>>> What do you think about postponing this to 19.05 or even 19.11 ? >>>>>> >>>>>> >>>>>> >>>>>> [1] >>>>>> https://mails.dpdk.org/archives/dev/2018-October/116695.html >>>>>> >>>>>>> >>>>>>> >>>>>>> Things that are missing in RFC: >>>>>>> - test with FreeBSD >>>>>>> - manually fix some indentation issues >>>>>>> >>>>>>> >>>>>>> Olivier Matz (14): >>>>>>> net: add rte prefix to arp structures >>>>>>> net: add rte prefix to arp defines >>>>>>> net: add rte prefix to ether structures >>>>>>> net: add rte prefix to ether functions >>>>>>> net: add rte prefix to ether defines >>>>>>> net: add rte prefix to esp structure >>>>>>> net: add rte prefix to gre structure >>>>>>> net: add rte prefix to icmp structure >>>>>>> net: add rte prefix to icmp defines >>>>>>> net: add rte prefix to ip structure >>>>>>> net: add rte prefix to ip defines >>>>>>> net: add rte prefix to sctp structure >>>>>>> net: add rte prefix to tcp structure >>>>>>> net: add rte prefix to udp structure >>>>>> >>>>>> >>>>> >>>>> Sigh. Another case where DPDK has to reinvent something because >>>>> we can't figure out how to do dependent libraries correctly. >>>>> I would have rather just using the existing Linux, BSD definitions >>>>> and fixing the DPDK code. >> >> >> It is not that simple. As I said in [1], there are still some >> differences between gnu libc and freebsd libc. Unfortunatly, the struct >> ether_addr is one of the most important in dpdk, because it is widely >> used in APIs (drivers). >> >> We can find others differences, for instance in constant definitions in >> if_arp.h. I also see that some structures are packed in freebsd but not >> in glibc (ex: icmp6), this could have performance impact. >> >> Many protocols that are currently defined in dpdk are missing in glibc: >> esp, sctp, gre, mpls, ... so we will at least need rte_ structures for >> these protocols. >> >> Supporting other OSes or libc in the future could also increase the gaps. >> >> For these reasons think it is reasonable to have a consistent set of >> network structures in dpdk. >> >> >> [1] https://mails.dpdk.org/archives/dev/2018-October/117258.html >> >> >>>>> It is probably the only viable compromise, but it adds to long >>>>> term maintenance, and breaks DPDK applications. Neither of which >>>>> is a good thing. >>>>> >>>>> Should this be done by marking the old structure deprecated >>>>> first? Ideally, spread over three releases: first, tell the users >>>>> in the documentation it is coming; second, mark the old structures >>>>> as deprecated causing compiler warnings; third, remove the old >>>>> definitions. Doing at once is introducing user pain for no gain. >>>> >>>> +1 >> >> Annoucing the change before doing it is obvious. Marking the old >> structures as deprecated before removing them is maybe doable (to be >> checked that it does not cause conflicts with new structures), but it >> means the conflict with libc headers that we are trying to solve will >> remain for one more version, for a limited gain. >> >>> With the current timeline, readiness of the patch and comments, at least it >>> won't able to make this release, I will update the patchset status as 'Deferred' >>> >>> Should we discuss this again in techboard? >> >> We should surely weigh the pros and cons. Especially the additional >> backport troubles it can bring. >> >> Are many people bothered by the current conflict with the libc headers? > > This is still open. > > If we will get these patchset, I suggest it getting early in the 19.05, patch is > mechanical but it is huge and will affect almost all other patches under > development. So I am not really for pushing this close to RC. > > Is there any way to decide on this week, at worst next week? This has been discussed in techboard meeting and decided to go with this patch. But we are missing the deprecation notice for this. Olivier, Can you send a deprecation notice for this in the scope of the 19.05? And can we target the actual patch for very early days of the 19.08? Thanks, ferruh ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC 00/14] prefix network structures 2019-02-18 12:37 ` Ferruh Yigit @ 2019-02-18 16:58 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-02-18 16:58 UTC (permalink / raw) To: Ferruh Yigit Cc: Yigit, Ferruh, Wiles, Keith, Stephen Hemminger, dpdk-dev, Richardson, Bruce On Mon, Feb 18, 2019 at 12:37:41PM +0000, Ferruh Yigit wrote: > On 2/13/2019 11:48 AM, Yigit, Ferruh wrote: > > On 12/27/2018 9:35 AM, Olivier Matz wrote: > >> Hi, > >> > >> On Fri, Dec 21, 2018 at 03:14:29PM +0000, Ferruh Yigit wrote: > >>> On 12/21/2018 2:38 PM, Wiles, Keith wrote: > >>>> > >>>> > >>>>> On Dec 20, 2018, at 5:48 PM, Stephen Hemminger <stephen@networkplumber.org> wrote: > >>>>> > >>>>> On Thu, 20 Dec 2018 21:59:37 +0000 > >>>>> Ferruh Yigit <ferruh.yigit@intel.com> wrote: > >>>>> > >>>>>> On 10/24/2018 9:18 AM, olivier.matz at 6wind.com (Olivier Matz) wrote: > >>>>>>> This RFC targets 19.02. > >>>>>>> > >>>>>>> The rte_net headers conflict with the libc headers, because > >>>>>>> some definitions are duplicated, sometimes with few differences. > >>>>>>> This was discussed in [1], and more recently at the techboard. > >>>>>>> > >>>>>>> Before sending the deprecation notice (target for this is 18.11), > >>>>>>> here is a draft that can be discussed. > >>>>>>> > >>>>>>> This RFC adds the rte_ (or RTE_) prefix to all structures, functions > >>>>>>> and defines in rte_net library. This is a big changeset, that will > >>>>>>> break the API of many functions, but not the ABI. > >>>>>>> > >>>>>>> One question I'm asking is how can we manage the transition. > >>>>>>> Initially, I hoped it was possible to have a compat layer during > >>>>>>> one release (supporting both prefixed and unprefixed names), but > >>>>>>> now that the patch is done, it seems the impact is too big, and > >>>>>>> impacts too many libraries. > >>>>>>> > >>>>>>> Few examples: > >>>>>>> - rte_eth_macaddr_get/add/remove() use a (struct rte_ether_addr *) > >>>>>>> - many rte_flow structures use the rte_ prefixed net structures > >>>>>>> - the mac field of virtio_net structure is rte_ether_addr > >>>>>>> - the first arg of rte_thash_load_v6_addrs is (struct rte_ipv6_hdr *) > >>>>>>> ... > >>>>>>> > >>>>>>> Therefore, it is clear that doing this would break the compilation > >>>>>>> of many external applications. > >>>>>>> > >>>>>>> Another drawback we need to take in account: it will make the > >>>>>>> backport of patches more difficult, although this is something > >>>>>>> that could be tempered by a script. > >>>>>>> > >>>>>>> While it is obviously better to have a good namespace convention, > >>>>>>> we need to identify the issues we have today before deciding it's > >>>>>>> worth doing the change. > >>>>>>> > >>>>>>> Comments? > >>>>>> > >>>>>> Is there an consensus about the patchset? There was a decision on techboard to > >>>>>> go with this change (adding rte_ prefix) [1]. > >>>>>> > >>>>>> > >>>>>> This is something that will affect DPDK consumers. Since many APIs are changing > >>>>>> most probably will break API compatibility for many libraries. > >>>>>> > >>>>>> Meanwhile the conflict with the libc headers mentioned a few times in the past, > >>>>>> this is something we need to fix. > >>>>>> > >>>>>> There are a few comments reluctant to this big modification, but what I > >>>>>> understand from Olivier's response both using BSD defines or having > >>>>>> compatibility headers in DPDK won't solve the problem completely. > >>>>>> > >>>>>> And assuming we will continue with this solution, another question is do we > >>>>>> still want to push in 19.02 scope? (And from process point of view I think a > >>>>>> deprecation notice is not merged for this change in 18.11 scope.) > >>>>>> > >>>>>> With the prediction of 19.05 will be big and already break API/ABI for some > >>>>>> libraries, can we push this into 19.05 as an early merge into repo? > >>>>>> > >>>>>> And I think this patch will affect LTS releases and will break auto backporting > >>>>>> for many fixes because it touches many places, so pushing this change even to > >>>>>> next LTS (19.11) can be an option. > >>>>>> > >>>>>> > >>>>>> Olivier, Thomas, > >>>>>> > >>>>>> What do you think about postponing this to 19.05 or even 19.11 ? > >>>>>> > >>>>>> > >>>>>> > >>>>>> [1] > >>>>>> https://mails.dpdk.org/archives/dev/2018-October/116695.html > >>>>>> > >>>>>>> > >>>>>>> > >>>>>>> Things that are missing in RFC: > >>>>>>> - test with FreeBSD > >>>>>>> - manually fix some indentation issues > >>>>>>> > >>>>>>> > >>>>>>> Olivier Matz (14): > >>>>>>> net: add rte prefix to arp structures > >>>>>>> net: add rte prefix to arp defines > >>>>>>> net: add rte prefix to ether structures > >>>>>>> net: add rte prefix to ether functions > >>>>>>> net: add rte prefix to ether defines > >>>>>>> net: add rte prefix to esp structure > >>>>>>> net: add rte prefix to gre structure > >>>>>>> net: add rte prefix to icmp structure > >>>>>>> net: add rte prefix to icmp defines > >>>>>>> net: add rte prefix to ip structure > >>>>>>> net: add rte prefix to ip defines > >>>>>>> net: add rte prefix to sctp structure > >>>>>>> net: add rte prefix to tcp structure > >>>>>>> net: add rte prefix to udp structure > >>>>>> > >>>>>> > >>>>> > >>>>> Sigh. Another case where DPDK has to reinvent something because > >>>>> we can't figure out how to do dependent libraries correctly. > >>>>> I would have rather just using the existing Linux, BSD definitions > >>>>> and fixing the DPDK code. > >> > >> > >> It is not that simple. As I said in [1], there are still some > >> differences between gnu libc and freebsd libc. Unfortunatly, the struct > >> ether_addr is one of the most important in dpdk, because it is widely > >> used in APIs (drivers). > >> > >> We can find others differences, for instance in constant definitions in > >> if_arp.h. I also see that some structures are packed in freebsd but not > >> in glibc (ex: icmp6), this could have performance impact. > >> > >> Many protocols that are currently defined in dpdk are missing in glibc: > >> esp, sctp, gre, mpls, ... so we will at least need rte_ structures for > >> these protocols. > >> > >> Supporting other OSes or libc in the future could also increase the gaps. > >> > >> For these reasons think it is reasonable to have a consistent set of > >> network structures in dpdk. > >> > >> > >> [1] https://mails.dpdk.org/archives/dev/2018-October/117258.html > >> > >> > >>>>> It is probably the only viable compromise, but it adds to long > >>>>> term maintenance, and breaks DPDK applications. Neither of which > >>>>> is a good thing. > >>>>> > >>>>> Should this be done by marking the old structure deprecated > >>>>> first? Ideally, spread over three releases: first, tell the users > >>>>> in the documentation it is coming; second, mark the old structures > >>>>> as deprecated causing compiler warnings; third, remove the old > >>>>> definitions. Doing at once is introducing user pain for no gain. > >>>> > >>>> +1 > >> > >> Annoucing the change before doing it is obvious. Marking the old > >> structures as deprecated before removing them is maybe doable (to be > >> checked that it does not cause conflicts with new structures), but it > >> means the conflict with libc headers that we are trying to solve will > >> remain for one more version, for a limited gain. > >> > >>> With the current timeline, readiness of the patch and comments, at least it > >>> won't able to make this release, I will update the patchset status as 'Deferred' > >>> > >>> Should we discuss this again in techboard? > >> > >> We should surely weigh the pros and cons. Especially the additional > >> backport troubles it can bring. > >> > >> Are many people bothered by the current conflict with the libc headers? > > > > This is still open. > > > > If we will get these patchset, I suggest it getting early in the 19.05, patch is > > mechanical but it is huge and will affect almost all other patches under > > development. So I am not really for pushing this close to RC. > > > > Is there any way to decide on this week, at worst next week? > > This has been discussed in techboard meeting and decided to go with this patch. > But we are missing the deprecation notice for this. > > > Olivier, > > Can you send a deprecation notice for this in the scope of the 19.05? > And can we target the actual patch for very early days of the 19.08? > Hi Ferruh, OK, will do. Thank you. Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 00/14] prefix network structures 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz ` (19 preceding siblings ...) 2018-12-20 21:59 ` Ferruh Yigit @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz ` (16 more replies) 20 siblings, 17 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit This RFC targets 19.08. The rte_net headers conflict with the libc headers, because some definitions are duplicated, sometimes with few differences. This RFC adds the rte_ (or RTE_) prefix to all structures, functions and defines in rte_net library. This is a big changeset, that will break the API of many functions, but not the ABI. This was discussed in [1], and recently requested by the techboard [2]. v2: * rebase on top of v19.05-rc1 [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html Olivier Matz (14): net: add rte prefix to arp structures net: add rte prefix to arp defines net: add rte prefix to ether structures net: add rte prefix to ether functions net: add rte prefix to ether defines net: add rte prefix to esp structure net: add rte prefix to gre structure net: add rte prefix to icmp structure net: add rte prefix to icmp defines net: add rte prefix to ip structure net: add rte prefix to ip defines net: add rte prefix to sctp structure net: add rte prefix to tcp structure net: add rte prefix to udp structure app/pdump/main.c | 2 +- app/test-acl/main.c | 2 +- app/test-eventdev/test_perf_common.c | 2 +- app/test-eventdev/test_pipeline_common.c | 2 +- app/test-pipeline/pipeline_acl.c | 16 +- app/test-pipeline/pipeline_hash.c | 12 +- app/test-pmd/cmdline.c | 90 +++--- app/test-pmd/cmdline_flow.c | 86 +++--- app/test-pmd/config.c | 34 +-- app/test-pmd/csumonly.c | 160 +++++----- app/test-pmd/flowgen.c | 30 +- app/test-pmd/icmpecho.c | 120 ++++---- app/test-pmd/ieee1588fwd.c | 18 +- app/test-pmd/macfwd.c | 12 +- app/test-pmd/macswap.h | 12 +- app/test-pmd/macswap_common.h | 4 +- app/test-pmd/macswap_neon.h | 12 +- app/test-pmd/macswap_sse.h | 12 +- app/test-pmd/parameters.c | 6 +- app/test-pmd/testpmd.c | 22 +- app/test-pmd/testpmd.h | 30 +- app/test-pmd/txonly.c | 44 +-- app/test-pmd/util.c | 34 +-- app/test/packet_burst_generator.c | 126 ++++---- app/test/packet_burst_generator.h | 26 +- app/test/test_acl.c | 8 +- app/test/test_acl.h | 122 ++++---- app/test/test_cmdline_etheraddr.c | 16 +- app/test/test_efd.c | 20 +- app/test/test_event_eth_rx_adapter.c | 2 +- app/test/test_event_eth_tx_adapter.c | 2 +- app/test/test_flow_classify.c | 68 ++--- app/test/test_hash.c | 20 +- app/test/test_ipsec.c | 12 +- app/test/test_link_bonding.c | 284 +++++++++--------- app/test/test_link_bonding_mode4.c | 116 ++++---- app/test/test_link_bonding_rssconf.c | 6 +- app/test/test_lpm.c | 76 ++--- app/test/test_lpm_perf.c | 10 +- app/test/test_member.c | 20 +- app/test/test_pmd_perf.c | 20 +- app/test/test_sched.c | 20 +- app/test/test_table_acl.c | 8 +- app/test/test_thash.c | 12 +- app/test/virtual_pmd.c | 6 +- app/test/virtual_pmd.h | 2 +- doc/guides/nics/kni.rst | 2 +- doc/guides/prog_guide/bbdev.rst | 6 +- .../prog_guide/packet_classif_access_ctrl.rst | 18 +- doc/guides/prog_guide/rte_flow.rst | 4 +- doc/guides/sample_app_ug/flow_classify.rst | 28 +- doc/guides/sample_app_ug/flow_filtering.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- doc/guides/sample_app_ug/l3_forward.rst | 12 +- doc/guides/sample_app_ug/link_status_intr.rst | 6 +- doc/guides/sample_app_ug/ptpclient.rst | 6 +- doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- doc/guides/sample_app_ug/server_node_efd.rst | 12 +- doc/guides/sample_app_ug/skeleton.rst | 4 +- doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/base/fman/fman_hw.c | 2 +- drivers/bus/dpaa/include/fman.h | 2 +- drivers/bus/dpaa/include/netcfg.h | 4 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 6 +- drivers/net/ark/ark_ethdev.c | 16 +- drivers/net/ark/ark_ext.h | 4 +- drivers/net/ark/ark_global.h | 4 +- drivers/net/atlantic/atl_ethdev.c | 20 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- drivers/net/avp/avp_ethdev.c | 20 +- drivers/net/avp/rte_avp_common.h | 2 +- drivers/net/axgbe/axgbe_dev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 10 +- drivers/net/axgbe/axgbe_ethdev.h | 4 +- drivers/net/axgbe/axgbe_rxtx.c | 2 +- drivers/net/bnx2x/bnx2x.c | 16 +- drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- drivers/net/bnx2x/ecore_sp.h | 2 +- drivers/net/bnxt/bnxt.h | 4 +- drivers/net/bnxt/bnxt_ethdev.c | 70 ++--- drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 +- drivers/net/bnxt/bnxt_flow.c | 26 +- drivers/net/bnxt/bnxt_hwrm.c | 40 +-- drivers/net/bnxt/bnxt_hwrm.h | 2 +- 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 | 14 +- drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- drivers/net/bonding/rte_eth_bond.h | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 28 +- drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- drivers/net/bonding/rte_eth_bond_8023ad_private.h | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 78 ++--- drivers/net/bonding/rte_eth_bond_alb.h | 10 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_args.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 194 ++++++------- drivers/net/bonding/rte_eth_bond_private.h | 6 +- drivers/net/cxgbe/base/adapter.h | 6 +- drivers/net/cxgbe/base/t4_hw.c | 8 +- drivers/net/cxgbe/cxgbe.h | 4 +- drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 10 +- drivers/net/cxgbe/cxgbe_main.c | 4 +- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- 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 | 20 +- drivers/net/dpaa/dpaa_rxtx.c | 22 +- drivers/net/dpaa2/dpaa2_ethdev.c | 36 +-- drivers/net/dpaa2/dpaa2_flow.c | 18 +- drivers/net/e1000/e1000_ethdev.h | 4 +- drivers/net/e1000/em_ethdev.c | 34 +-- drivers/net/e1000/em_rxtx.c | 22 +- drivers/net/e1000/igb_ethdev.c | 70 ++--- drivers/net/e1000/igb_flow.c | 12 +- drivers/net/e1000/igb_pf.c | 16 +- drivers/net/e1000/igb_rxtx.c | 18 +- drivers/net/ena/ena_ethdev.c | 16 +- drivers/net/ena/ena_ethdev.h | 2 +- drivers/net/enetc/base/enetc_hw.h | 4 +- drivers/net/enetc/enetc_ethdev.c | 6 +- drivers/net/enic/enic.h | 4 +- drivers/net/enic/enic_clsf.c | 40 +-- drivers/net/enic/enic_ethdev.c | 28 +- drivers/net/enic/enic_flow.c | 106 +++---- drivers/net/enic/enic_main.c | 4 +- drivers/net/enic/enic_res.c | 4 +- drivers/net/failsafe/failsafe.c | 6 +- drivers/net/failsafe/failsafe_args.c | 4 +- drivers/net/failsafe/failsafe_ether.c | 6 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/failsafe/failsafe_private.h | 4 +- drivers/net/fm10k/fm10k.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 18 +- drivers/net/i40e/base/i40e_adminq_cmd.h | 4 +- drivers/net/i40e/base/i40e_common.c | 12 +- drivers/net/i40e/base/i40e_prototype.h | 4 +- drivers/net/i40e/i40e_ethdev.c | 136 ++++----- drivers/net/i40e/i40e_ethdev.h | 22 +- drivers/net/i40e/i40e_ethdev_vf.c | 62 ++-- drivers/net/i40e/i40e_fdir.c | 126 ++++---- drivers/net/i40e/i40e_flow.c | 58 ++-- drivers/net/i40e/i40e_pf.c | 18 +- drivers/net/i40e/i40e_rxtx.c | 28 +- drivers/net/i40e/i40e_vf_representor.c | 2 +- drivers/net/i40e/rte_pmd_i40e.c | 30 +- drivers/net/i40e/rte_pmd_i40e.h | 8 +- drivers/net/iavf/base/iavf_adminq_cmd.h | 4 +- drivers/net/iavf/base/iavf_common.c | 12 +- drivers/net/iavf/base/iavf_prototype.h | 4 +- drivers/net/iavf/iavf.h | 4 +- drivers/net/iavf/iavf_ethdev.c | 50 ++-- drivers/net/iavf/iavf_rxtx.c | 14 +- drivers/net/iavf/iavf_vchnl.c | 8 +- drivers/net/ice/ice_ethdev.c | 62 ++-- drivers/net/ice/ice_ethdev.h | 4 +- drivers/net/ice/ice_rxtx.c | 28 +- drivers/net/ixgbe/ixgbe_ethdev.c | 92 +++--- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_flow.c | 22 +- drivers/net/ixgbe/ixgbe_pf.c | 14 +- drivers/net/ixgbe/ixgbe_rxtx.c | 14 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 10 +- drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- drivers/net/kni/rte_eth_kni.c | 6 +- drivers/net/liquidio/lio_ethdev.c | 22 +- drivers/net/mlx4/mlx4.c | 4 +- drivers/net/mlx4/mlx4.h | 8 +- drivers/net/mlx4/mlx4_ethdev.c | 8 +- drivers/net/mlx4/mlx4_flow.c | 14 +- drivers/net/mlx4/mlx4_rxtx.c | 2 +- drivers/net/mlx5/mlx5.c | 4 +- drivers/net/mlx5/mlx5.h | 14 +- drivers/net/mlx5/mlx5_flow.c | 22 +- drivers/net/mlx5/mlx5_flow_dv.c | 44 +-- drivers/net/mlx5/mlx5_flow_tcf.c | 66 ++--- drivers/net/mlx5/mlx5_flow_verbs.c | 26 +- drivers/net/mlx5/mlx5_mac.c | 18 +- drivers/net/mlx5/mlx5_nl.c | 28 +- drivers/net/mlx5/mlx5_rxtx.c | 6 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- drivers/net/mlx5/mlx5_trigger.c | 6 +- drivers/net/mvneta/mvneta_ethdev.c | 22 +- drivers/net/mvneta/mvneta_ethdev.h | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 22 +- drivers/net/mvpp2/mrvl_ethdev.h | 2 +- drivers/net/mvpp2/mrvl_flow.c | 4 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/netvsc/hn_nvs.c | 2 +- drivers/net/netvsc/hn_rndis.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 12 +- drivers/net/netvsc/hn_var.h | 4 +- drivers/net/netvsc/hn_vf.c | 8 +- drivers/net/nfp/nfp_net.c | 20 +- drivers/net/nfp/nfp_net_pmd.h | 2 +- drivers/net/null/rte_eth_null.c | 6 +- drivers/net/octeontx/octeontx_ethdev.c | 8 +- drivers/net/octeontx/octeontx_ethdev.h | 2 +- drivers/net/pcap/rte_eth_pcap.c | 22 +- drivers/net/qede/base/bcm_osal.h | 2 +- drivers/net/qede/base/ecore_dev.c | 4 +- drivers/net/qede/qede_ethdev.c | 58 ++-- drivers/net/qede/qede_ethdev.h | 6 +- drivers/net/qede/qede_filter.c | 66 ++--- drivers/net/qede/qede_if.h | 4 +- drivers/net/qede/qede_main.c | 6 +- drivers/net/qede/qede_rxtx.c | 32 +- drivers/net/qede/qede_rxtx.h | 2 +- drivers/net/ring/rte_eth_ring.c | 4 +- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ef10_tx.c | 4 +- drivers/net/sfc/sfc_ethdev.c | 20 +- drivers/net/sfc/sfc_flow.c | 12 +- drivers/net/sfc/sfc_port.c | 8 +- drivers/net/sfc/sfc_tso.c | 4 +- drivers/net/sfc/sfc_tso.h | 4 +- drivers/net/softnic/parser.c | 18 +- drivers/net/softnic/parser.h | 2 +- drivers/net/softnic/rte_eth_softnic.c | 2 +- drivers/net/softnic/rte_eth_softnic_flow.c | 4 +- drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- drivers/net/szedata2/rte_eth_szedata2.c | 8 +- drivers/net/tap/rte_eth_tap.c | 60 ++-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_bpf_program.c | 14 +- drivers/net/tap/tap_flow.c | 12 +- drivers/net/thunderx/base/nicvf_mbox.c | 4 +- drivers/net/thunderx/base/nicvf_plat.h | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 18 +- drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- drivers/net/vhost/rte_eth_vhost.c | 12 +- drivers/net/virtio/virtio_ethdev.c | 72 ++--- drivers/net/virtio/virtio_pci.h | 4 +- drivers/net/virtio/virtio_rxtx.c | 32 +- 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 | 12 +- drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 44 +-- examples/bbdev_app/main.c | 40 +-- examples/bond/main.c | 78 ++--- examples/distributor/main.c | 4 +- examples/ethtool/ethtool-app/ethapp.c | 8 +- examples/ethtool/ethtool-app/main.c | 10 +- examples/ethtool/lib/rte_ethtool.c | 8 +- examples/ethtool/lib/rte_ethtool.h | 6 +- examples/eventdev_pipeline/main.c | 4 +- examples/eventdev_pipeline/pipeline_common.h | 10 +- examples/flow_classify/flow_classify.c | 30 +- examples/flow_filtering/main.c | 10 +- examples/ip_fragmentation/main.c | 64 ++-- examples/ip_pipeline/cli.c | 4 +- examples/ip_pipeline/kni.c | 2 +- examples/ip_pipeline/parser.c | 18 +- examples/ip_pipeline/parser.h | 2 +- examples/ip_pipeline/pipeline.c | 40 +-- examples/ip_reassembly/main.c | 50 ++-- examples/ipsec-secgw/esp.c | 42 +-- examples/ipsec-secgw/ipsec-secgw.c | 42 +-- examples/ipsec-secgw/ipsec.h | 2 +- examples/ipsec-secgw/parser.c | 4 +- examples/ipsec-secgw/sa.c | 16 +- examples/ipv4_multicast/main.c | 58 ++-- examples/kni/main.c | 14 +- examples/l2fwd-cat/l2fwd-cat.c | 4 +- examples/l2fwd-crypto/main.c | 26 +- examples/l2fwd-jobstats/main.c | 8 +- examples/l2fwd-keepalive/main.c | 8 +- examples/l2fwd/main.c | 8 +- examples/l3fwd-acl/main.c | 102 +++---- examples/l3fwd-power/main.c | 100 +++---- examples/l3fwd-vf/main.c | 68 ++--- examples/l3fwd/l3fwd.h | 8 +- examples/l3fwd/l3fwd_altivec.h | 14 +- examples/l3fwd/l3fwd_common.h | 4 +- examples/l3fwd/l3fwd_em.c | 44 +-- examples/l3fwd/l3fwd_em.h | 20 +- examples/l3fwd/l3fwd_em_hlm.h | 16 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 16 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- examples/l3fwd/l3fwd_em_sequential.h | 16 +- examples/l3fwd/l3fwd_lpm.c | 50 ++-- examples/l3fwd/l3fwd_lpm.h | 20 +- examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- examples/l3fwd/l3fwd_lpm_neon.h | 30 +- examples/l3fwd/l3fwd_lpm_sse.h | 20 +- examples/l3fwd/l3fwd_neon.h | 14 +- examples/l3fwd/l3fwd_sse.h | 14 +- examples/l3fwd/main.c | 20 +- examples/link_status_interrupt/main.c | 8 +- examples/load_balancer/runtime.c | 6 +- .../client_server_mp/mp_server/main.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 322 ++++++++++----------- examples/ptpclient/ptpclient.c | 32 +- examples/qos_meter/main.c | 4 +- examples/qos_sched/init.c | 2 +- examples/quota_watermark/qw/main.c | 8 +- examples/rxtx_callbacks/main.c | 4 +- examples/server_node_efd/node/node.c | 6 +- examples/server_node_efd/server/main.c | 8 +- examples/skeleton/basicfwd.c | 4 +- examples/tep_termination/main.c | 2 +- examples/tep_termination/main.h | 2 +- examples/tep_termination/vxlan.c | 108 +++---- examples/tep_termination/vxlan.h | 8 +- examples/tep_termination/vxlan_setup.c | 30 +- examples/tep_termination/vxlan_setup.h | 2 +- examples/vhost/main.c | 40 +-- examples/vhost/main.h | 2 +- examples/vm_power_manager/channel_monitor.c | 12 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/main.c | 6 +- examples/vmdq/main.c | 12 +- examples/vmdq_dcb/main.c | 12 +- lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_eth_ctrl.h | 12 +- lib/librte_ethdev/rte_ethdev.c | 58 ++-- lib/librte_ethdev/rte_ethdev.h | 14 +- lib/librte_ethdev/rte_ethdev_core.h | 12 +- lib/librte_ethdev/rte_flow.h | 32 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 32 +- lib/librte_gro/gro_tcp4.c | 26 +- lib/librte_gro/gro_tcp4.h | 22 +- lib/librte_gro/gro_vxlan_tcp4.c | 64 ++-- lib/librte_gro/gro_vxlan_tcp4.h | 6 +- lib/librte_gso/gso_common.h | 16 +- lib/librte_gso/gso_tcp4.c | 12 +- lib/librte_gso/gso_tunnel_tcp4.c | 14 +- lib/librte_gso/gso_udp4.c | 8 +- lib/librte_gso/rte_gso.h | 8 +- lib/librte_hash/rte_thash.h | 2 +- lib/librte_ip_frag/rte_ip_frag.h | 12 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 +- lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- lib/librte_ipsec/crypto.h | 2 +- lib/librte_ipsec/esp_inb.c | 10 +- lib/librte_ipsec/esp_outb.c | 8 +- lib/librte_ipsec/iph.h | 8 +- lib/librte_ipsec/sa.c | 8 +- lib/librte_kni/rte_kni.c | 4 +- lib/librte_kni/rte_kni.h | 2 +- lib/librte_net/rte_arp.c | 32 +- lib/librte_net/rte_arp.h | 36 +-- lib/librte_net/rte_esp.h | 2 +- lib/librte_net/rte_ether.h | 182 ++++++------ lib/librte_net/rte_gre.h | 2 +- lib/librte_net/rte_icmp.h | 6 +- lib/librte_net/rte_ip.h | 72 ++--- lib/librte_net/rte_net.c | 94 +++--- lib/librte_net/rte_net.h | 22 +- lib/librte_net/rte_sctp.h | 2 +- lib/librte_net/rte_tcp.h | 2 +- lib/librte_net/rte_udp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 224 +++++++------- lib/librte_pipeline/rte_table_action.h | 4 +- lib/librte_port/rte_port_ras.c | 8 +- lib/librte_port/rte_port_source_sink.c | 6 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/virtio_net.c | 42 +-- 388 files changed, 4145 insertions(+), 4145 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 00/14] prefix network structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures Olivier Matz ` (15 subsequent siblings) 16 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit This RFC targets 19.08. The rte_net headers conflict with the libc headers, because some definitions are duplicated, sometimes with few differences. This RFC adds the rte_ (or RTE_) prefix to all structures, functions and defines in rte_net library. This is a big changeset, that will break the API of many functions, but not the ABI. This was discussed in [1], and recently requested by the techboard [2]. v2: * rebase on top of v19.05-rc1 [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html Olivier Matz (14): net: add rte prefix to arp structures net: add rte prefix to arp defines net: add rte prefix to ether structures net: add rte prefix to ether functions net: add rte prefix to ether defines net: add rte prefix to esp structure net: add rte prefix to gre structure net: add rte prefix to icmp structure net: add rte prefix to icmp defines net: add rte prefix to ip structure net: add rte prefix to ip defines net: add rte prefix to sctp structure net: add rte prefix to tcp structure net: add rte prefix to udp structure app/pdump/main.c | 2 +- app/test-acl/main.c | 2 +- app/test-eventdev/test_perf_common.c | 2 +- app/test-eventdev/test_pipeline_common.c | 2 +- app/test-pipeline/pipeline_acl.c | 16 +- app/test-pipeline/pipeline_hash.c | 12 +- app/test-pmd/cmdline.c | 90 +++--- app/test-pmd/cmdline_flow.c | 86 +++--- app/test-pmd/config.c | 34 +-- app/test-pmd/csumonly.c | 160 +++++----- app/test-pmd/flowgen.c | 30 +- app/test-pmd/icmpecho.c | 120 ++++---- app/test-pmd/ieee1588fwd.c | 18 +- app/test-pmd/macfwd.c | 12 +- app/test-pmd/macswap.h | 12 +- app/test-pmd/macswap_common.h | 4 +- app/test-pmd/macswap_neon.h | 12 +- app/test-pmd/macswap_sse.h | 12 +- app/test-pmd/parameters.c | 6 +- app/test-pmd/testpmd.c | 22 +- app/test-pmd/testpmd.h | 30 +- app/test-pmd/txonly.c | 44 +-- app/test-pmd/util.c | 34 +-- app/test/packet_burst_generator.c | 126 ++++---- app/test/packet_burst_generator.h | 26 +- app/test/test_acl.c | 8 +- app/test/test_acl.h | 122 ++++---- app/test/test_cmdline_etheraddr.c | 16 +- app/test/test_efd.c | 20 +- app/test/test_event_eth_rx_adapter.c | 2 +- app/test/test_event_eth_tx_adapter.c | 2 +- app/test/test_flow_classify.c | 68 ++--- app/test/test_hash.c | 20 +- app/test/test_ipsec.c | 12 +- app/test/test_link_bonding.c | 284 +++++++++--------- app/test/test_link_bonding_mode4.c | 116 ++++---- app/test/test_link_bonding_rssconf.c | 6 +- app/test/test_lpm.c | 76 ++--- app/test/test_lpm_perf.c | 10 +- app/test/test_member.c | 20 +- app/test/test_pmd_perf.c | 20 +- app/test/test_sched.c | 20 +- app/test/test_table_acl.c | 8 +- app/test/test_thash.c | 12 +- app/test/virtual_pmd.c | 6 +- app/test/virtual_pmd.h | 2 +- doc/guides/nics/kni.rst | 2 +- doc/guides/prog_guide/bbdev.rst | 6 +- .../prog_guide/packet_classif_access_ctrl.rst | 18 +- doc/guides/prog_guide/rte_flow.rst | 4 +- doc/guides/sample_app_ug/flow_classify.rst | 28 +- doc/guides/sample_app_ug/flow_filtering.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- doc/guides/sample_app_ug/l3_forward.rst | 12 +- doc/guides/sample_app_ug/link_status_intr.rst | 6 +- doc/guides/sample_app_ug/ptpclient.rst | 6 +- doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- doc/guides/sample_app_ug/server_node_efd.rst | 12 +- doc/guides/sample_app_ug/skeleton.rst | 4 +- doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- drivers/bus/dpaa/base/fman/fman.c | 2 +- drivers/bus/dpaa/base/fman/fman_hw.c | 2 +- drivers/bus/dpaa/include/fman.h | 2 +- drivers/bus/dpaa/include/netcfg.h | 4 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 6 +- drivers/net/ark/ark_ethdev.c | 16 +- drivers/net/ark/ark_ext.h | 4 +- drivers/net/ark/ark_global.h | 4 +- drivers/net/atlantic/atl_ethdev.c | 20 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- drivers/net/avp/avp_ethdev.c | 20 +- drivers/net/avp/rte_avp_common.h | 2 +- drivers/net/axgbe/axgbe_dev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 10 +- drivers/net/axgbe/axgbe_ethdev.h | 4 +- drivers/net/axgbe/axgbe_rxtx.c | 2 +- drivers/net/bnx2x/bnx2x.c | 16 +- drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- drivers/net/bnx2x/ecore_sp.h | 2 +- drivers/net/bnxt/bnxt.h | 4 +- drivers/net/bnxt/bnxt_ethdev.c | 70 ++--- drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 +- drivers/net/bnxt/bnxt_flow.c | 26 +- drivers/net/bnxt/bnxt_hwrm.c | 40 +-- drivers/net/bnxt/bnxt_hwrm.h | 2 +- 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 | 14 +- drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- drivers/net/bonding/rte_eth_bond.h | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 28 +- drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- drivers/net/bonding/rte_eth_bond_8023ad_private.h | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 78 ++--- drivers/net/bonding/rte_eth_bond_alb.h | 10 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_args.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 194 ++++++------- drivers/net/bonding/rte_eth_bond_private.h | 6 +- drivers/net/cxgbe/base/adapter.h | 6 +- drivers/net/cxgbe/base/t4_hw.c | 8 +- drivers/net/cxgbe/cxgbe.h | 4 +- drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 10 +- drivers/net/cxgbe/cxgbe_main.c | 4 +- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- 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 | 20 +- drivers/net/dpaa/dpaa_rxtx.c | 22 +- drivers/net/dpaa2/dpaa2_ethdev.c | 36 +-- drivers/net/dpaa2/dpaa2_flow.c | 18 +- drivers/net/e1000/e1000_ethdev.h | 4 +- drivers/net/e1000/em_ethdev.c | 34 +-- drivers/net/e1000/em_rxtx.c | 22 +- drivers/net/e1000/igb_ethdev.c | 70 ++--- drivers/net/e1000/igb_flow.c | 12 +- drivers/net/e1000/igb_pf.c | 16 +- drivers/net/e1000/igb_rxtx.c | 18 +- drivers/net/ena/ena_ethdev.c | 16 +- drivers/net/ena/ena_ethdev.h | 2 +- drivers/net/enetc/base/enetc_hw.h | 4 +- drivers/net/enetc/enetc_ethdev.c | 6 +- drivers/net/enic/enic.h | 4 +- drivers/net/enic/enic_clsf.c | 40 +-- drivers/net/enic/enic_ethdev.c | 28 +- drivers/net/enic/enic_flow.c | 106 +++---- drivers/net/enic/enic_main.c | 4 +- drivers/net/enic/enic_res.c | 4 +- drivers/net/failsafe/failsafe.c | 6 +- drivers/net/failsafe/failsafe_args.c | 4 +- drivers/net/failsafe/failsafe_ether.c | 6 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/failsafe/failsafe_private.h | 4 +- drivers/net/fm10k/fm10k.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 18 +- drivers/net/i40e/base/i40e_adminq_cmd.h | 4 +- drivers/net/i40e/base/i40e_common.c | 12 +- drivers/net/i40e/base/i40e_prototype.h | 4 +- drivers/net/i40e/i40e_ethdev.c | 136 ++++----- drivers/net/i40e/i40e_ethdev.h | 22 +- drivers/net/i40e/i40e_ethdev_vf.c | 62 ++-- drivers/net/i40e/i40e_fdir.c | 126 ++++---- drivers/net/i40e/i40e_flow.c | 58 ++-- drivers/net/i40e/i40e_pf.c | 18 +- drivers/net/i40e/i40e_rxtx.c | 28 +- drivers/net/i40e/i40e_vf_representor.c | 2 +- drivers/net/i40e/rte_pmd_i40e.c | 30 +- drivers/net/i40e/rte_pmd_i40e.h | 8 +- drivers/net/iavf/base/iavf_adminq_cmd.h | 4 +- drivers/net/iavf/base/iavf_common.c | 12 +- drivers/net/iavf/base/iavf_prototype.h | 4 +- drivers/net/iavf/iavf.h | 4 +- drivers/net/iavf/iavf_ethdev.c | 50 ++-- drivers/net/iavf/iavf_rxtx.c | 14 +- drivers/net/iavf/iavf_vchnl.c | 8 +- drivers/net/ice/ice_ethdev.c | 62 ++-- drivers/net/ice/ice_ethdev.h | 4 +- drivers/net/ice/ice_rxtx.c | 28 +- drivers/net/ixgbe/ixgbe_ethdev.c | 92 +++--- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_flow.c | 22 +- drivers/net/ixgbe/ixgbe_pf.c | 14 +- drivers/net/ixgbe/ixgbe_rxtx.c | 14 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 10 +- drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- drivers/net/kni/rte_eth_kni.c | 6 +- drivers/net/liquidio/lio_ethdev.c | 22 +- drivers/net/mlx4/mlx4.c | 4 +- drivers/net/mlx4/mlx4.h | 8 +- drivers/net/mlx4/mlx4_ethdev.c | 8 +- drivers/net/mlx4/mlx4_flow.c | 14 +- drivers/net/mlx4/mlx4_rxtx.c | 2 +- drivers/net/mlx5/mlx5.c | 4 +- drivers/net/mlx5/mlx5.h | 14 +- drivers/net/mlx5/mlx5_flow.c | 22 +- drivers/net/mlx5/mlx5_flow_dv.c | 44 +-- drivers/net/mlx5/mlx5_flow_tcf.c | 66 ++--- drivers/net/mlx5/mlx5_flow_verbs.c | 26 +- drivers/net/mlx5/mlx5_mac.c | 18 +- drivers/net/mlx5/mlx5_nl.c | 28 +- drivers/net/mlx5/mlx5_rxtx.c | 6 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- drivers/net/mlx5/mlx5_trigger.c | 6 +- drivers/net/mvneta/mvneta_ethdev.c | 22 +- drivers/net/mvneta/mvneta_ethdev.h | 2 +- drivers/net/mvpp2/mrvl_ethdev.c | 22 +- drivers/net/mvpp2/mrvl_ethdev.h | 2 +- drivers/net/mvpp2/mrvl_flow.c | 4 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/netvsc/hn_nvs.c | 2 +- drivers/net/netvsc/hn_rndis.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 12 +- drivers/net/netvsc/hn_var.h | 4 +- drivers/net/netvsc/hn_vf.c | 8 +- drivers/net/nfp/nfp_net.c | 20 +- drivers/net/nfp/nfp_net_pmd.h | 2 +- drivers/net/null/rte_eth_null.c | 6 +- drivers/net/octeontx/octeontx_ethdev.c | 8 +- drivers/net/octeontx/octeontx_ethdev.h | 2 +- drivers/net/pcap/rte_eth_pcap.c | 22 +- drivers/net/qede/base/bcm_osal.h | 2 +- drivers/net/qede/base/ecore_dev.c | 4 +- drivers/net/qede/qede_ethdev.c | 58 ++-- drivers/net/qede/qede_ethdev.h | 6 +- drivers/net/qede/qede_filter.c | 66 ++--- drivers/net/qede/qede_if.h | 4 +- drivers/net/qede/qede_main.c | 6 +- drivers/net/qede/qede_rxtx.c | 32 +- drivers/net/qede/qede_rxtx.h | 2 +- drivers/net/ring/rte_eth_ring.c | 4 +- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ef10_tx.c | 4 +- drivers/net/sfc/sfc_ethdev.c | 20 +- drivers/net/sfc/sfc_flow.c | 12 +- drivers/net/sfc/sfc_port.c | 8 +- drivers/net/sfc/sfc_tso.c | 4 +- drivers/net/sfc/sfc_tso.h | 4 +- drivers/net/softnic/parser.c | 18 +- drivers/net/softnic/parser.h | 2 +- drivers/net/softnic/rte_eth_softnic.c | 2 +- drivers/net/softnic/rte_eth_softnic_flow.c | 4 +- drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- drivers/net/szedata2/rte_eth_szedata2.c | 8 +- drivers/net/tap/rte_eth_tap.c | 60 ++-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_bpf_program.c | 14 +- drivers/net/tap/tap_flow.c | 12 +- drivers/net/thunderx/base/nicvf_mbox.c | 4 +- drivers/net/thunderx/base/nicvf_plat.h | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 18 +- drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- drivers/net/vhost/rte_eth_vhost.c | 12 +- drivers/net/virtio/virtio_ethdev.c | 72 ++--- drivers/net/virtio/virtio_pci.h | 4 +- drivers/net/virtio/virtio_rxtx.c | 32 +- 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 | 12 +- drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 44 +-- examples/bbdev_app/main.c | 40 +-- examples/bond/main.c | 78 ++--- examples/distributor/main.c | 4 +- examples/ethtool/ethtool-app/ethapp.c | 8 +- examples/ethtool/ethtool-app/main.c | 10 +- examples/ethtool/lib/rte_ethtool.c | 8 +- examples/ethtool/lib/rte_ethtool.h | 6 +- examples/eventdev_pipeline/main.c | 4 +- examples/eventdev_pipeline/pipeline_common.h | 10 +- examples/flow_classify/flow_classify.c | 30 +- examples/flow_filtering/main.c | 10 +- examples/ip_fragmentation/main.c | 64 ++-- examples/ip_pipeline/cli.c | 4 +- examples/ip_pipeline/kni.c | 2 +- examples/ip_pipeline/parser.c | 18 +- examples/ip_pipeline/parser.h | 2 +- examples/ip_pipeline/pipeline.c | 40 +-- examples/ip_reassembly/main.c | 50 ++-- examples/ipsec-secgw/esp.c | 42 +-- examples/ipsec-secgw/ipsec-secgw.c | 42 +-- examples/ipsec-secgw/ipsec.h | 2 +- examples/ipsec-secgw/parser.c | 4 +- examples/ipsec-secgw/sa.c | 16 +- examples/ipv4_multicast/main.c | 58 ++-- examples/kni/main.c | 14 +- examples/l2fwd-cat/l2fwd-cat.c | 4 +- examples/l2fwd-crypto/main.c | 26 +- examples/l2fwd-jobstats/main.c | 8 +- examples/l2fwd-keepalive/main.c | 8 +- examples/l2fwd/main.c | 8 +- examples/l3fwd-acl/main.c | 102 +++---- examples/l3fwd-power/main.c | 100 +++---- examples/l3fwd-vf/main.c | 68 ++--- examples/l3fwd/l3fwd.h | 8 +- examples/l3fwd/l3fwd_altivec.h | 14 +- examples/l3fwd/l3fwd_common.h | 4 +- examples/l3fwd/l3fwd_em.c | 44 +-- examples/l3fwd/l3fwd_em.h | 20 +- examples/l3fwd/l3fwd_em_hlm.h | 16 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 16 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- examples/l3fwd/l3fwd_em_sequential.h | 16 +- examples/l3fwd/l3fwd_lpm.c | 50 ++-- examples/l3fwd/l3fwd_lpm.h | 20 +- examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- examples/l3fwd/l3fwd_lpm_neon.h | 30 +- examples/l3fwd/l3fwd_lpm_sse.h | 20 +- examples/l3fwd/l3fwd_neon.h | 14 +- examples/l3fwd/l3fwd_sse.h | 14 +- examples/l3fwd/main.c | 20 +- examples/link_status_interrupt/main.c | 8 +- examples/load_balancer/runtime.c | 6 +- .../client_server_mp/mp_server/main.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 322 ++++++++++----------- examples/ptpclient/ptpclient.c | 32 +- examples/qos_meter/main.c | 4 +- examples/qos_sched/init.c | 2 +- examples/quota_watermark/qw/main.c | 8 +- examples/rxtx_callbacks/main.c | 4 +- examples/server_node_efd/node/node.c | 6 +- examples/server_node_efd/server/main.c | 8 +- examples/skeleton/basicfwd.c | 4 +- examples/tep_termination/main.c | 2 +- examples/tep_termination/main.h | 2 +- examples/tep_termination/vxlan.c | 108 +++---- examples/tep_termination/vxlan.h | 8 +- examples/tep_termination/vxlan_setup.c | 30 +- examples/tep_termination/vxlan_setup.h | 2 +- examples/vhost/main.c | 40 +-- examples/vhost/main.h | 2 +- examples/vm_power_manager/channel_monitor.c | 12 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/main.c | 6 +- examples/vmdq/main.c | 12 +- examples/vmdq_dcb/main.c | 12 +- lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_eth_ctrl.h | 12 +- lib/librte_ethdev/rte_ethdev.c | 58 ++-- lib/librte_ethdev/rte_ethdev.h | 14 +- lib/librte_ethdev/rte_ethdev_core.h | 12 +- lib/librte_ethdev/rte_flow.h | 32 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 32 +- lib/librte_gro/gro_tcp4.c | 26 +- lib/librte_gro/gro_tcp4.h | 22 +- lib/librte_gro/gro_vxlan_tcp4.c | 64 ++-- lib/librte_gro/gro_vxlan_tcp4.h | 6 +- lib/librte_gso/gso_common.h | 16 +- lib/librte_gso/gso_tcp4.c | 12 +- lib/librte_gso/gso_tunnel_tcp4.c | 14 +- lib/librte_gso/gso_udp4.c | 8 +- lib/librte_gso/rte_gso.h | 8 +- lib/librte_hash/rte_thash.h | 2 +- lib/librte_ip_frag/rte_ip_frag.h | 12 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 +- lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- lib/librte_ipsec/crypto.h | 2 +- lib/librte_ipsec/esp_inb.c | 10 +- lib/librte_ipsec/esp_outb.c | 8 +- lib/librte_ipsec/iph.h | 8 +- lib/librte_ipsec/sa.c | 8 +- lib/librte_kni/rte_kni.c | 4 +- lib/librte_kni/rte_kni.h | 2 +- lib/librte_net/rte_arp.c | 32 +- lib/librte_net/rte_arp.h | 36 +-- lib/librte_net/rte_esp.h | 2 +- lib/librte_net/rte_ether.h | 182 ++++++------ lib/librte_net/rte_gre.h | 2 +- lib/librte_net/rte_icmp.h | 6 +- lib/librte_net/rte_ip.h | 72 ++--- lib/librte_net/rte_net.c | 94 +++--- lib/librte_net/rte_net.h | 22 +- lib/librte_net/rte_sctp.h | 2 +- lib/librte_net/rte_tcp.h | 2 +- lib/librte_net/rte_udp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 224 +++++++------- lib/librte_pipeline/rte_table_action.h | 4 +- lib/librte_port/rte_port_ras.c | 8 +- lib/librte_port/rte_port_source_sink.c | 6 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/virtio_net.c | 42 +-- 388 files changed, 4145 insertions(+), 4145 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz 2019-04-10 8:32 ` Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz ` (2 more replies) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 02/14] net: add rte prefix to arp defines Olivier Matz ` (14 subsequent siblings) 16 siblings, 3 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct arp_hdr as struct rte_arp_hdr. - rename struct arp_ipv4 as struct rte_arp_ipv4. Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields to avoid conflict with the #defines in gnu libc. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 36 ++++++++++++++++----------------- app/test/packet_burst_generator.c | 12 +++++------ app/test/packet_burst_generator.h | 2 +- app/test/test_link_bonding.c | 28 ++++++++++++------------- drivers/net/bonding/rte_eth_bond_alb.c | 26 ++++++++++++------------ drivers/net/bonding/rte_eth_bond_pmd.c | 16 +++++++-------- drivers/net/i40e/base/i40e_adminq_cmd.h | 4 ++-- drivers/net/i40e/base/i40e_common.c | 12 +++++------ drivers/net/i40e/base/i40e_prototype.h | 4 ++-- drivers/net/i40e/i40e_fdir.c | 4 ++-- drivers/net/iavf/base/iavf_adminq_cmd.h | 4 ++-- drivers/net/iavf/base/iavf_common.c | 12 +++++------ drivers/net/iavf/base/iavf_prototype.h | 4 ++-- examples/bond/main.c | 24 +++++++++++----------- lib/librte_net/rte_arp.c | 14 ++++++------- lib/librte_net/rte_arp.h | 16 +++++++-------- 16 files changed, 109 insertions(+), 109 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 55d266d77..34f68d73b 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -36,9 +36,9 @@ #include "testpmd.h" static const char * -arp_op_name(uint16_t arp_op) +arp_opcode_name(uint16_t arp_opcode) { - switch (arp_op ) { + switch (arp_opcode ) { case ARP_OP_REQUEST: return "ARP Request"; case ARP_OP_REPLY: @@ -277,7 +277,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_mbuf *pkt; struct ether_hdr *eth_h; struct vlan_hdr *vlan_h; - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; struct icmp_hdr *icmp_h; struct ether_addr eth_addr; @@ -288,8 +288,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) uint16_t nb_replies; uint16_t eth_type; uint16_t vlan_id; - uint16_t arp_op; - uint16_t arp_pro; + uint16_t arp_opcode; + uint16_t arp_protocol; uint32_t cksum; uint8_t i; int l2_len; @@ -347,22 +347,22 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* Reply to ARP requests */ if (eth_type == ETHER_TYPE_ARP) { - arp_h = (struct arp_hdr *) ((char *)eth_h + l2_len); - arp_op = RTE_BE_TO_CPU_16(arp_h->arp_op); - arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_pro); + 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); if (verbose_level > 0) { printf(" ARP: hrd=%d proto=0x%04x hln=%d " "pln=%d op=%u (%s)\n", - RTE_BE_TO_CPU_16(arp_h->arp_hrd), - arp_pro, arp_h->arp_hln, - arp_h->arp_pln, arp_op, - arp_op_name(arp_op)); + RTE_BE_TO_CPU_16(arp_h->arp_hardware), + arp_protocol, arp_h->arp_hlen, + arp_h->arp_plen, arp_opcode, + arp_opcode_name(arp_opcode)); } - if ((RTE_BE_TO_CPU_16(arp_h->arp_hrd) != + if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != ARP_HRD_ETHER) || - (arp_pro != ETHER_TYPE_IPv4) || - (arp_h->arp_hln != 6) || - (arp_h->arp_pln != 4) + (arp_protocol != ETHER_TYPE_IPv4) || + (arp_h->arp_hlen != 6) || + (arp_h->arp_plen != 4) ) { rte_pktmbuf_free(pkt); if (verbose_level > 0) @@ -381,7 +381,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ipv4_addr_dump(" tip=", ip_addr); printf("\n"); } - if (arp_op != ARP_OP_REQUEST) { + if (arp_opcode != ARP_OP_REQUEST) { rte_pktmbuf_free(pkt); continue; } @@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); - arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index e894dc76f..0b12058bb 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -74,15 +74,15 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, } void -initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { - arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hln = ETHER_ADDR_LEN; - arp_hdr->arp_pln = sizeof(uint32_t); - arp_hdr->arp_op = rte_cpu_to_be_16(opcode); + arp_hdr->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = src_ip; ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index c20cea6e9..b6e013a11 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -29,7 +29,7 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, uint8_t vlan_enabled, uint16_t van_id); void -initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 0fe1d78eb..db437a9c2 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4460,7 +4460,7 @@ test_alb_change_mac_in_reply_sent(void) struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; struct ether_hdr *eth_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; int slave_idx, nb_pkts, pkt_idx; int retval = 0; @@ -4495,7 +4495,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4505,7 +4505,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4515,7 +4515,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4525,7 +4525,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4546,7 +4546,7 @@ test_alb_change_mac_in_reply_sent(void) for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4571,7 +4571,7 @@ static int test_alb_reply_from_client(void) { struct ether_hdr *eth_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; @@ -4608,7 +4608,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4619,7 +4619,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4630,7 +4630,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4641,7 +4641,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4667,7 +4667,7 @@ test_alb_reply_from_client(void) for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4699,7 +4699,7 @@ test_alb_receive_vlan_reply(void) { struct ether_hdr *eth_pkt; struct vlan_hdr *vlan_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; @@ -4740,7 +4740,7 @@ test_alb_receive_vlan_reply(void) 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); - arp_pkt = (struct arp_hdr *)((char *)(vlan_pkt + 1)); + arp_pkt = (struct rte_arp_hdr *)((char *)(vlan_pkt + 1)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index d3e16d4bd..16a415a99 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -74,17 +74,17 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { - struct arp_hdr *arp; + struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; struct client_data *client_info; uint8_t hash_index; - arp = (struct arp_hdr *) ((char *) (eth_h + 1) + offset); + arp = (struct rte_arp_hdr *) ((char *) (eth_h + 1) + offset); /* ARP Requests are forwarded to the application with no changes */ - if (arp->arp_op != rte_cpu_to_be_16(ARP_OP_REPLY)) + if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY)) return; /* From now on, we analyze only ARP Reply packets */ @@ -123,7 +123,7 @@ uint16_t bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { - struct arp_hdr *arp; + struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; struct client_data *client_info; @@ -132,7 +132,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, struct ether_addr bonding_mac; - arp = (struct arp_hdr *)((char *)(eth_h + 1) + offset); + arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); /* * Traffic with src MAC other than bonding should be sent on @@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, client_info = &hash_table[hash_index]; rte_spinlock_lock(&internals->mode6.lock); - if (arp->arp_op == rte_cpu_to_be_16(ARP_OP_REPLY)) { + if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) { if (client_info->in_use) { if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { @@ -196,7 +196,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals) { struct ether_hdr *eth_h; - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; uint16_t slave_idx; rte_spinlock_lock(&internals->mode6.lock); @@ -209,7 +209,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, else eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_h = (struct arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) + arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) + client_info->vlan_count * sizeof(struct vlan_hdr)); memcpy(eth_h + 1, client_info->vlan, @@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; - arp_h->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_h->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_h->arp_hln = ETHER_ADDR_LEN; - arp_h->arp_pln = sizeof(uint32_t); - arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); slave_idx = client_info->slave_idx; rte_spinlock_unlock(&internals->mode6.lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index f30422a6d..9c5425ef5 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -489,9 +489,9 @@ uint32_t burstnumberTX; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB static void -arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) +arp_opcode_name(uint16_t arp_opcode, char *buf, size_t buf_len) { - switch (arp_op) { + switch (arp_opcode) { case ARP_OP_REQUEST: strlcpy(buf, "ARP Request", buf_len); return; @@ -566,7 +566,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB -#define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_op, port, burstnumber) \ +#define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_opcode, port, burstnumber) \ rte_log(RTE_LOG_DEBUG, bond_logtype, \ "%s port:%d SrcMAC:%02X:%02X:%02X:%02X:%02X:%02X SrcIP:%s " \ "DstMAC:%02X:%02X:%02X:%02X:%02X:%02X DstIP:%s %s %d\n", \ @@ -580,7 +580,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) eth_h->d_addr.addr_bytes[2], eth_h->d_addr.addr_bytes[3], \ eth_h->d_addr.addr_bytes[4], eth_h->d_addr.addr_bytes[5], \ dst_ip, \ - arp_op, ++burstnumber) + arp_opcode, ++burstnumber) #endif static void @@ -589,7 +589,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, { struct ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; char dst_ip[16]; char ArpOp[24]; char buf[16]; @@ -614,10 +614,10 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { - arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset); + 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); - arp_op_name(rte_be_to_cpu_16(arp_h->arp_op), + arp_opcode_name(rte_be_to_cpu_16(arp_h->arp_opcode), ArpOp, sizeof(ArpOp)); MODE6_DEBUG(buf, src_ip, dst_ip, eth_h, ArpOp, port, *burstnumber); } @@ -1127,7 +1127,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) "Failed to allocate ARP packet from pool"); continue; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr) + pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr) + client_info->vlan_count * sizeof(struct vlan_hdr); upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h index cf6ef63e3..f988e74c6 100644 --- a/drivers/net/i40e/base/i40e_adminq_cmd.h +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h @@ -458,7 +458,7 @@ struct i40e_aqc_cppm_configuration { I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration); /* Set ARP Proxy command / response (indirect 0x0104) */ -struct i40e_aqc_arp_proxy_data { +struct i40e_aqc_arp_protocolxy_data { __le16 command_flags; #define I40E_AQ_ARP_INIT_IPV4 0x0800 #define I40E_AQ_ARP_UNSUP_CTL 0x1000 @@ -474,7 +474,7 @@ struct i40e_aqc_arp_proxy_data { u8 reserved[2]; }; -I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_proxy_data); +I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_protocolxy_data); /* Set NS Proxy Table Entry Command (indirect 0x0105) */ struct i40e_aqc_ns_proxy_data { diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 8a98afff1..875b8f8ad 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -7301,16 +7301,16 @@ enum i40e_status_code i40e_vf_reset(struct i40e_hw *hw) #endif /* VF_DRIVER */ /** - * i40e_aq_set_arp_proxy_config + * i40e_aq_set_arp_protocolxy_config * @hw: pointer to the HW structure * @proxy_config: pointer to proxy config command table struct * @cmd_details: pointer to command details * * Set ARP offload parameters from pre-populated - * i40e_aqc_arp_proxy_data struct + * i40e_aqc_arp_protocolxy_data struct **/ -enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, - struct i40e_aqc_arp_proxy_data *proxy_config, +enum i40e_status_code i40e_aq_set_arp_protocolxy_config(struct i40e_hw *hw, + struct i40e_aqc_arp_protocolxy_data *proxy_config, struct i40e_asq_cmd_details *cmd_details) { struct i40e_aq_desc desc; @@ -7327,10 +7327,10 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, CPU_TO_LE32(I40E_HI_DWORD((u64)proxy_config)); desc.params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)proxy_config)); - desc.datalen = CPU_TO_LE16(sizeof(struct i40e_aqc_arp_proxy_data)); + desc.datalen = CPU_TO_LE16(sizeof(struct i40e_aqc_arp_protocolxy_data)); status = i40e_asq_send_command(hw, &desc, proxy_config, - sizeof(struct i40e_aqc_arp_proxy_data), + sizeof(struct i40e_aqc_arp_protocolxy_data), cmd_details); return status; diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h index 0cf006dad..28f80178b 100644 --- a/drivers/net/i40e/base/i40e_prototype.h +++ b/drivers/net/i40e/base/i40e_prototype.h @@ -556,8 +556,8 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw, u32 reg_addr, u32 *reg_val, struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, - struct i40e_aqc_arp_proxy_data *proxy_config, +enum i40e_status_code i40e_aq_set_arp_protocolxy_config(struct i40e_hw *hw, + struct i40e_aqc_arp_protocolxy_data *proxy_config, struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_set_ns_proxy_table_entry(struct i40e_hw *hw, struct i40e_aqc_ns_proxy_data *ns_proxy_table_entry, diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index d41601a17..4b32fee1e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -911,7 +911,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, */ if (fdir_input->flow.l2_flow.ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) - payload += sizeof(struct arp_hdr); + payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; break; default: @@ -1197,7 +1197,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, */ if (fdir_input->flow.l2_flow.ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) - payload += sizeof(struct arp_hdr); + payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; } else if (fdir_input->flow_ext.customized_pctype) { /* If customized pctype is used */ diff --git a/drivers/net/iavf/base/iavf_adminq_cmd.h b/drivers/net/iavf/base/iavf_adminq_cmd.h index 353feb3da..295771f94 100644 --- a/drivers/net/iavf/base/iavf_adminq_cmd.h +++ b/drivers/net/iavf/base/iavf_adminq_cmd.h @@ -488,7 +488,7 @@ struct iavf_aqc_cppm_configuration { IAVF_CHECK_CMD_LENGTH(iavf_aqc_cppm_configuration); /* Set ARP Proxy command / response (indirect 0x0104) */ -struct iavf_aqc_arp_proxy_data { +struct iavf_aqc_arp_protocolxy_data { __le16 command_flags; #define IAVF_AQ_ARP_INIT_IPV4 0x0800 #define IAVF_AQ_ARP_UNSUP_CTL 0x1000 @@ -504,7 +504,7 @@ struct iavf_aqc_arp_proxy_data { u8 reserved[2]; }; -IAVF_CHECK_STRUCT_LEN(0x14, iavf_aqc_arp_proxy_data); +IAVF_CHECK_STRUCT_LEN(0x14, iavf_aqc_arp_protocolxy_data); /* Set NS Proxy Table Entry Command (indirect 0x0105) */ struct iavf_aqc_ns_proxy_data { diff --git a/drivers/net/iavf/base/iavf_common.c b/drivers/net/iavf/base/iavf_common.c index be700dde2..e186bfdee 100644 --- a/drivers/net/iavf/base/iavf_common.c +++ b/drivers/net/iavf/base/iavf_common.c @@ -1236,16 +1236,16 @@ enum iavf_status_code iavf_reset(struct iavf_hw *hw) } /** - * iavf_aq_set_arp_proxy_config + * iavf_aq_set_arp_protocolxy_config * @hw: pointer to the HW structure * @proxy_config: pointer to proxy config command table struct * @cmd_details: pointer to command details * * Set ARP offload parameters from pre-populated - * iavf_aqc_arp_proxy_data struct + * iavf_aqc_arp_protocolxy_data struct **/ -enum iavf_status_code iavf_aq_set_arp_proxy_config(struct iavf_hw *hw, - struct iavf_aqc_arp_proxy_data *proxy_config, +enum iavf_status_code iavf_aq_set_arp_protocolxy_config(struct iavf_hw *hw, + struct iavf_aqc_arp_protocolxy_data *proxy_config, struct iavf_asq_cmd_details *cmd_details) { struct iavf_aq_desc desc; @@ -1262,10 +1262,10 @@ enum iavf_status_code iavf_aq_set_arp_proxy_config(struct iavf_hw *hw, CPU_TO_LE32(IAVF_HI_DWORD((u64)proxy_config)); desc.params.external.addr_low = CPU_TO_LE32(IAVF_LO_DWORD((u64)proxy_config)); - desc.datalen = CPU_TO_LE16(sizeof(struct iavf_aqc_arp_proxy_data)); + desc.datalen = CPU_TO_LE16(sizeof(struct iavf_aqc_arp_protocolxy_data)); status = iavf_asq_send_command(hw, &desc, proxy_config, - sizeof(struct iavf_aqc_arp_proxy_data), + sizeof(struct iavf_aqc_arp_protocolxy_data), cmd_details); return status; diff --git a/drivers/net/iavf/base/iavf_prototype.h b/drivers/net/iavf/base/iavf_prototype.h index 35122aedb..2cbb9072f 100644 --- a/drivers/net/iavf/base/iavf_prototype.h +++ b/drivers/net/iavf/base/iavf_prototype.h @@ -146,8 +146,8 @@ enum iavf_status_code iavf_aq_get_phy_register(struct iavf_hw *hw, u32 reg_addr, u32 *reg_val, struct iavf_asq_cmd_details *cmd_details); -enum iavf_status_code iavf_aq_set_arp_proxy_config(struct iavf_hw *hw, - struct iavf_aqc_arp_proxy_data *proxy_config, +enum iavf_status_code iavf_aq_set_arp_protocolxy_config(struct iavf_hw *hw, + struct iavf_aqc_arp_protocolxy_data *proxy_config, struct iavf_asq_cmd_details *cmd_details); enum iavf_status_code iavf_aq_set_ns_proxy_table_entry(struct iavf_hw *hw, struct iavf_aqc_ns_proxy_data *ns_proxy_table_entry, diff --git a/examples/bond/main.c b/examples/bond/main.c index ef86194ff..4ad62c3cb 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -339,7 +339,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct ether_addr d_addr; struct ether_hdr *eth_hdr; - struct arp_hdr *arp_hdr; + struct rte_arp_hdr *arp_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; @@ -382,10 +382,10 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[1]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - arp_hdr = (struct arp_hdr *)((char *)(eth_hdr + 1) + offset); + arp_hdr = (struct rte_arp_hdr *)((char *)(eth_hdr + 1) + offset); if (arp_hdr->arp_data.arp_tip == bond_ip) { - if (arp_hdr->arp_op == rte_cpu_to_be_16(ARP_OP_REQUEST)) { - arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) { + arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); @@ -450,7 +450,7 @@ static void cmd_obj_send_parsed(void *parsed_result, struct rte_mbuf *created_pkt; struct ether_hdr *eth_hdr; - struct arp_hdr *arp_hdr; + struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; size_t pkt_size; @@ -469,7 +469,7 @@ static void cmd_obj_send_parsed(void *parsed_result, return; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr); + pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; @@ -478,12 +478,12 @@ static void cmd_obj_send_parsed(void *parsed_result, memset(ð_hdr->d_addr, 0xFF, ETHER_ADDR_LEN); eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_hdr = (struct arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); - arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hln = ETHER_ADDR_LEN; - arp_hdr->arp_pln = sizeof(uint32_t); - arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REQUEST); + arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); + arp_hdr->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST); rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index f0ed9bd68..c80ebc7e1 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -12,7 +12,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, const struct ether_addr *mac) { struct ether_hdr *eth_hdr; - struct arp_hdr *rarp; + struct rte_arp_hdr *rarp; struct rte_mbuf *mbuf; if (mpool == NULL) @@ -34,12 +34,12 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, eth_hdr->ether_type = htons(ETHER_TYPE_RARP); /* RARP header. */ - rarp = (struct arp_hdr *)(eth_hdr + 1); - rarp->arp_hrd = htons(ARP_HRD_ETHER); - rarp->arp_pro = htons(ETHER_TYPE_IPv4); - rarp->arp_hln = ETHER_ADDR_LEN; - rarp->arp_pln = 4; - rarp->arp_op = htons(ARP_OP_REVREQUEST); + rarp = (struct rte_arp_hdr *)(eth_hdr + 1); + rarp->arp_hardware = htons(ARP_HRD_ETHER); + rarp->arp_protocol = htons(ETHER_TYPE_IPv4); + rarp->arp_hlen = ETHER_ADDR_LEN; + rarp->arp_plen = 4; + rarp->arp_opcode = htons(ARP_OP_REVREQUEST); ether_addr_copy(mac, &rarp->arp_data.arp_sha); ether_addr_copy(mac, &rarp->arp_data.arp_tha); diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index 139a84ca5..c9b5cd49d 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -21,7 +21,7 @@ extern "C" { /** * ARP header IPv4 payload. */ -struct arp_ipv4 { +struct rte_arp_ipv4 { struct ether_addr arp_sha; /**< sender hardware address */ uint32_t arp_sip; /**< sender IP address */ struct ether_addr arp_tha; /**< target hardware address */ @@ -31,14 +31,14 @@ struct arp_ipv4 { /** * ARP header. */ -struct arp_hdr { - uint16_t arp_hrd; /* format of hardware address */ +struct rte_arp_hdr { + uint16_t arp_hardware; /* format of hardware address */ #define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ - uint16_t arp_pro; /* format of protocol address */ - uint8_t arp_hln; /* length of hardware address */ - uint8_t arp_pln; /* length of protocol address */ - uint16_t arp_op; /* ARP opcode (command) */ + uint16_t arp_protocol; /* format of protocol address */ + uint8_t arp_hlen; /* length of hardware address */ + uint8_t arp_plen; /* length of protocol address */ + uint16_t arp_opcode; /* ARP opcode (command) */ #define ARP_OP_REQUEST 1 /* request to resolve address */ #define ARP_OP_REPLY 2 /* response to previous request */ #define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ @@ -46,7 +46,7 @@ struct arp_hdr { #define ARP_OP_INVREQUEST 8 /* request to identify peer */ #define ARP_OP_INVREPLY 9 /* response identifying peer */ - struct arp_ipv4 arp_data; + struct rte_arp_ipv4 arp_data; } __attribute__((__packed__)); /** -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-22 16:00 ` Stephen Hemminger 2019-04-22 16:03 ` Stephen Hemminger 2 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct arp_hdr as struct rte_arp_hdr. - rename struct arp_ipv4 as struct rte_arp_ipv4. Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields to avoid conflict with the #defines in gnu libc. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 36 ++++++++++++++++----------------- app/test/packet_burst_generator.c | 12 +++++------ app/test/packet_burst_generator.h | 2 +- app/test/test_link_bonding.c | 28 ++++++++++++------------- drivers/net/bonding/rte_eth_bond_alb.c | 26 ++++++++++++------------ drivers/net/bonding/rte_eth_bond_pmd.c | 16 +++++++-------- drivers/net/i40e/base/i40e_adminq_cmd.h | 4 ++-- drivers/net/i40e/base/i40e_common.c | 12 +++++------ drivers/net/i40e/base/i40e_prototype.h | 4 ++-- drivers/net/i40e/i40e_fdir.c | 4 ++-- drivers/net/iavf/base/iavf_adminq_cmd.h | 4 ++-- drivers/net/iavf/base/iavf_common.c | 12 +++++------ drivers/net/iavf/base/iavf_prototype.h | 4 ++-- examples/bond/main.c | 24 +++++++++++----------- lib/librte_net/rte_arp.c | 14 ++++++------- lib/librte_net/rte_arp.h | 16 +++++++-------- 16 files changed, 109 insertions(+), 109 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 55d266d77..34f68d73b 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -36,9 +36,9 @@ #include "testpmd.h" static const char * -arp_op_name(uint16_t arp_op) +arp_opcode_name(uint16_t arp_opcode) { - switch (arp_op ) { + switch (arp_opcode ) { case ARP_OP_REQUEST: return "ARP Request"; case ARP_OP_REPLY: @@ -277,7 +277,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_mbuf *pkt; struct ether_hdr *eth_h; struct vlan_hdr *vlan_h; - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; struct icmp_hdr *icmp_h; struct ether_addr eth_addr; @@ -288,8 +288,8 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) uint16_t nb_replies; uint16_t eth_type; uint16_t vlan_id; - uint16_t arp_op; - uint16_t arp_pro; + uint16_t arp_opcode; + uint16_t arp_protocol; uint32_t cksum; uint8_t i; int l2_len; @@ -347,22 +347,22 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* Reply to ARP requests */ if (eth_type == ETHER_TYPE_ARP) { - arp_h = (struct arp_hdr *) ((char *)eth_h + l2_len); - arp_op = RTE_BE_TO_CPU_16(arp_h->arp_op); - arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_pro); + 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); if (verbose_level > 0) { printf(" ARP: hrd=%d proto=0x%04x hln=%d " "pln=%d op=%u (%s)\n", - RTE_BE_TO_CPU_16(arp_h->arp_hrd), - arp_pro, arp_h->arp_hln, - arp_h->arp_pln, arp_op, - arp_op_name(arp_op)); + RTE_BE_TO_CPU_16(arp_h->arp_hardware), + arp_protocol, arp_h->arp_hlen, + arp_h->arp_plen, arp_opcode, + arp_opcode_name(arp_opcode)); } - if ((RTE_BE_TO_CPU_16(arp_h->arp_hrd) != + if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != ARP_HRD_ETHER) || - (arp_pro != ETHER_TYPE_IPv4) || - (arp_h->arp_hln != 6) || - (arp_h->arp_pln != 4) + (arp_protocol != ETHER_TYPE_IPv4) || + (arp_h->arp_hlen != 6) || + (arp_h->arp_plen != 4) ) { rte_pktmbuf_free(pkt); if (verbose_level > 0) @@ -381,7 +381,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ipv4_addr_dump(" tip=", ip_addr); printf("\n"); } - if (arp_op != ARP_OP_REQUEST) { + if (arp_opcode != ARP_OP_REQUEST) { rte_pktmbuf_free(pkt); continue; } @@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); - arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index e894dc76f..0b12058bb 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -74,15 +74,15 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, } void -initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { - arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hln = ETHER_ADDR_LEN; - arp_hdr->arp_pln = sizeof(uint32_t); - arp_hdr->arp_op = rte_cpu_to_be_16(opcode); + arp_hdr->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = src_ip; ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index c20cea6e9..b6e013a11 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -29,7 +29,7 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, uint8_t vlan_enabled, uint16_t van_id); void -initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 0fe1d78eb..db437a9c2 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4460,7 +4460,7 @@ test_alb_change_mac_in_reply_sent(void) struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; struct ether_hdr *eth_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; int slave_idx, nb_pkts, pkt_idx; int retval = 0; @@ -4495,7 +4495,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4505,7 +4505,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4515,7 +4515,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4525,7 +4525,7 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4546,7 +4546,7 @@ test_alb_change_mac_in_reply_sent(void) for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4571,7 +4571,7 @@ static int test_alb_reply_from_client(void) { struct ether_hdr *eth_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; @@ -4608,7 +4608,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4619,7 +4619,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4630,7 +4630,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4641,7 +4641,7 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4667,7 +4667,7 @@ test_alb_reply_from_client(void) for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4699,7 +4699,7 @@ test_alb_receive_vlan_reply(void) { struct ether_hdr *eth_pkt; struct vlan_hdr *vlan_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; @@ -4740,7 +4740,7 @@ test_alb_receive_vlan_reply(void) 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); - arp_pkt = (struct arp_hdr *)((char *)(vlan_pkt + 1)); + arp_pkt = (struct rte_arp_hdr *)((char *)(vlan_pkt + 1)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index d3e16d4bd..16a415a99 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -74,17 +74,17 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { - struct arp_hdr *arp; + struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; struct client_data *client_info; uint8_t hash_index; - arp = (struct arp_hdr *) ((char *) (eth_h + 1) + offset); + arp = (struct rte_arp_hdr *) ((char *) (eth_h + 1) + offset); /* ARP Requests are forwarded to the application with no changes */ - if (arp->arp_op != rte_cpu_to_be_16(ARP_OP_REPLY)) + if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY)) return; /* From now on, we analyze only ARP Reply packets */ @@ -123,7 +123,7 @@ uint16_t bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { - struct arp_hdr *arp; + struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; struct client_data *client_info; @@ -132,7 +132,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, struct ether_addr bonding_mac; - arp = (struct arp_hdr *)((char *)(eth_h + 1) + offset); + arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); /* * Traffic with src MAC other than bonding should be sent on @@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, client_info = &hash_table[hash_index]; rte_spinlock_lock(&internals->mode6.lock); - if (arp->arp_op == rte_cpu_to_be_16(ARP_OP_REPLY)) { + if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) { if (client_info->in_use) { if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { @@ -196,7 +196,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals) { struct ether_hdr *eth_h; - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; uint16_t slave_idx; rte_spinlock_lock(&internals->mode6.lock); @@ -209,7 +209,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, else eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_h = (struct arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) + arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) + client_info->vlan_count * sizeof(struct vlan_hdr)); memcpy(eth_h + 1, client_info->vlan, @@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; - arp_h->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_h->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_h->arp_hln = ETHER_ADDR_LEN; - arp_h->arp_pln = sizeof(uint32_t); - arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); slave_idx = client_info->slave_idx; rte_spinlock_unlock(&internals->mode6.lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index f30422a6d..9c5425ef5 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -489,9 +489,9 @@ uint32_t burstnumberTX; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB static void -arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) +arp_opcode_name(uint16_t arp_opcode, char *buf, size_t buf_len) { - switch (arp_op) { + switch (arp_opcode) { case ARP_OP_REQUEST: strlcpy(buf, "ARP Request", buf_len); return; @@ -566,7 +566,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB -#define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_op, port, burstnumber) \ +#define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_opcode, port, burstnumber) \ rte_log(RTE_LOG_DEBUG, bond_logtype, \ "%s port:%d SrcMAC:%02X:%02X:%02X:%02X:%02X:%02X SrcIP:%s " \ "DstMAC:%02X:%02X:%02X:%02X:%02X:%02X DstIP:%s %s %d\n", \ @@ -580,7 +580,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) eth_h->d_addr.addr_bytes[2], eth_h->d_addr.addr_bytes[3], \ eth_h->d_addr.addr_bytes[4], eth_h->d_addr.addr_bytes[5], \ dst_ip, \ - arp_op, ++burstnumber) + arp_opcode, ++burstnumber) #endif static void @@ -589,7 +589,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, { struct ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; char dst_ip[16]; char ArpOp[24]; char buf[16]; @@ -614,10 +614,10 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { - arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset); + 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); - arp_op_name(rte_be_to_cpu_16(arp_h->arp_op), + arp_opcode_name(rte_be_to_cpu_16(arp_h->arp_opcode), ArpOp, sizeof(ArpOp)); MODE6_DEBUG(buf, src_ip, dst_ip, eth_h, ArpOp, port, *burstnumber); } @@ -1127,7 +1127,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) "Failed to allocate ARP packet from pool"); continue; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr) + pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr) + client_info->vlan_count * sizeof(struct vlan_hdr); upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h index cf6ef63e3..f988e74c6 100644 --- a/drivers/net/i40e/base/i40e_adminq_cmd.h +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h @@ -458,7 +458,7 @@ struct i40e_aqc_cppm_configuration { I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration); /* Set ARP Proxy command / response (indirect 0x0104) */ -struct i40e_aqc_arp_proxy_data { +struct i40e_aqc_arp_protocolxy_data { __le16 command_flags; #define I40E_AQ_ARP_INIT_IPV4 0x0800 #define I40E_AQ_ARP_UNSUP_CTL 0x1000 @@ -474,7 +474,7 @@ struct i40e_aqc_arp_proxy_data { u8 reserved[2]; }; -I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_proxy_data); +I40E_CHECK_STRUCT_LEN(0x14, i40e_aqc_arp_protocolxy_data); /* Set NS Proxy Table Entry Command (indirect 0x0105) */ struct i40e_aqc_ns_proxy_data { diff --git a/drivers/net/i40e/base/i40e_common.c b/drivers/net/i40e/base/i40e_common.c index 8a98afff1..875b8f8ad 100644 --- a/drivers/net/i40e/base/i40e_common.c +++ b/drivers/net/i40e/base/i40e_common.c @@ -7301,16 +7301,16 @@ enum i40e_status_code i40e_vf_reset(struct i40e_hw *hw) #endif /* VF_DRIVER */ /** - * i40e_aq_set_arp_proxy_config + * i40e_aq_set_arp_protocolxy_config * @hw: pointer to the HW structure * @proxy_config: pointer to proxy config command table struct * @cmd_details: pointer to command details * * Set ARP offload parameters from pre-populated - * i40e_aqc_arp_proxy_data struct + * i40e_aqc_arp_protocolxy_data struct **/ -enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, - struct i40e_aqc_arp_proxy_data *proxy_config, +enum i40e_status_code i40e_aq_set_arp_protocolxy_config(struct i40e_hw *hw, + struct i40e_aqc_arp_protocolxy_data *proxy_config, struct i40e_asq_cmd_details *cmd_details) { struct i40e_aq_desc desc; @@ -7327,10 +7327,10 @@ enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, CPU_TO_LE32(I40E_HI_DWORD((u64)proxy_config)); desc.params.external.addr_low = CPU_TO_LE32(I40E_LO_DWORD((u64)proxy_config)); - desc.datalen = CPU_TO_LE16(sizeof(struct i40e_aqc_arp_proxy_data)); + desc.datalen = CPU_TO_LE16(sizeof(struct i40e_aqc_arp_protocolxy_data)); status = i40e_asq_send_command(hw, &desc, proxy_config, - sizeof(struct i40e_aqc_arp_proxy_data), + sizeof(struct i40e_aqc_arp_protocolxy_data), cmd_details); return status; diff --git a/drivers/net/i40e/base/i40e_prototype.h b/drivers/net/i40e/base/i40e_prototype.h index 0cf006dad..28f80178b 100644 --- a/drivers/net/i40e/base/i40e_prototype.h +++ b/drivers/net/i40e/base/i40e_prototype.h @@ -556,8 +556,8 @@ enum i40e_status_code i40e_aq_get_phy_register(struct i40e_hw *hw, u32 reg_addr, u32 *reg_val, struct i40e_asq_cmd_details *cmd_details); -enum i40e_status_code i40e_aq_set_arp_proxy_config(struct i40e_hw *hw, - struct i40e_aqc_arp_proxy_data *proxy_config, +enum i40e_status_code i40e_aq_set_arp_protocolxy_config(struct i40e_hw *hw, + struct i40e_aqc_arp_protocolxy_data *proxy_config, struct i40e_asq_cmd_details *cmd_details); enum i40e_status_code i40e_aq_set_ns_proxy_table_entry(struct i40e_hw *hw, struct i40e_aqc_ns_proxy_data *ns_proxy_table_entry, diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index d41601a17..4b32fee1e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -911,7 +911,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, */ if (fdir_input->flow.l2_flow.ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) - payload += sizeof(struct arp_hdr); + payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; break; default: @@ -1197,7 +1197,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, */ if (fdir_input->flow.l2_flow.ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) - payload += sizeof(struct arp_hdr); + payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; } else if (fdir_input->flow_ext.customized_pctype) { /* If customized pctype is used */ diff --git a/drivers/net/iavf/base/iavf_adminq_cmd.h b/drivers/net/iavf/base/iavf_adminq_cmd.h index 353feb3da..295771f94 100644 --- a/drivers/net/iavf/base/iavf_adminq_cmd.h +++ b/drivers/net/iavf/base/iavf_adminq_cmd.h @@ -488,7 +488,7 @@ struct iavf_aqc_cppm_configuration { IAVF_CHECK_CMD_LENGTH(iavf_aqc_cppm_configuration); /* Set ARP Proxy command / response (indirect 0x0104) */ -struct iavf_aqc_arp_proxy_data { +struct iavf_aqc_arp_protocolxy_data { __le16 command_flags; #define IAVF_AQ_ARP_INIT_IPV4 0x0800 #define IAVF_AQ_ARP_UNSUP_CTL 0x1000 @@ -504,7 +504,7 @@ struct iavf_aqc_arp_proxy_data { u8 reserved[2]; }; -IAVF_CHECK_STRUCT_LEN(0x14, iavf_aqc_arp_proxy_data); +IAVF_CHECK_STRUCT_LEN(0x14, iavf_aqc_arp_protocolxy_data); /* Set NS Proxy Table Entry Command (indirect 0x0105) */ struct iavf_aqc_ns_proxy_data { diff --git a/drivers/net/iavf/base/iavf_common.c b/drivers/net/iavf/base/iavf_common.c index be700dde2..e186bfdee 100644 --- a/drivers/net/iavf/base/iavf_common.c +++ b/drivers/net/iavf/base/iavf_common.c @@ -1236,16 +1236,16 @@ enum iavf_status_code iavf_reset(struct iavf_hw *hw) } /** - * iavf_aq_set_arp_proxy_config + * iavf_aq_set_arp_protocolxy_config * @hw: pointer to the HW structure * @proxy_config: pointer to proxy config command table struct * @cmd_details: pointer to command details * * Set ARP offload parameters from pre-populated - * iavf_aqc_arp_proxy_data struct + * iavf_aqc_arp_protocolxy_data struct **/ -enum iavf_status_code iavf_aq_set_arp_proxy_config(struct iavf_hw *hw, - struct iavf_aqc_arp_proxy_data *proxy_config, +enum iavf_status_code iavf_aq_set_arp_protocolxy_config(struct iavf_hw *hw, + struct iavf_aqc_arp_protocolxy_data *proxy_config, struct iavf_asq_cmd_details *cmd_details) { struct iavf_aq_desc desc; @@ -1262,10 +1262,10 @@ enum iavf_status_code iavf_aq_set_arp_proxy_config(struct iavf_hw *hw, CPU_TO_LE32(IAVF_HI_DWORD((u64)proxy_config)); desc.params.external.addr_low = CPU_TO_LE32(IAVF_LO_DWORD((u64)proxy_config)); - desc.datalen = CPU_TO_LE16(sizeof(struct iavf_aqc_arp_proxy_data)); + desc.datalen = CPU_TO_LE16(sizeof(struct iavf_aqc_arp_protocolxy_data)); status = iavf_asq_send_command(hw, &desc, proxy_config, - sizeof(struct iavf_aqc_arp_proxy_data), + sizeof(struct iavf_aqc_arp_protocolxy_data), cmd_details); return status; diff --git a/drivers/net/iavf/base/iavf_prototype.h b/drivers/net/iavf/base/iavf_prototype.h index 35122aedb..2cbb9072f 100644 --- a/drivers/net/iavf/base/iavf_prototype.h +++ b/drivers/net/iavf/base/iavf_prototype.h @@ -146,8 +146,8 @@ enum iavf_status_code iavf_aq_get_phy_register(struct iavf_hw *hw, u32 reg_addr, u32 *reg_val, struct iavf_asq_cmd_details *cmd_details); -enum iavf_status_code iavf_aq_set_arp_proxy_config(struct iavf_hw *hw, - struct iavf_aqc_arp_proxy_data *proxy_config, +enum iavf_status_code iavf_aq_set_arp_protocolxy_config(struct iavf_hw *hw, + struct iavf_aqc_arp_protocolxy_data *proxy_config, struct iavf_asq_cmd_details *cmd_details); enum iavf_status_code iavf_aq_set_ns_proxy_table_entry(struct iavf_hw *hw, struct iavf_aqc_ns_proxy_data *ns_proxy_table_entry, diff --git a/examples/bond/main.c b/examples/bond/main.c index ef86194ff..4ad62c3cb 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -339,7 +339,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct ether_addr d_addr; struct ether_hdr *eth_hdr; - struct arp_hdr *arp_hdr; + struct rte_arp_hdr *arp_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; @@ -382,10 +382,10 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[1]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - arp_hdr = (struct arp_hdr *)((char *)(eth_hdr + 1) + offset); + arp_hdr = (struct rte_arp_hdr *)((char *)(eth_hdr + 1) + offset); if (arp_hdr->arp_data.arp_tip == bond_ip) { - if (arp_hdr->arp_op == rte_cpu_to_be_16(ARP_OP_REQUEST)) { - arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) { + arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); @@ -450,7 +450,7 @@ static void cmd_obj_send_parsed(void *parsed_result, struct rte_mbuf *created_pkt; struct ether_hdr *eth_hdr; - struct arp_hdr *arp_hdr; + struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; size_t pkt_size; @@ -469,7 +469,7 @@ static void cmd_obj_send_parsed(void *parsed_result, return; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr); + pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; @@ -478,12 +478,12 @@ static void cmd_obj_send_parsed(void *parsed_result, memset(ð_hdr->d_addr, 0xFF, ETHER_ADDR_LEN); eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_hdr = (struct arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); - arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hln = ETHER_ADDR_LEN; - arp_hdr->arp_pln = sizeof(uint32_t); - arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REQUEST); + arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); + arp_hdr->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST); rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index f0ed9bd68..c80ebc7e1 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -12,7 +12,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, const struct ether_addr *mac) { struct ether_hdr *eth_hdr; - struct arp_hdr *rarp; + struct rte_arp_hdr *rarp; struct rte_mbuf *mbuf; if (mpool == NULL) @@ -34,12 +34,12 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, eth_hdr->ether_type = htons(ETHER_TYPE_RARP); /* RARP header. */ - rarp = (struct arp_hdr *)(eth_hdr + 1); - rarp->arp_hrd = htons(ARP_HRD_ETHER); - rarp->arp_pro = htons(ETHER_TYPE_IPv4); - rarp->arp_hln = ETHER_ADDR_LEN; - rarp->arp_pln = 4; - rarp->arp_op = htons(ARP_OP_REVREQUEST); + rarp = (struct rte_arp_hdr *)(eth_hdr + 1); + rarp->arp_hardware = htons(ARP_HRD_ETHER); + rarp->arp_protocol = htons(ETHER_TYPE_IPv4); + rarp->arp_hlen = ETHER_ADDR_LEN; + rarp->arp_plen = 4; + rarp->arp_opcode = htons(ARP_OP_REVREQUEST); ether_addr_copy(mac, &rarp->arp_data.arp_sha); ether_addr_copy(mac, &rarp->arp_data.arp_tha); diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index 139a84ca5..c9b5cd49d 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -21,7 +21,7 @@ extern "C" { /** * ARP header IPv4 payload. */ -struct arp_ipv4 { +struct rte_arp_ipv4 { struct ether_addr arp_sha; /**< sender hardware address */ uint32_t arp_sip; /**< sender IP address */ struct ether_addr arp_tha; /**< target hardware address */ @@ -31,14 +31,14 @@ struct arp_ipv4 { /** * ARP header. */ -struct arp_hdr { - uint16_t arp_hrd; /* format of hardware address */ +struct rte_arp_hdr { + uint16_t arp_hardware; /* format of hardware address */ #define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ - uint16_t arp_pro; /* format of protocol address */ - uint8_t arp_hln; /* length of hardware address */ - uint8_t arp_pln; /* length of protocol address */ - uint16_t arp_op; /* ARP opcode (command) */ + uint16_t arp_protocol; /* format of protocol address */ + uint8_t arp_hlen; /* length of hardware address */ + uint8_t arp_plen; /* length of protocol address */ + uint16_t arp_opcode; /* ARP opcode (command) */ #define ARP_OP_REQUEST 1 /* request to resolve address */ #define ARP_OP_REPLY 2 /* response to previous request */ #define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ @@ -46,7 +46,7 @@ struct arp_hdr { #define ARP_OP_INVREQUEST 8 /* request to identify peer */ #define ARP_OP_INVREPLY 9 /* response identifying peer */ - struct arp_ipv4 arp_data; + struct rte_arp_ipv4 arp_data; } __attribute__((__packed__)); /** -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures Olivier Matz 2019-04-10 8:32 ` Olivier Matz @ 2019-04-22 16:00 ` Stephen Hemminger 2019-04-22 16:00 ` Stephen Hemminger 2019-05-13 11:59 ` Olivier Matz 2019-04-22 16:03 ` Stephen Hemminger 2 siblings, 2 replies; 107+ messages in thread From: Stephen Hemminger @ 2019-04-22 16:00 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, Ferruh Yigit On Wed, 10 Apr 2019 10:32:05 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > Add 'rte_' prefix to structures: > - rename struct arp_hdr as struct rte_arp_hdr. > - rename struct arp_ipv4 as struct rte_arp_ipv4. > > Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields > to avoid conflict with the #defines in gnu libc. > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Agree that adding prefix is best way to handle rte_arp.h. Could you fix up all the checkpatch whitespace warnings on this and resubmit it as a PATCH (not RFC)? ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-04-22 16:00 ` Stephen Hemminger @ 2019-04-22 16:00 ` Stephen Hemminger 2019-05-13 11:59 ` Olivier Matz 1 sibling, 0 replies; 107+ messages in thread From: Stephen Hemminger @ 2019-04-22 16:00 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, Ferruh Yigit On Wed, 10 Apr 2019 10:32:05 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > Add 'rte_' prefix to structures: > - rename struct arp_hdr as struct rte_arp_hdr. > - rename struct arp_ipv4 as struct rte_arp_ipv4. > > Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields > to avoid conflict with the #defines in gnu libc. > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Agree that adding prefix is best way to handle rte_arp.h. Could you fix up all the checkpatch whitespace warnings on this and resubmit it as a PATCH (not RFC)? ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-04-22 16:00 ` Stephen Hemminger 2019-04-22 16:00 ` Stephen Hemminger @ 2019-05-13 11:59 ` Olivier Matz 2019-05-13 11:59 ` Olivier Matz 1 sibling, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-05-13 11:59 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Ferruh Yigit Hi Stephen, On Mon, Apr 22, 2019 at 09:00:45AM -0700, Stephen Hemminger wrote: > On Wed, 10 Apr 2019 10:32:05 +0200 > Olivier Matz <olivier.matz@6wind.com> wrote: > > > Add 'rte_' prefix to structures: > > - rename struct arp_hdr as struct rte_arp_hdr. > > - rename struct arp_ipv4 as struct rte_arp_ipv4. > > > > Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields > > to avoid conflict with the #defines in gnu libc. > > > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> > > Agree that adding prefix is best way to handle rte_arp.h. > > Could you fix up all the checkpatch whitespace warnings on > this and resubmit it as a PATCH (not RFC)? I don't think fixing all whitespace warnings in the patchset is a good thing. It's not new code, and only fixing the parts I'm modifying may result in style inconsistency. I'll have a look on a case by case basis. Thanks Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-05-13 11:59 ` Olivier Matz @ 2019-05-13 11:59 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-13 11:59 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Ferruh Yigit Hi Stephen, On Mon, Apr 22, 2019 at 09:00:45AM -0700, Stephen Hemminger wrote: > On Wed, 10 Apr 2019 10:32:05 +0200 > Olivier Matz <olivier.matz@6wind.com> wrote: > > > Add 'rte_' prefix to structures: > > - rename struct arp_hdr as struct rte_arp_hdr. > > - rename struct arp_ipv4 as struct rte_arp_ipv4. > > > > Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields > > to avoid conflict with the #defines in gnu libc. > > > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> > > Agree that adding prefix is best way to handle rte_arp.h. > > Could you fix up all the checkpatch whitespace warnings on > this and resubmit it as a PATCH (not RFC)? I don't think fixing all whitespace warnings in the patchset is a good thing. It's not new code, and only fixing the parts I'm modifying may result in style inconsistency. I'll have a look on a case by case basis. Thanks Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-22 16:00 ` Stephen Hemminger @ 2019-04-22 16:03 ` Stephen Hemminger 2019-04-22 16:03 ` Stephen Hemminger 2019-05-13 12:04 ` Olivier Matz 2 siblings, 2 replies; 107+ messages in thread From: Stephen Hemminger @ 2019-04-22 16:03 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, Ferruh Yigit On Wed, 10 Apr 2019 10:32:05 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c > index f30422a6d..9c5425ef5 100644 > --- a/drivers/net/bonding/rte_eth_bond_pmd.c > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c > @@ -489,9 +489,9 @@ uint32_t burstnumberTX; > #ifdef RTE_LIBRTE_BOND_DEBUG_ALB > > static void > -arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) > +arp_opcode_name(uint16_t arp_opcode, char *buf, size_t buf_len) > { > - switch (arp_op) { > + switch (arp_opcode) { > case ARP_OP_REQUEST: > strlcpy(buf, "ARP Request", buf_len); > return; > @@ -566,7 +566,7 @@ update_cli This is an internal function, why did it have to be renamed? > diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h > index cf6ef63e3..f988e74c6 100644 > --- a/drivers/net/i40e/base/i40e_adminq_cmd.h > +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h > @@ -458,7 +458,7 @@ struct i40e_aqc_cppm_configuration { > I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration); > > /* Set ARP Proxy command / response (indirect 0x0104) */ > -struct i40e_aqc_arp_proxy_data { > +struct i40e_aqc_arp_protocolxy_data { > __le16 command_flags; Don't change private data or function names in base code. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-04-22 16:03 ` Stephen Hemminger @ 2019-04-22 16:03 ` Stephen Hemminger 2019-05-13 12:04 ` Olivier Matz 1 sibling, 0 replies; 107+ messages in thread From: Stephen Hemminger @ 2019-04-22 16:03 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, Ferruh Yigit On Wed, 10 Apr 2019 10:32:05 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c > index f30422a6d..9c5425ef5 100644 > --- a/drivers/net/bonding/rte_eth_bond_pmd.c > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c > @@ -489,9 +489,9 @@ uint32_t burstnumberTX; > #ifdef RTE_LIBRTE_BOND_DEBUG_ALB > > static void > -arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) > +arp_opcode_name(uint16_t arp_opcode, char *buf, size_t buf_len) > { > - switch (arp_op) { > + switch (arp_opcode) { > case ARP_OP_REQUEST: > strlcpy(buf, "ARP Request", buf_len); > return; > @@ -566,7 +566,7 @@ update_cli This is an internal function, why did it have to be renamed? > diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h > index cf6ef63e3..f988e74c6 100644 > --- a/drivers/net/i40e/base/i40e_adminq_cmd.h > +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h > @@ -458,7 +458,7 @@ struct i40e_aqc_cppm_configuration { > I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration); > > /* Set ARP Proxy command / response (indirect 0x0104) */ > -struct i40e_aqc_arp_proxy_data { > +struct i40e_aqc_arp_protocolxy_data { > __le16 command_flags; Don't change private data or function names in base code. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-04-22 16:03 ` Stephen Hemminger 2019-04-22 16:03 ` Stephen Hemminger @ 2019-05-13 12:04 ` Olivier Matz 2019-05-13 12:04 ` Olivier Matz 1 sibling, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-05-13 12:04 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Ferruh Yigit On Mon, Apr 22, 2019 at 09:03:27AM -0700, Stephen Hemminger wrote: > On Wed, 10 Apr 2019 10:32:05 +0200 > Olivier Matz <olivier.matz@6wind.com> wrote: > > > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c > > index f30422a6d..9c5425ef5 100644 > > --- a/drivers/net/bonding/rte_eth_bond_pmd.c > > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c > > @@ -489,9 +489,9 @@ uint32_t burstnumberTX; > > #ifdef RTE_LIBRTE_BOND_DEBUG_ALB > > > > static void > > -arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) > > +arp_opcode_name(uint16_t arp_opcode, char *buf, size_t buf_len) > > { > > - switch (arp_op) { > > + switch (arp_opcode) { > > case ARP_OP_REQUEST: > > strlcpy(buf, "ARP Request", buf_len); > > return; > > @@ -566,7 +566,7 @@ update_cli > > This is an internal function, why did it have to be renamed? This is a mistake, thanks. > > > diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h > > index cf6ef63e3..f988e74c6 100644 > > --- a/drivers/net/i40e/base/i40e_adminq_cmd.h > > +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h > > @@ -458,7 +458,7 @@ struct i40e_aqc_cppm_configuration { > > I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration); > > > > /* Set ARP Proxy command / response (indirect 0x0104) */ > > -struct i40e_aqc_arp_proxy_data { > > +struct i40e_aqc_arp_protocolxy_data { > > __le16 command_flags; > > Don't change private data or function names in base code. Right, I'll fix that too. Thanks ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures 2019-05-13 12:04 ` Olivier Matz @ 2019-05-13 12:04 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-13 12:04 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Ferruh Yigit On Mon, Apr 22, 2019 at 09:03:27AM -0700, Stephen Hemminger wrote: > On Wed, 10 Apr 2019 10:32:05 +0200 > Olivier Matz <olivier.matz@6wind.com> wrote: > > > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c > > index f30422a6d..9c5425ef5 100644 > > --- a/drivers/net/bonding/rte_eth_bond_pmd.c > > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c > > @@ -489,9 +489,9 @@ uint32_t burstnumberTX; > > #ifdef RTE_LIBRTE_BOND_DEBUG_ALB > > > > static void > > -arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) > > +arp_opcode_name(uint16_t arp_opcode, char *buf, size_t buf_len) > > { > > - switch (arp_op) { > > + switch (arp_opcode) { > > case ARP_OP_REQUEST: > > strlcpy(buf, "ARP Request", buf_len); > > return; > > @@ -566,7 +566,7 @@ update_cli > > This is an internal function, why did it have to be renamed? This is a mistake, thanks. > > > diff --git a/drivers/net/i40e/base/i40e_adminq_cmd.h b/drivers/net/i40e/base/i40e_adminq_cmd.h > > index cf6ef63e3..f988e74c6 100644 > > --- a/drivers/net/i40e/base/i40e_adminq_cmd.h > > +++ b/drivers/net/i40e/base/i40e_adminq_cmd.h > > @@ -458,7 +458,7 @@ struct i40e_aqc_cppm_configuration { > > I40E_CHECK_CMD_LENGTH(i40e_aqc_cppm_configuration); > > > > /* Set ARP Proxy command / response (indirect 0x0104) */ > > -struct i40e_aqc_arp_proxy_data { > > +struct i40e_aqc_arp_protocolxy_data { > > __le16 command_flags; > > Don't change private data or function names in base code. Right, I'll fix that too. Thanks ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 02/14] net: add rte prefix to arp defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 03/14] net: add rte prefix to ether structures Olivier Matz ` (13 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'RTE_' prefix to defines: - rename ARP_HRD_ETHER as RTE_ARP_HRD_ETHER. - rename ARP_OP_REQUEST as RTE_ARP_OP_REQUEST. - rename ARP_OP_REPLY as RTE_ARP_OP_REPLY. - rename ARP_OP_REVREQUEST as RTE_ARP_OP_REVREQUEST. - rename ARP_OP_REVREPLY as RTE_ARP_OP_REVREPLY. - rename ARP_OP_INVREQUEST as RTE_ARP_OP_INVREQUEST. - rename ARP_OP_INVREPLY as RTE_ARP_OP_INVREPLY. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 18 +++++++++--------- app/test/packet_burst_generator.c | 2 +- app/test/test_link_bonding.c | 18 +++++++++--------- drivers/net/bonding/rte_eth_bond_alb.c | 8 ++++---- drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++++++------ examples/bond/main.c | 8 ++++---- lib/librte_net/rte_arp.c | 4 ++-- lib/librte_net/rte_arp.h | 14 +++++++------- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 34f68d73b..062e3ea43 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -39,17 +39,17 @@ static const char * arp_opcode_name(uint16_t arp_opcode) { switch (arp_opcode ) { - case ARP_OP_REQUEST: + case RTE_ARP_OP_REQUEST: return "ARP Request"; - case ARP_OP_REPLY: + case RTE_ARP_OP_REPLY: return "ARP Reply"; - case ARP_OP_REVREQUEST: + case RTE_ARP_OP_REVREQUEST: return "Reverse ARP Request"; - case ARP_OP_REVREPLY: + case RTE_ARP_OP_REVREPLY: return "Reverse ARP Reply"; - case ARP_OP_INVREQUEST: + case RTE_ARP_OP_INVREQUEST: return "Peer Identify Request"; - case ARP_OP_INVREPLY: + case RTE_ARP_OP_INVREPLY: return "Peer Identify Reply"; default: break; @@ -359,7 +359,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) arp_opcode_name(arp_opcode)); } if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != - ARP_HRD_ETHER) || + RTE_ARP_HRD_ETHER) || (arp_protocol != ETHER_TYPE_IPv4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) @@ -381,7 +381,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ipv4_addr_dump(" tip=", ip_addr); printf("\n"); } - if (arp_opcode != ARP_OP_REQUEST) { + if (arp_opcode != RTE_ARP_OP_REQUEST) { rte_pktmbuf_free(pkt); continue; } @@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); - arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 0b12058bb..ccc0bd591 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -78,7 +78,7 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { - arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index db437a9c2..2c20f44ea 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4497,7 +4497,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4507,7 +4507,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4517,7 +4517,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4527,7 +4527,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); slave_mac1 = @@ -4610,7 +4610,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4621,7 +4621,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4632,7 +4632,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4643,7 +4643,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4742,7 +4742,7 @@ test_alb_receive_vlan_reply(void) vlan_pkt->eth_proto = rte_cpu_to_be_16(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, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 16a415a99..3df28965c 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -84,7 +84,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, arp = (struct rte_arp_hdr *) ((char *) (eth_h + 1) + offset); /* ARP Requests are forwarded to the application with no changes */ - if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY)) + if (arp->arp_opcode != rte_cpu_to_be_16(RTE_ARP_OP_REPLY)) return; /* From now on, we analyze only ARP Reply packets */ @@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, client_info = &hash_table[hash_index]; rte_spinlock_lock(&internals->mode6.lock); - if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) { + if (arp->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REPLY)) { if (client_info->in_use) { if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { @@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; - arp_h->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); - arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); slave_idx = client_info->slave_idx; rte_spinlock_unlock(&internals->mode6.lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 9c5425ef5..63df3568d 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -492,22 +492,22 @@ static void arp_opcode_name(uint16_t arp_opcode, char *buf, size_t buf_len) { switch (arp_opcode) { - case ARP_OP_REQUEST: + case RTE_ARP_OP_REQUEST: strlcpy(buf, "ARP Request", buf_len); return; - case ARP_OP_REPLY: + case RTE_ARP_OP_REPLY: strlcpy(buf, "ARP Reply", buf_len); return; - case ARP_OP_REVREQUEST: + case RTE_ARP_OP_REVREQUEST: strlcpy(buf, "Reverse ARP Request", buf_len); return; - case ARP_OP_REVREPLY: + case RTE_ARP_OP_REVREPLY: strlcpy(buf, "Reverse ARP Reply", buf_len); return; - case ARP_OP_INVREQUEST: + case RTE_ARP_OP_INVREQUEST: strlcpy(buf, "Peer Identify Request", buf_len); return; - case ARP_OP_INVREPLY: + case RTE_ARP_OP_INVREPLY: strlcpy(buf, "Peer Identify Reply", buf_len); return; default: diff --git a/examples/bond/main.c b/examples/bond/main.c index 4ad62c3cb..cf7335ddf 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -384,8 +384,8 @@ static int lcore_main(__attribute__((unused)) void *arg1) } arp_hdr = (struct rte_arp_hdr *)((char *)(eth_hdr + 1) + offset); if (arp_hdr->arp_data.arp_tip == bond_ip) { - if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) { - arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) { + arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); @@ -479,11 +479,11 @@ static void cmd_obj_send_parsed(void *parsed_result, eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); - arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); - arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST); + 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; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index c80ebc7e1..877874a5e 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -35,11 +35,11 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, /* RARP header. */ rarp = (struct rte_arp_hdr *)(eth_hdr + 1); - rarp->arp_hardware = htons(ARP_HRD_ETHER); + rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER); rarp->arp_protocol = htons(ETHER_TYPE_IPv4); rarp->arp_hlen = ETHER_ADDR_LEN; rarp->arp_plen = 4; - rarp->arp_opcode = htons(ARP_OP_REVREQUEST); + rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); ether_addr_copy(mac, &rarp->arp_data.arp_sha); ether_addr_copy(mac, &rarp->arp_data.arp_tha); diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index c9b5cd49d..a94fa6a00 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -33,18 +33,18 @@ struct rte_arp_ipv4 { */ struct rte_arp_hdr { uint16_t arp_hardware; /* format of hardware address */ -#define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ +#define RTE_ARP_HRD_ETHER 1 /* ARP Ethernet address format */ uint16_t arp_protocol; /* format of protocol address */ uint8_t arp_hlen; /* length of hardware address */ uint8_t arp_plen; /* length of protocol address */ uint16_t arp_opcode; /* ARP opcode (command) */ -#define ARP_OP_REQUEST 1 /* request to resolve address */ -#define ARP_OP_REPLY 2 /* response to previous request */ -#define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ -#define ARP_OP_REVREPLY 4 /* response giving protocol address */ -#define ARP_OP_INVREQUEST 8 /* request to identify peer */ -#define ARP_OP_INVREPLY 9 /* response identifying peer */ +#define RTE_ARP_OP_REQUEST 1 /* request to resolve address */ +#define RTE_ARP_OP_REPLY 2 /* response to previous request */ +#define RTE_ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ +#define RTE_ARP_OP_REVREPLY 4 /* response giving protocol address */ +#define RTE_ARP_OP_INVREQUEST 8 /* request to identify peer */ +#define RTE_ARP_OP_INVREPLY 9 /* response identifying peer */ struct rte_arp_ipv4 arp_data; } __attribute__((__packed__)); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 02/14] net: add rte prefix to arp defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 02/14] net: add rte prefix to arp defines Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'RTE_' prefix to defines: - rename ARP_HRD_ETHER as RTE_ARP_HRD_ETHER. - rename ARP_OP_REQUEST as RTE_ARP_OP_REQUEST. - rename ARP_OP_REPLY as RTE_ARP_OP_REPLY. - rename ARP_OP_REVREQUEST as RTE_ARP_OP_REVREQUEST. - rename ARP_OP_REVREPLY as RTE_ARP_OP_REVREPLY. - rename ARP_OP_INVREQUEST as RTE_ARP_OP_INVREQUEST. - rename ARP_OP_INVREPLY as RTE_ARP_OP_INVREPLY. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 18 +++++++++--------- app/test/packet_burst_generator.c | 2 +- app/test/test_link_bonding.c | 18 +++++++++--------- drivers/net/bonding/rte_eth_bond_alb.c | 8 ++++---- drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++++++------ examples/bond/main.c | 8 ++++---- lib/librte_net/rte_arp.c | 4 ++-- lib/librte_net/rte_arp.h | 14 +++++++------- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 34f68d73b..062e3ea43 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -39,17 +39,17 @@ static const char * arp_opcode_name(uint16_t arp_opcode) { switch (arp_opcode ) { - case ARP_OP_REQUEST: + case RTE_ARP_OP_REQUEST: return "ARP Request"; - case ARP_OP_REPLY: + case RTE_ARP_OP_REPLY: return "ARP Reply"; - case ARP_OP_REVREQUEST: + case RTE_ARP_OP_REVREQUEST: return "Reverse ARP Request"; - case ARP_OP_REVREPLY: + case RTE_ARP_OP_REVREPLY: return "Reverse ARP Reply"; - case ARP_OP_INVREQUEST: + case RTE_ARP_OP_INVREQUEST: return "Peer Identify Request"; - case ARP_OP_INVREPLY: + case RTE_ARP_OP_INVREPLY: return "Peer Identify Reply"; default: break; @@ -359,7 +359,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) arp_opcode_name(arp_opcode)); } if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != - ARP_HRD_ETHER) || + RTE_ARP_HRD_ETHER) || (arp_protocol != ETHER_TYPE_IPv4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) @@ -381,7 +381,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ipv4_addr_dump(" tip=", ip_addr); printf("\n"); } - if (arp_opcode != ARP_OP_REQUEST) { + if (arp_opcode != RTE_ARP_OP_REQUEST) { rte_pktmbuf_free(pkt); continue; } @@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); - arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 0b12058bb..ccc0bd591 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -78,7 +78,7 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { - arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index db437a9c2..2c20f44ea 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4497,7 +4497,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4507,7 +4507,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4517,7 +4517,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4527,7 +4527,7 @@ test_alb_change_mac_in_reply_sent(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); slave_mac1 = @@ -4610,7 +4610,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4621,7 +4621,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4632,7 +4632,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4643,7 +4643,7 @@ test_alb_reply_from_client(void) 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4742,7 +4742,7 @@ test_alb_receive_vlan_reply(void) vlan_pkt->eth_proto = rte_cpu_to_be_16(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, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 16a415a99..3df28965c 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -84,7 +84,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, arp = (struct rte_arp_hdr *) ((char *) (eth_h + 1) + offset); /* ARP Requests are forwarded to the application with no changes */ - if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY)) + if (arp->arp_opcode != rte_cpu_to_be_16(RTE_ARP_OP_REPLY)) return; /* From now on, we analyze only ARP Reply packets */ @@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, client_info = &hash_table[hash_index]; rte_spinlock_lock(&internals->mode6.lock); - if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) { + if (arp->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REPLY)) { if (client_info->in_use) { if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { @@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; - arp_h->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); - arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); slave_idx = client_info->slave_idx; rte_spinlock_unlock(&internals->mode6.lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 9c5425ef5..63df3568d 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -492,22 +492,22 @@ static void arp_opcode_name(uint16_t arp_opcode, char *buf, size_t buf_len) { switch (arp_opcode) { - case ARP_OP_REQUEST: + case RTE_ARP_OP_REQUEST: strlcpy(buf, "ARP Request", buf_len); return; - case ARP_OP_REPLY: + case RTE_ARP_OP_REPLY: strlcpy(buf, "ARP Reply", buf_len); return; - case ARP_OP_REVREQUEST: + case RTE_ARP_OP_REVREQUEST: strlcpy(buf, "Reverse ARP Request", buf_len); return; - case ARP_OP_REVREPLY: + case RTE_ARP_OP_REVREPLY: strlcpy(buf, "Reverse ARP Reply", buf_len); return; - case ARP_OP_INVREQUEST: + case RTE_ARP_OP_INVREQUEST: strlcpy(buf, "Peer Identify Request", buf_len); return; - case ARP_OP_INVREPLY: + case RTE_ARP_OP_INVREPLY: strlcpy(buf, "Peer Identify Reply", buf_len); return; default: diff --git a/examples/bond/main.c b/examples/bond/main.c index 4ad62c3cb..cf7335ddf 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -384,8 +384,8 @@ static int lcore_main(__attribute__((unused)) void *arg1) } arp_hdr = (struct rte_arp_hdr *)((char *)(eth_hdr + 1) + offset); if (arp_hdr->arp_data.arp_tip == bond_ip) { - if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) { - arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) { + arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); @@ -479,11 +479,11 @@ static void cmd_obj_send_parsed(void *parsed_result, eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); - arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); - arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST); + 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; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index c80ebc7e1..877874a5e 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -35,11 +35,11 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, /* RARP header. */ rarp = (struct rte_arp_hdr *)(eth_hdr + 1); - rarp->arp_hardware = htons(ARP_HRD_ETHER); + rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER); rarp->arp_protocol = htons(ETHER_TYPE_IPv4); rarp->arp_hlen = ETHER_ADDR_LEN; rarp->arp_plen = 4; - rarp->arp_opcode = htons(ARP_OP_REVREQUEST); + rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); ether_addr_copy(mac, &rarp->arp_data.arp_sha); ether_addr_copy(mac, &rarp->arp_data.arp_tha); diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index c9b5cd49d..a94fa6a00 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -33,18 +33,18 @@ struct rte_arp_ipv4 { */ struct rte_arp_hdr { uint16_t arp_hardware; /* format of hardware address */ -#define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ +#define RTE_ARP_HRD_ETHER 1 /* ARP Ethernet address format */ uint16_t arp_protocol; /* format of protocol address */ uint8_t arp_hlen; /* length of hardware address */ uint8_t arp_plen; /* length of protocol address */ uint16_t arp_opcode; /* ARP opcode (command) */ -#define ARP_OP_REQUEST 1 /* request to resolve address */ -#define ARP_OP_REPLY 2 /* response to previous request */ -#define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ -#define ARP_OP_REVREPLY 4 /* response giving protocol address */ -#define ARP_OP_INVREQUEST 8 /* request to identify peer */ -#define ARP_OP_INVREPLY 9 /* response identifying peer */ +#define RTE_ARP_OP_REQUEST 1 /* request to resolve address */ +#define RTE_ARP_OP_REPLY 2 /* response to previous request */ +#define RTE_ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ +#define RTE_ARP_OP_REVREPLY 4 /* response giving protocol address */ +#define RTE_ARP_OP_INVREQUEST 8 /* request to identify peer */ +#define RTE_ARP_OP_INVREPLY 9 /* response identifying peer */ struct rte_arp_ipv4 arp_data; } __attribute__((__packed__)); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 03/14] net: add rte prefix to ether structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (2 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 02/14] net: add rte prefix to arp defines Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 04/14] net: add rte prefix to ether functions Olivier Matz ` (12 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct ether_addr as struct rte_ether_addr. - rename struct ether_hdr as struct rte_ether_hdr. - rename struct vlan_hdr as struct rte_vlan_hdr. - rename struct vxlan_hdr as struct rte_vxlan_hdr. - rename struct vxlan_gpe_hdr as struct rte_vxlan_gpe_hdr. Do not update the command line library to avoid adding a dependency to librte_net. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/pdump/main.c | 2 +- app/test-pipeline/pipeline_acl.c | 10 +- app/test-pipeline/pipeline_hash.c | 4 +- app/test-pmd/cmdline.c | 50 +++---- app/test-pmd/cmdline_flow.c | 2 +- app/test-pmd/config.c | 24 ++-- app/test-pmd/csumonly.c | 30 ++--- app/test-pmd/flowgen.c | 10 +- app/test-pmd/icmpecho.c | 18 +-- app/test-pmd/ieee1588fwd.c | 8 +- app/test-pmd/macfwd.c | 6 +- app/test-pmd/macswap.h | 6 +- app/test-pmd/macswap_common.h | 2 +- app/test-pmd/macswap_neon.h | 12 +- app/test-pmd/macswap_sse.h | 12 +- app/test-pmd/testpmd.c | 4 +- app/test-pmd/testpmd.h | 10 +- app/test-pmd/txonly.c | 14 +- app/test-pmd/util.c | 12 +- app/test/packet_burst_generator.c | 26 ++-- app/test/packet_burst_generator.h | 12 +- app/test/test_cmdline_etheraddr.c | 14 +- app/test/test_event_eth_rx_adapter.c | 2 +- app/test/test_event_eth_tx_adapter.c | 2 +- app/test/test_flow_classify.c | 34 ++--- app/test/test_link_bonding.c | 146 ++++++++++----------- app/test/test_link_bonding_mode4.c | 52 ++++---- app/test/test_link_bonding_rssconf.c | 2 +- app/test/test_pmd_perf.c | 10 +- app/test/test_sched.c | 12 +- app/test/virtual_pmd.c | 4 +- app/test/virtual_pmd.h | 2 +- doc/guides/prog_guide/bbdev.rst | 6 +- doc/guides/sample_app_ug/flow_classify.rst | 12 +- doc/guides/sample_app_ug/flow_filtering.rst | 6 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 8 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 4 +- .../sample_app_ug/l2_forward_real_virtual.rst | 4 +- doc/guides/sample_app_ug/l3_forward.rst | 8 +- doc/guides/sample_app_ug/link_status_intr.rst | 4 +- doc/guides/sample_app_ug/ptpclient.rst | 6 +- doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- doc/guides/sample_app_ug/server_node_efd.rst | 4 +- doc/guides/sample_app_ug/skeleton.rst | 2 +- doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- drivers/bus/dpaa/include/fman.h | 2 +- drivers/bus/dpaa/include/netcfg.h | 4 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +- drivers/net/ark/ark_ethdev.c | 12 +- drivers/net/ark/ark_ext.h | 4 +- drivers/net/ark/ark_global.h | 4 +- drivers/net/atlantic/atl_ethdev.c | 12 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- drivers/net/avp/avp_ethdev.c | 6 +- drivers/net/axgbe/axgbe_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x.c | 8 +- drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x_vfpf.c | 2 +- drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 6 +- drivers/net/bnxt/bnxt_hwrm.c | 4 +- drivers/net/bnxt/bnxt_hwrm.h | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 6 +- drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- drivers/net/bonding/rte_eth_bond.h | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 6 +- drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- drivers/net/bonding/rte_eth_bond_8023ad_private.h | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 24 ++-- drivers/net/bonding/rte_eth_bond_alb.h | 10 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_args.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 80 +++++------ drivers/net/bonding/rte_eth_bond_private.h | 6 +- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 18 +-- drivers/net/dpaa2/dpaa2_flow.c | 18 +-- drivers/net/e1000/em_ethdev.c | 14 +- drivers/net/e1000/igb_ethdev.c | 24 ++-- drivers/net/e1000/igb_pf.c | 4 +- drivers/net/ena/ena_ethdev.c | 8 +- drivers/net/enetc/enetc_ethdev.c | 2 +- drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_ethdev.c | 12 +- drivers/net/enic/enic_flow.c | 28 ++-- drivers/net/enic/enic_main.c | 4 +- drivers/net/failsafe/failsafe.c | 2 +- drivers/net/failsafe/failsafe_args.c | 2 +- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/failsafe/failsafe_private.h | 4 +- drivers/net/fm10k/fm10k_ethdev.c | 8 +- drivers/net/i40e/i40e_ethdev.c | 58 ++++---- drivers/net/i40e/i40e_ethdev.h | 20 +-- drivers/net/i40e/i40e_ethdev_vf.c | 30 ++--- drivers/net/i40e/i40e_fdir.c | 8 +- drivers/net/i40e/i40e_flow.c | 8 +- drivers/net/i40e/i40e_pf.c | 10 +- drivers/net/i40e/i40e_vf_representor.c | 2 +- drivers/net/i40e/rte_pmd_i40e.c | 14 +- drivers/net/i40e/rte_pmd_i40e.h | 8 +- drivers/net/iavf/iavf.h | 2 +- drivers/net/iavf/iavf_ethdev.c | 22 ++-- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_ethdev.c | 30 ++--- drivers/net/ice/ice_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_ethdev.c | 42 +++--- drivers/net/ixgbe/ixgbe_pf.c | 2 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4.h | 6 +- drivers/net/mlx4/mlx4_ethdev.c | 4 +- drivers/net/mlx4/mlx4_flow.c | 4 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mlx5/mlx5.h | 12 +- drivers/net/mlx5/mlx5_flow_dv.c | 16 +-- drivers/net/mlx5/mlx5_flow_tcf.c | 10 +- drivers/net/mlx5/mlx5_mac.c | 10 +- drivers/net/mlx5/mlx5_nl.c | 14 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mvneta/mvneta_ethdev.c | 4 +- drivers/net/mvpp2/mrvl_ethdev.c | 4 +- drivers/net/mvpp2/mrvl_flow.c | 2 +- drivers/net/netvsc/hn_ethdev.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 4 +- drivers/net/netvsc/hn_var.h | 4 +- drivers/net/netvsc/hn_vf.c | 6 +- drivers/net/nfp/nfp_net.c | 8 +- drivers/net/null/rte_eth_null.c | 4 +- drivers/net/octeontx/octeontx_ethdev.c | 2 +- drivers/net/pcap/rte_eth_pcap.c | 4 +- drivers/net/qede/qede_ethdev.c | 24 ++-- drivers/net/qede/qede_ethdev.h | 6 +- drivers/net/qede/qede_filter.c | 4 +- drivers/net/qede/qede_if.h | 2 +- drivers/net/qede/qede_rxtx.c | 14 +- drivers/net/ring/rte_eth_ring.c | 4 +- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ethdev.c | 10 +- drivers/net/sfc/sfc_port.c | 6 +- drivers/net/softnic/parser.c | 12 +- drivers/net/softnic/parser.h | 2 +- drivers/net/softnic/rte_eth_softnic.c | 2 +- drivers/net/szedata2/rte_eth_szedata2.c | 6 +- drivers/net/tap/rte_eth_tap.c | 18 +-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_bpf_program.c | 8 +- drivers/net/thunderx/base/nicvf_mbox.c | 4 +- drivers/net/thunderx/nicvf_ethdev.c | 4 +- drivers/net/vdev_netvsc/vdev_netvsc.c | 12 +- drivers/net/vhost/rte_eth_vhost.c | 8 +- drivers/net/virtio/virtio_ethdev.c | 18 +-- drivers/net/virtio/virtio_rxtx.c | 4 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 8 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 6 +- examples/bbdev_app/main.c | 38 +++--- examples/bond/main.c | 28 ++-- examples/distributor/main.c | 2 +- examples/ethtool/ethtool-app/ethapp.c | 4 +- examples/ethtool/ethtool-app/main.c | 6 +- examples/ethtool/lib/rte_ethtool.c | 6 +- examples/ethtool/lib/rte_ethtool.h | 6 +- examples/eventdev_pipeline/main.c | 2 +- examples/eventdev_pipeline/pipeline_common.h | 6 +- examples/flow_classify/flow_classify.c | 12 +- examples/flow_filtering/main.c | 6 +- examples/ip_fragmentation/main.c | 18 +-- examples/ip_pipeline/cli.c | 4 +- examples/ip_pipeline/parser.c | 12 +- examples/ip_pipeline/parser.h | 2 +- examples/ip_reassembly/main.c | 12 +- examples/ipsec-secgw/ipsec-secgw.c | 18 +-- examples/ipsec-secgw/ipsec.h | 2 +- examples/ipsec-secgw/parser.c | 4 +- examples/ipv4_multicast/main.c | 14 +- examples/kni/main.c | 8 +- examples/l2fwd-cat/l2fwd-cat.c | 2 +- examples/l2fwd-crypto/main.c | 12 +- examples/l2fwd-jobstats/main.c | 6 +- examples/l2fwd-keepalive/main.c | 6 +- examples/l2fwd/main.c | 6 +- examples/l3fwd-acl/main.c | 12 +- examples/l3fwd-power/main.c | 16 +-- examples/l3fwd-vf/main.c | 10 +- examples/l3fwd/l3fwd.h | 2 +- examples/l3fwd/l3fwd_altivec.h | 12 +- examples/l3fwd/l3fwd_em.c | 6 +- examples/l3fwd/l3fwd_em.h | 8 +- examples/l3fwd/l3fwd_em_hlm.h | 8 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 8 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 8 +- examples/l3fwd/l3fwd_em_sequential.h | 8 +- examples/l3fwd/l3fwd_lpm.c | 14 +- examples/l3fwd/l3fwd_lpm.h | 8 +- examples/l3fwd/l3fwd_lpm_altivec.h | 10 +- examples/l3fwd/l3fwd_lpm_neon.h | 20 +-- examples/l3fwd/l3fwd_lpm_sse.h | 10 +- examples/l3fwd/l3fwd_neon.h | 12 +- examples/l3fwd/l3fwd_sse.h | 12 +- examples/l3fwd/main.c | 8 +- examples/link_status_interrupt/main.c | 6 +- examples/load_balancer/runtime.c | 2 +- .../client_server_mp/mp_server/main.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 136 +++++++++---------- examples/ptpclient/ptpclient.c | 28 ++-- examples/qos_meter/main.c | 2 +- examples/quota_watermark/qw/main.c | 6 +- examples/rxtx_callbacks/main.c | 2 +- examples/server_node_efd/node/node.c | 2 +- examples/server_node_efd/server/main.c | 4 +- examples/skeleton/basicfwd.c | 2 +- examples/tep_termination/main.c | 2 +- examples/tep_termination/main.h | 2 +- examples/tep_termination/vxlan.c | 38 +++--- examples/tep_termination/vxlan.h | 6 +- examples/tep_termination/vxlan_setup.c | 6 +- examples/tep_termination/vxlan_setup.h | 2 +- examples/vhost/main.c | 24 ++-- examples/vhost/main.h | 2 +- examples/vm_power_manager/channel_monitor.c | 6 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/main.c | 4 +- examples/vmdq/main.c | 10 +- examples/vmdq_dcb/main.c | 10 +- lib/librte_ethdev/rte_class_eth.c | 2 +- lib/librte_ethdev/rte_eth_ctrl.h | 12 +- lib/librte_ethdev/rte_ethdev.c | 20 +-- lib/librte_ethdev/rte_ethdev.h | 12 +- lib/librte_ethdev/rte_ethdev_core.h | 12 +- lib/librte_ethdev/rte_flow.h | 12 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 6 +- lib/librte_gro/gro_tcp4.c | 4 +- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 12 +- lib/librte_gro/gro_vxlan_tcp4.h | 6 +- lib/librte_gso/rte_gso.h | 4 +- lib/librte_kni/rte_kni.c | 2 +- lib/librte_net/rte_arp.c | 6 +- lib/librte_net/rte_arp.h | 6 +- lib/librte_net/rte_ether.h | 64 ++++----- lib/librte_net/rte_net.c | 20 +-- lib/librte_pipeline/rte_table_action.c | 60 ++++----- lib/librte_pipeline/rte_table_action.h | 4 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/virtio_net.c | 10 +- 258 files changed, 1329 insertions(+), 1329 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index ae0cf282f..fbf9aa4fe 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -543,7 +543,7 @@ signal_handler(int sig_num) static inline int configure_vdev(uint16_t port_id) { - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rxRings = 0, txRings = 1; int ret; uint16_t q; diff --git a/app/test-pipeline/pipeline_acl.c b/app/test-pipeline/pipeline_acl.c index 524d2212d..8853d4376 100644 --- a/app/test-pipeline/pipeline_acl.c +++ b/app/test-pipeline/pipeline_acl.c @@ -39,7 +39,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, { @@ -47,7 +47,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, { @@ -55,7 +55,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, { @@ -63,14 +63,14 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr), + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index c20147234..3e4a0a1bb 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -441,14 +441,14 @@ app_main_loop_rx_metadata(void) { if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip_hdr = (struct ipv4_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { ipv6_hdr = (struct ipv6_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; memcpy(key, ipv6_dst, 16); diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 2ab03c111..032807378 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6031,7 +6031,7 @@ struct cmd_set_bond_mac_addr_result { cmdline_fixed_string_t bonding; cmdline_fixed_string_t mac_addr; uint16_t port_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_set_bond_mac_addr_parsed(void *parsed_result, @@ -7804,7 +7804,7 @@ struct cmd_mac_addr_result { cmdline_fixed_string_t mac_addr_cmd; cmdline_fixed_string_t what; uint16_t port_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_mac_addr_parsed(void *parsed_result, @@ -8003,7 +8003,7 @@ struct cmd_set_uc_hash_table { cmdline_fixed_string_t port; portid_t port_id; cmdline_fixed_string_t what; - struct ether_addr address; + struct rte_ether_addr address; cmdline_fixed_string_t mode; }; @@ -8127,7 +8127,7 @@ struct cmd_set_vf_macvlan_filter { portid_t port_id; cmdline_fixed_string_t vf; uint8_t vf_id; - struct ether_addr address; + struct rte_ether_addr address; cmdline_fixed_string_t filter_type; cmdline_fixed_string_t mode; }; @@ -8386,7 +8386,7 @@ struct cmd_vf_mac_addr_result { uint16_t port_num; cmdline_fixed_string_t vf; uint8_t vf_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_vf_mac_addr_parsed(void *parsed_result, @@ -8699,8 +8699,8 @@ struct cmd_tunnel_filter_result { cmdline_fixed_string_t cmd; cmdline_fixed_string_t what; portid_t port_id; - struct ether_addr outer_mac; - struct ether_addr inner_mac; + struct rte_ether_addr outer_mac; + struct rte_ether_addr inner_mac; cmdline_ipaddr_t ip_value; uint16_t inner_vlan; cmdline_fixed_string_t tunnel_type; @@ -10490,7 +10490,7 @@ struct cmd_ethertype_filter_result { portid_t port_id; cmdline_fixed_string_t ops; cmdline_fixed_string_t mac; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; cmdline_fixed_string_t ethertype; uint16_t ethertype_value; cmdline_fixed_string_t drop; @@ -10550,7 +10550,7 @@ cmd_ethertype_filter_parsed(void *parsed_result, if (!strcmp(res->mac, "mac_addr")) { filter.flags |= RTE_ETHTYPE_FLAGS_MAC; rte_memcpy(&filter.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } if (!strcmp(res->drop, "drop")) filter.flags |= RTE_ETHTYPE_FLAGS_DROP; @@ -10629,7 +10629,7 @@ struct cmd_flow_director_result { cmdline_fixed_string_t fd_id; uint32_t fd_id_value; cmdline_fixed_string_t mac; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; cmdline_fixed_string_t tunnel; cmdline_fixed_string_t tunnel_type; cmdline_fixed_string_t tunnel_id; @@ -10932,12 +10932,12 @@ cmd_flow_director_filter_parsed(void *parsed_result, if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) { rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); entry.input.flow.tunnel_flow.tunnel_type = str2fdir_tunneltype(res->tunnel_type); entry.input.flow.tunnel_flow.tunnel_id = @@ -12370,7 +12370,7 @@ struct cmd_mcast_addr_result { cmdline_fixed_string_t mcast_addr_cmd; cmdline_fixed_string_t what; uint16_t port_num; - struct ether_addr mc_addr; + struct rte_ether_addr mc_addr; }; static void cmd_mcast_addr_parsed(void *parsed_result, @@ -13789,7 +13789,7 @@ struct cmd_set_vf_mac_addr_result { cmdline_fixed_string_t addr; portid_t port_id; uint16_t vf_id; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; @@ -14094,7 +14094,7 @@ struct cmd_macsec_sc_result { cmdline_fixed_string_t sc; cmdline_fixed_string_t tx_rx; portid_t port_id; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t pi; }; @@ -15095,8 +15095,8 @@ struct cmd_set_vxlan_result { uint16_t tci; uint8_t tos; uint8_t ttl; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_vxlan_set = @@ -15318,8 +15318,8 @@ struct cmd_set_nvgre_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_nvgre_set = @@ -15464,8 +15464,8 @@ struct cmd_set_l2_encap_result { cmdline_fixed_string_t ip_version; uint32_t vlan_present:1; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_l2_encap_set = @@ -15621,8 +15621,8 @@ struct cmd_set_mplsogre_encap_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_mplsogre_encap_set = @@ -15845,8 +15845,8 @@ struct cmd_set_mplsoudp_encap_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_mplsoudp_encap_set = diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 1c83bc9bc..1b7fbd02c 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -4488,7 +4488,7 @@ parse_mac_addr(struct context *ctx, const struct token *token, void *buf, unsigned int size) { const struct arg *arg = pop_args(ctx); - struct ether_addr tmp; + struct rte_ether_addr tmp; int ret; (void)token; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index f9cb12964..83b9df103 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -108,7 +108,7 @@ const struct rss_type_info rss_type_table[] = { }; static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -391,7 +391,7 @@ void port_infos_display(portid_t port_id) { struct rte_port *port; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link link; struct rte_eth_dev_info dev_info; int vlan_offload; @@ -538,7 +538,7 @@ port_summary_header_display(void) void port_summary_display(portid_t port_id) { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link link; struct rte_eth_dev_info dev_info; char name[RTE_ETH_NAME_MAX_LEN]; @@ -2519,7 +2519,7 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) * Check that each segment length is greater or equal than * the mbuf data sise. * Check also that the total packet length is greater or equal than the - * size of an empty UDP/IP packet (sizeof(struct ether_hdr) + 20 + 8). + * size of an empty UDP/IP packet (sizeof(struct rte_ether_hdr) + 20 + 8). */ tx_pkt_len = 0; for (i = 0; i < nb_segs; i++) { @@ -2530,10 +2530,10 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) } tx_pkt_len = (uint16_t)(tx_pkt_len + seg_lengths[i]); } - if (tx_pkt_len < (sizeof(struct ether_hdr) + 20 + 8)) { + if (tx_pkt_len < (sizeof(struct rte_ether_hdr) + 20 + 8)) { printf("total packet length=%u < %d - give up\n", (unsigned) tx_pkt_len, - (int)(sizeof(struct ether_hdr) + 20 + 8)); + (int)(sizeof(struct rte_ether_hdr) + 20 + 8)); return; } @@ -3453,7 +3453,7 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) static int mcast_addr_pool_extend(struct rte_port *port) { - struct ether_addr *mc_pool; + struct rte_ether_addr *mc_pool; size_t mc_pool_size; /* @@ -3470,9 +3470,9 @@ mcast_addr_pool_extend(struct rte_port *port) * The previous test guarantees that port->mc_addr_nb is a multiple * of MCAST_POOL_INC. */ - mc_pool_size = sizeof(struct ether_addr) * (port->mc_addr_nb + + mc_pool_size = sizeof(struct rte_ether_addr) * (port->mc_addr_nb + MCAST_POOL_INC); - mc_pool = (struct ether_addr *) realloc(port->mc_addr_pool, + mc_pool = (struct rte_ether_addr *) realloc(port->mc_addr_pool, mc_pool_size); if (mc_pool == NULL) { printf("allocation of pool of %u multicast addresses failed\n", @@ -3501,7 +3501,7 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx) } memmove(&port->mc_addr_pool[addr_idx], &port->mc_addr_pool[addr_idx + 1], - sizeof(struct ether_addr) * (port->mc_addr_nb - addr_idx)); + sizeof(struct rte_ether_addr) * (port->mc_addr_nb - addr_idx)); } static void @@ -3520,7 +3520,7 @@ eth_port_multicast_addr_list_set(portid_t port_id) } void -mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr) +mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) { struct rte_port *port; uint32_t i; @@ -3548,7 +3548,7 @@ mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr) } void -mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr) +mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr) { struct rte_port *port; uint32_t i; diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index f4f2a7b29..1a7db7f0e 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -142,18 +142,18 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) * header. The l4_len argument is only set in case of TCP (useful for TSO). */ static void -parse_ethernet(struct ether_hdr *eth_hdr, struct testpmd_offload_info *info) +parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - info->l2_len = sizeof(struct ether_hdr); + info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; if (info->ethertype == _htons(ETHER_TYPE_VLAN)) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - info->l2_len += sizeof(struct vlan_hdr); + info->l2_len += sizeof(struct rte_vlan_hdr); info->ethertype = vlan_hdr->eth_proto; } @@ -180,7 +180,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info, uint32_t pkt_type) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; /* check udp destination port, 4789 is the default vxlan port * (rfc7348) or that the rx offload flag is set (i40e only @@ -195,9 +195,9 @@ parse_vxlan(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)udp_hdr + + eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr) + - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); info->l2_len += ETHER_VXLAN_HLEN; /* add udp + vxlan */ @@ -208,17 +208,17 @@ static void parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - struct vxlan_gpe_hdr *vxlan_gpe_hdr; + struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); /* Check udp destination port. */ if (udp_hdr->dst_port != _htons(vxlan_gpe_udp_port)) return; - vxlan_gpe_hdr = (struct vxlan_gpe_hdr *)((char *)udp_hdr + + vxlan_gpe_hdr = (struct rte_vxlan_gpe_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == @@ -257,7 +257,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)vxlan_gpe_hdr + + eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ethernet(eth_hdr, info); @@ -271,7 +271,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; @@ -318,7 +318,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)gre_hdr + gre_len); + eth_hdr = (struct rte_ether_hdr *)((char *)gre_hdr + gre_len); parse_ethernet(eth_hdr, info); } else @@ -691,7 +691,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) struct rte_mbuf **tx_pkts_burst; struct rte_port *txp; struct rte_mbuf *m, *p; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; void *l3_hdr = NULL, *outer_l3_hdr = NULL; /* can be IPv4 or IPv6 */ void **gro_ctx; uint16_t gro_pkts_num; @@ -765,7 +765,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* step 1: dissect packet, parsing optional vlan, ip4/ip6, vxlan * and inner headers */ - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 3214e3c95..7c6ad4b3c 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -76,9 +76,9 @@ static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; -static struct ether_addr cfg_ether_src = +static struct rte_ether_addr cfg_ether_src = {{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x00 }}; -static struct ether_addr cfg_ether_dst = +static struct rte_ether_addr cfg_ether_dst = {{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x01 }}; #define IP_DEFTTL 64 /* from RFC 1340. */ @@ -119,7 +119,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mempool *mbp; struct rte_mbuf *pkt; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; @@ -170,7 +170,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->next = NULL; /* Initialize Ethernet header. */ - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); @@ -205,7 +205,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; - pkt->l2_len = sizeof(struct ether_hdr); + pkt->l2_len = sizeof(struct rte_ether_hdr); pkt->l3_len = sizeof(struct ipv4_hdr); pkts_burst[nb_pkt] = pkt; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 062e3ea43..49720ad41 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -221,7 +221,7 @@ ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf) } static void -ether_addr_dump(const char *what, const struct ether_addr *ea) +ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { char buf[ETHER_ADDR_FMT_SIZE]; @@ -275,12 +275,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *pkt; - struct ether_hdr *eth_h; - struct vlan_hdr *vlan_h; + struct rte_ether_hdr *eth_h; + struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; struct icmp_hdr *icmp_h; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; uint16_t nb_rx; @@ -321,9 +321,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); pkt = pkts_burst[i]; - eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_h->ether_type); - l2_len = sizeof(struct ether_hdr); + l2_len = sizeof(struct rte_ether_hdr); if (verbose_level > 0) { printf("\nPort %d pkt-len=%u nb-segs=%u\n", fs->rx_port, pkt->pkt_len, pkt->nb_segs); @@ -331,9 +331,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_dump(" dst=", ð_h->d_addr); } if (eth_type == ETHER_TYPE_VLAN) { - vlan_h = (struct vlan_hdr *) - ((char *)eth_h + sizeof(struct ether_hdr)); - l2_len += sizeof(struct vlan_hdr); + vlan_h = (struct rte_vlan_hdr *) + ((char *)eth_h + sizeof(struct rte_ether_hdr)); + l2_len += sizeof(struct rte_vlan_hdr); eth_type = rte_be_to_cpu_16(vlan_h->eth_proto); if (verbose_level > 0) { vlan_id = rte_be_to_cpu_16(vlan_h->vlan_tci) diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index 6ae802c86..c6aa3c618 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -93,8 +93,8 @@ static void ieee1588_packet_fwd(struct fwd_stream *fs) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; - struct ether_addr addr; + struct rte_ether_hdr *eth_hdr; + struct rte_ether_addr addr; struct ptpv2_msg *ptp_hdr; uint16_t eth_type; uint32_t timesync_index; @@ -111,7 +111,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * Check that the received packet is a PTP packet that was detected * by the hardware. */ - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) { @@ -141,7 +141,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * PTP_SYNC_MESSAGE. */ ptp_hdr = (struct ptpv2_msg *) (rte_pktmbuf_mtod(mb, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (ptp_hdr->version != 0x02) { printf("Port %u Received PTP V2 Ethernet frame with wrong PTP" " protocol version 0x%x (should be 0x02)\n", diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 7cac757a0..631f86f3e 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -49,7 +49,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_port *txp; struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t retry; uint16_t nb_rx; uint16_t nb_tx; @@ -91,14 +91,14 @@ pkt_burst_mac_forward(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); mb = pkts_burst[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; - mb->l2_len = sizeof(struct ether_hdr); + mb->l2_len = sizeof(struct rte_ether_hdr); mb->l3_len = sizeof(struct ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; diff --git a/app/test-pmd/macswap.h b/app/test-pmd/macswap.h index bfa9b0eda..d53e5d482 100644 --- a/app/test-pmd/macswap.h +++ b/app/test-pmd/macswap.h @@ -11,9 +11,9 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_mbuf *mb; - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t ol_flags; int i; @@ -26,7 +26,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb = pkts[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ ether_addr_copy(ð_hdr->d_addr, &addr); diff --git a/app/test-pmd/macswap_common.h b/app/test-pmd/macswap_common.h index 19754cdd1..56f86baad 100644 --- a/app/test-pmd/macswap_common.h +++ b/app/test-pmd/macswap_common.h @@ -39,7 +39,7 @@ mbuf_field_set(struct rte_mbuf *mb, uint64_t ol_flags) { mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; - mb->l2_len = sizeof(struct ether_hdr); + mb->l2_len = sizeof(struct rte_ether_hdr); mb->l3_len = sizeof(struct ipv4_hdr); } diff --git a/app/test-pmd/macswap_neon.h b/app/test-pmd/macswap_neon.h index bdf416aa2..df6c260cd 100644 --- a/app/test-pmd/macswap_neon.h +++ b/app/test-pmd/macswap_neon.h @@ -16,7 +16,7 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr[4]; + struct rte_ether_hdr *eth_hdr[4]; struct rte_mbuf *mb[4]; uint64_t ol_flags; int i; @@ -46,16 +46,16 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, } mb[0] = pkts[i++]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); mb[1] = pkts[i++]; - eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct rte_ether_hdr *); mb[2] = pkts[i++]; - eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct rte_ether_hdr *); mb[3] = pkts[i++]; - eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct rte_ether_hdr *); v0 = vld1q_u8((uint8_t const *)eth_hdr[0]); v1 = vld1q_u8((uint8_t const *)eth_hdr[1]); @@ -83,7 +83,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, if (i < nb - 1) rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb[0] = pkts[i]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ v0 = vld1q_u8((uint8_t const *)eth_hdr[0]); diff --git a/app/test-pmd/macswap_sse.h b/app/test-pmd/macswap_sse.h index 2b6e7324d..223f87a53 100644 --- a/app/test-pmd/macswap_sse.h +++ b/app/test-pmd/macswap_sse.h @@ -11,7 +11,7 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr[4]; + struct rte_ether_hdr *eth_hdr[4]; struct rte_mbuf *mb[4]; uint64_t ol_flags; int i; @@ -43,20 +43,20 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, } mb[0] = pkts[i++]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); addr0 = _mm_loadu_si128((__m128i *)eth_hdr[0]); mb[1] = pkts[i++]; - eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct rte_ether_hdr *); addr1 = _mm_loadu_si128((__m128i *)eth_hdr[1]); mb[2] = pkts[i++]; - eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct rte_ether_hdr *); addr2 = _mm_loadu_si128((__m128i *)eth_hdr[2]); mb[3] = pkts[i++]; - eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct rte_ether_hdr *); addr3 = _mm_loadu_si128((__m128i *)eth_hdr[3]); addr0 = _mm_shuffle_epi8(addr0, shfl_msk); @@ -80,7 +80,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, if (i < nb - 1) rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb[0] = pkts[i]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ addr0 = _mm_loadu_si128((__m128i *)eth_hdr[0]); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index aeaa74c98..831221c99 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -137,7 +137,7 @@ uint8_t txring_numa[RTE_MAX_ETHPORTS]; * Must be instantiated with the ethernet addresses of peer traffic generator * ports. */ -struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; +struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; portid_t nb_peer_eth_addrs = 0; /* @@ -1953,7 +1953,7 @@ start_port(portid_t pid) portid_t pi; queueid_t qi; struct rte_port *port; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; if (port_id_is_invalid(pid, ENABLED_WARN)) return 0; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index a45988ebc..2f1780216 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -162,7 +162,7 @@ struct softnic_port { struct rte_port { struct rte_eth_dev_info dev_info; /**< PCI info + driver name */ struct rte_eth_conf dev_conf; /**< Port configuration. */ - struct ether_addr eth_addr; /**< Port ethernet address */ + struct rte_ether_addr eth_addr; /**< Port ethernet address */ struct rte_eth_stats stats; /**< Last port statistics */ unsigned int socket_id; /**< For NUMA support */ uint16_t parse_tunnel:1; /**< Parse internal headers */ @@ -182,7 +182,7 @@ struct rte_port { uint16_t nb_tx_desc[MAX_QUEUE_ID+1]; /**< per queue tx desc number */ struct rte_eth_rxconf rx_conf[MAX_QUEUE_ID+1]; /**< per queue rx configuration */ struct rte_eth_txconf tx_conf[MAX_QUEUE_ID+1]; /**< per queue tx configuration */ - struct ether_addr *mc_addr_pool; /**< pool of multicast addrs */ + struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */ struct port_flow *flow_list; /**< Associated flows. */ @@ -452,7 +452,7 @@ extern struct fwd_stream **fwd_streams; extern uint16_t vxlan_gpe_udp_port; /**< UDP port of tunnel VXLAN-GPE. */ extern portid_t nb_peer_eth_addrs; /**< Number of peer ethernet addresses. */ -extern struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for mac-retry. */ extern uint32_t burst_tx_retry_num; /**< Burst tx retry number for mac-retry. */ @@ -811,8 +811,8 @@ void show_gro(portid_t port_id); void setup_gso(const char *mode, portid_t port_id); /* Functions to manage the set of filtered Multicast MAC addresses */ -void mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr); -void mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr); +void mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr); +void mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr); void port_dcb_info_display(portid_t port_id); uint8_t *open_file(const char *file_path, uint32_t *size); diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 66e63788a..c4e891a13 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -150,7 +150,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, static inline bool pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, - struct ether_hdr *eth_hdr, const uint16_t vlan_tci, + struct rte_ether_hdr *eth_hdr, const uint16_t vlan_tci, const uint16_t vlan_tci_outer, const uint64_t ol_flags) { struct rte_mbuf *pkt_segs[RTE_MAX_SEGS_PER_PKT]; @@ -174,7 +174,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; - pkt->l2_len = sizeof(struct ether_hdr); + pkt->l2_len = sizeof(struct rte_ether_hdr); pkt->l3_len = sizeof(struct ipv4_hdr); pkt_len = pkt->data_len; @@ -191,14 +191,14 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, */ copy_buf_to_pkt(eth_hdr, sizeof(eth_hdr), pkt, 0); copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (txonly_multi_flow) { struct ipv4_hdr *ip_hdr; uint32_t addr; ip_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* * Generate multiple flows by varying IP src addr. This * enables packets are well distributed by RSS in @@ -210,7 +210,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, ip_hdr->src_addr = rte_cpu_to_be_32(addr); } copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr)); /* * Complete first mbuf of packet and append it to the @@ -232,7 +232,7 @@ pkt_burst_transmit(struct fwd_stream *fs) struct rte_port *txp; struct rte_mbuf *pkt; struct rte_mempool *mbp; - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; uint16_t nb_tx; uint16_t nb_pkt; uint16_t vlan_tci, vlan_tci_outer; @@ -345,7 +345,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) { uint16_t pkt_data_len; - pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct ether_hdr) + + pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 6b0791daa..0544b8e53 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -14,7 +14,7 @@ #include "testpmd.h" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -26,7 +26,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, int is_rx) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; uint64_t ol_flags; uint16_t i, packet_type; @@ -46,7 +46,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], (unsigned int) nb_pkts); for (i = 0; i < nb_pkts; i++) { mb = pkts[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type); ol_flags = mb->ol_flags; packet_type = mb->packet_type; @@ -110,9 +110,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint8_t l3_len; uint8_t l4_len; uint8_t l4_proto; - struct vxlan_hdr *vxlan_hdr; + struct rte_vxlan_hdr *vxlan_hdr; - l2_len = sizeof(struct ether_hdr); + l2_len = sizeof(struct rte_ether_hdr); /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { @@ -134,7 +134,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], l2_len + l3_len); l4_len = sizeof(struct udp_hdr); vxlan_hdr = rte_pktmbuf_mtod_offset(mb, - struct vxlan_hdr *, + struct rte_vxlan_hdr *, l2_len + l3_len + l4_len); udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port); vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index ccc0bd591..51ab0db29 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -53,16 +53,16 @@ copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } void -initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t ether_type, +initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id) { ether_addr_copy(dst_mac, ð_hdr->d_addr); ether_addr_copy(src_mac, ð_hdr->s_addr); if (vlan_enabled) { - struct vlan_hdr *vhdr = (struct vlan_hdr *)((uint8_t *)eth_hdr + - sizeof(struct ether_hdr)); + 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); @@ -74,8 +74,8 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, } void -initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); @@ -256,7 +256,7 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { @@ -293,9 +293,9 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, * Copy headers in first packet segment(s). */ if (vlan_enabled) - eth_hdr_size = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr); else - eth_hdr_size = sizeof(struct ether_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr); copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); @@ -334,7 +334,7 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, int generate_packet_burst_proto(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, uint8_t proto, void *proto_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { @@ -371,10 +371,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, * Copy headers in first packet segment(s). */ if (vlan_enabled) - eth_hdr_size = sizeof(struct ether_hdr) + - sizeof(struct vlan_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr); else - eth_hdr_size = sizeof(struct ether_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr); copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index b6e013a11..8489212d0 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -24,13 +24,13 @@ extern "C" { #define PACKET_BURST_GEN_PKT_LEN_128 128 void -initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t ether_type, +initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id); void -initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); uint16_t @@ -59,14 +59,14 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); int generate_packet_burst_proto(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, uint8_t proto, void *proto_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); diff --git a/app/test/test_cmdline_etheraddr.c b/app/test/test_cmdline_etheraddr.c index 086108ab2..90943c2b4 100644 --- a/app/test/test_cmdline_etheraddr.c +++ b/app/test/test_cmdline_etheraddr.c @@ -82,7 +82,7 @@ const char * ether_addr_invalid_strs[] = { static int -is_addr_different(const struct ether_addr addr, uint64_t num) +is_addr_different(const struct rte_ether_addr addr, uint64_t num) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++, num >>= 8) @@ -97,7 +97,7 @@ int test_parse_etheraddr_invalid_param(void) { char buf[CMDLINE_TEST_BUFSIZE]; - struct ether_addr result; + struct rte_ether_addr result; int ret = 0; /* try all null */ @@ -148,12 +148,12 @@ test_parse_etheraddr_invalid_data(void) { int ret = 0; unsigned i; - struct ether_addr result; + struct rte_ether_addr result; /* test full strings */ for (i = 0; i < ETHERADDR_INVALID_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_invalid_strs[i], (void*)&result, sizeof(result)); @@ -173,12 +173,12 @@ test_parse_etheraddr_valid(void) { int ret = 0; unsigned i; - struct ether_addr result; + struct rte_ether_addr result; /* test full strings */ for (i = 0; i < ETHERADDR_VALID_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_valid_strs[i].str, (void*)&result, sizeof(result)); @@ -197,7 +197,7 @@ test_parse_etheraddr_valid(void) /* test garbage strings */ for (i = 0; i < ETHERADDR_GARBAGE_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_garbage_strs[i], (void*)&result, sizeof(result)); diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index 38f5c039f..953b82745 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -78,7 +78,7 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf, return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c index c26c5152c..208d20c53 100644 --- a/app/test/test_event_eth_tx_adapter.c +++ b/app/test/test_event_eth_tx_adapter.c @@ -84,7 +84,7 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf, return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 5f5beeee7..f81bbba3a 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -39,7 +39,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -49,7 +49,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -59,7 +59,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -72,7 +72,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -82,7 +82,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -489,7 +489,7 @@ static int init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); @@ -503,9 +503,9 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, printf("Set up IPv4 UDP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, src_addr, dst_addr, @@ -526,7 +526,7 @@ static int init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); @@ -540,9 +540,9 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, printf("Set up IPv4 TCP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, @@ -563,7 +563,7 @@ static int init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); @@ -577,9 +577,9 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, printf("Set up IPv4 SCTP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 2c20f44ea..25276715a 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -73,11 +73,11 @@ struct link_bonding_unittest_params { struct rte_mempool *mbuf_pool; - struct ether_addr *default_slave_mac; - struct ether_addr *default_bonded_mac; + struct rte_ether_addr *default_slave_mac; + struct rte_ether_addr *default_bonded_mac; /* Packet Headers */ - struct ether_hdr *pkt_eth_hdr; + struct rte_ether_hdr *pkt_eth_hdr; struct ipv4_hdr *pkt_ipv4_hdr; struct ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; @@ -99,8 +99,8 @@ static struct link_bonding_unittest_params default_params = { .mbuf_pool = NULL, - .default_slave_mac = (struct ether_addr *)slave_mac, - .default_bonded_mac = (struct ether_addr *)bonded_mac, + .default_slave_mac = (struct rte_ether_addr *)slave_mac, + .default_bonded_mac = (struct rte_ether_addr *)bonded_mac, .pkt_eth_hdr = NULL, .pkt_ipv4_hdr = &pkt_ipv4_hdr, @@ -210,12 +210,12 @@ static int test_setup(void) { int i, nb_mbuf_per_pool; - struct ether_addr *mac_addr = (struct ether_addr *)slave_mac; + struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)slave_mac; /* Allocate ethernet packet header with space for VLAN header */ if (test_params->pkt_eth_hdr == NULL) { - test_params->pkt_eth_hdr = malloc(sizeof(struct ether_hdr) + - sizeof(struct vlan_hdr)); + test_params->pkt_eth_hdr = malloc(sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr)); TEST_ASSERT_NOT_NULL(test_params->pkt_eth_hdr, "Ethernet header struct allocation failed!"); @@ -376,7 +376,7 @@ static int test_remove_slave_from_bonded_device(void) { int current_slave_count; - struct ether_addr read_mac_addr, *mac_addr; + struct rte_ether_addr read_mac_addr, *mac_addr; uint16_t slaves[RTE_MAX_ETHPORTS]; TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(test_params->bonded_port_id, @@ -394,7 +394,7 @@ test_remove_slave_from_bonded_device(void) current_slave_count, test_params->bonded_slave_count - 1); - mac_addr = (struct ether_addr *)slave_mac; + mac_addr = (struct rte_ether_addr *)slave_mac; mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = test_params->bonded_slave_count-1; @@ -699,8 +699,8 @@ static int test_set_primary_slave(void) { int i, j, retval; - struct ether_addr read_mac_addr; - struct ether_addr *expected_mac_addr; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr *expected_mac_addr; /* Add 4 slaves to bonded device */ for (i = test_params->bonded_slave_count; i < 4; i++) @@ -750,7 +750,7 @@ test_set_primary_slave(void) "Failed to start bonded port %d", test_params->bonded_port_id); - expected_mac_addr = (struct ether_addr *)&slave_mac; + expected_mac_addr = (struct rte_ether_addr *)&slave_mac; expected_mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; /* Check primary slave MAC */ @@ -801,12 +801,12 @@ static int test_set_explicit_bonded_mac(void) { int i; - struct ether_addr read_mac_addr; - struct ether_addr *mac_addr; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr *mac_addr; uint8_t explicit_bonded_mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x01 }; - mac_addr = (struct ether_addr *)explicit_bonded_mac; + mac_addr = (struct rte_ether_addr *)explicit_bonded_mac; /* Invalid port ID */ TEST_ASSERT_FAIL(rte_eth_bond_mac_address_set(INVALID_PORT_ID, mac_addr), @@ -878,11 +878,11 @@ test_set_bonded_port_initialization_mac_assignment(void) uint16_t slaves[RTE_MAX_ETHPORTS]; int slave_port_ids[BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT]; - struct ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; + struct rte_ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; /* Initialize default values for MAC addresses */ - memcpy(&slave_mac_addr, slave_mac, sizeof(struct ether_addr)); - memcpy(&bonded_mac_addr, slave_mac, sizeof(struct ether_addr)); + memcpy(&slave_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); + memcpy(&bonded_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); /* * 1. a - Create / configure bonded / slave ethdevs @@ -1268,11 +1268,11 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, if (toggle_dst_mac) initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_1, ether_type, vlan, vlan_id); else initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ether_type, vlan, vlan_id); @@ -1663,7 +1663,7 @@ test_roundrobin_rx_burst_on_multiple_slaves(void) static int test_roundrobin_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_2; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_2; int i; @@ -1722,7 +1722,7 @@ test_roundrobin_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "Failed to set MAC"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -1931,7 +1931,7 @@ int polling_test_slaves[TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT] = { -1, -1 }; static int test_roundrobin_verfiy_polling_slave_link_status_change(void) { - struct ether_addr *mac_addr = (struct ether_addr *)polling_slave_mac; + struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)polling_slave_mac; char slave_name[RTE_ETH_NAME_MAX_LEN]; int i; @@ -2030,7 +2030,7 @@ test_activebackup_tx_burst(void) "Failed to initialize bonded device with slaves"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -2237,7 +2237,7 @@ test_activebackup_verify_promiscuous_enable_disable(void) static int test_activebackup_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -2319,7 +2319,7 @@ test_activebackup_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -2564,7 +2564,7 @@ test_balance_l2_tx_burst(void) "Failed to set balance xmit policy."); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -2579,7 +2579,7 @@ test_balance_l2_tx_burst(void) "failed to generate packet burst"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_1, ETHER_TYPE_IPv4, 0, 0); /* Generate a burst 2 of packets to transmit */ @@ -3129,7 +3129,7 @@ test_balance_verify_promiscuous_enable_disable(void) static int test_balance_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -3211,7 +3211,7 @@ test_balance_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -3402,7 +3402,7 @@ test_broadcast_tx_burst(void) "Failed to initialise bonded device"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, @@ -3713,7 +3713,7 @@ test_broadcast_verify_promiscuous_enable_disable(void) static int test_broadcast_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; int i; @@ -3774,7 +3774,7 @@ test_broadcast_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "Failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -3985,12 +3985,12 @@ test_tlb_tx_burst(void) /*test two types of mac src own(bonding) and others */ if (i % 2 == 0) { initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); } else { initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)test_params->default_slave_mac, - (struct ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)test_params->default_slave_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); } pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -4201,7 +4201,7 @@ test_tlb_verify_promiscuous_enable_disable(void) static int test_tlb_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -4284,7 +4284,7 @@ test_tlb_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -4459,14 +4459,14 @@ test_alb_change_mac_in_reply_sent(void) struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; - struct ether_hdr *eth_pkt; + struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; int slave_idx, nb_pkts, pkt_idx; int retval = 0; - struct ether_addr bond_mac, client_mac; - struct ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr bond_mac, client_mac; + struct rte_ether_addr *slave_mac1, *slave_mac2; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4492,40 +4492,40 @@ test_alb_change_mac_in_reply_sent(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4545,8 +4545,8 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4570,7 +4570,7 @@ test_alb_change_mac_in_reply_sent(void) static int test_alb_reply_from_client(void) { - struct ether_hdr *eth_pkt; + struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; @@ -4579,8 +4579,8 @@ test_alb_reply_from_client(void) int slave_idx, nb_pkts, pkt_idx, nb_pkts_sum = 0; int retval = 0; - struct ether_addr bond_mac, client_mac; - struct ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr bond_mac, client_mac; + struct rte_ether_addr *slave_mac1, *slave_mac2; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4605,10 +4605,10 @@ test_alb_reply_from_client(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4616,10 +4616,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client2, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4627,10 +4627,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client3, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4638,10 +4638,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client4, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4666,8 +4666,8 @@ test_alb_reply_from_client(void) nb_pkts_sum += nb_pkts; for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4697,8 +4697,8 @@ test_alb_reply_from_client(void) static int test_alb_receive_vlan_reply(void) { - struct ether_hdr *eth_pkt; - struct vlan_hdr *vlan_pkt; + struct rte_ether_hdr *eth_pkt; + struct rte_vlan_hdr *vlan_pkt; struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; @@ -4707,7 +4707,7 @@ test_alb_receive_vlan_reply(void) int slave_idx, nb_pkts, pkt_idx; int retval = 0; - struct ether_addr bond_mac, client_mac; + struct rte_ether_addr bond_mac, client_mac; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4731,10 +4731,10 @@ test_alb_receive_vlan_reply(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_VLAN, 0, 0); - vlan_pkt = (struct vlan_hdr *)((char *)(eth_pkt + 1)); + 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 = vlan_pkt+1; @@ -4758,8 +4758,8 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - vlan_pkt = (struct vlan_hdr *)((char *)(eth_pkt + 1)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + vlan_pkt = (struct rte_vlan_hdr *)((char *)(eth_pkt + 1)); if (vlan_pkt->vlan_tci != rte_cpu_to_be_16(1)) { retval = -1; goto test_end; diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index e539f078d..63fcafaea 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -54,19 +54,19 @@ #define INVALID_PORT_ID (0xFF) #define INVALID_BONDING_MODE (-1) -static const struct ether_addr slave_mac_default = { +static const struct rte_ether_addr slave_mac_default = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; -static const struct ether_addr parnter_mac_default = { +static const struct rte_ether_addr parnter_mac_default = { { 0x22, 0xBB, 0xFF, 0xBB, 0x00, 0x00 } }; -static const struct ether_addr parnter_system = { +static const struct rte_ether_addr parnter_system = { { 0x33, 0xFF, 0xBB, 0xFF, 0x00, 0x00 } }; -static const struct ether_addr slow_protocol_mac_addr = { +static const struct rte_ether_addr slow_protocol_mac_addr = { { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; @@ -80,8 +80,8 @@ struct slave_conf { }; struct ether_vlan_hdr { - struct ether_hdr pkt_eth_hdr; - struct vlan_hdr vlan_hdr; + struct rte_ether_hdr pkt_eth_hdr; + struct rte_vlan_hdr vlan_hdr; }; struct link_bonding_unittest_params { @@ -224,7 +224,7 @@ configure_ethdev(uint16_t port_id, uint8_t start) static int add_slave(struct slave_conf *slave, uint8_t start) { - struct ether_addr addr, addr_check; + struct rte_ether_addr addr, addr_check; /* Some sanity check */ RTE_VERIFY(test_params.slave_ports <= slave && @@ -293,12 +293,12 @@ remove_slave(struct slave_conf *slave) static void lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) { - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; RTE_VERIFY(lacp_pkt != NULL); - hdr = rte_pktmbuf_mtod(lacp_pkt, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(lacp_pkt, struct rte_ether_hdr *); RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_SLOW)); slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *); @@ -474,12 +474,12 @@ testsuite_teardown(void) static int make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) { - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; struct lacpdu *lacp; /* look for LACP */ - hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW)) return 1; @@ -718,8 +718,8 @@ test_mode4_agg_mode_selection(void) } static int -generate_packets(struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf) +generate_packets(struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf) { uint16_t pktlen = PACKET_BURST_GEN_PKT_LEN; uint8_t vlan_enable = 0; @@ -731,7 +731,7 @@ generate_packets(struct ether_addr *src_mac, uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { struct ipv4_hdr v4; @@ -765,8 +765,8 @@ generate_packets(struct ether_addr *src_mac, } static int -generate_and_put_packets(struct slave_conf *slave, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t count) +generate_and_put_packets(struct slave_conf *slave, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t count) { struct rte_mbuf *pkts[MAX_PKT_BURST]; int retval; @@ -796,11 +796,11 @@ test_mode4_rx(void) int retval; unsigned delay; - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; - struct ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; - struct ether_addr dst_mac; - struct ether_addr bonded_mac; + struct rte_ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; + struct rte_ether_addr dst_mac; + struct rte_ether_addr bonded_mac; retval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, 0); @@ -844,7 +844,7 @@ test_mode4_rx(void) int cnt[2] = { 0, 0 }; for (i = 0; i < expected_pkts_cnt; i++) { - hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; } @@ -888,7 +888,7 @@ test_mode4_rx(void) int eq_cnt = 0; for (i = 0; i < expected_pkts_cnt; i++) { - hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac); } @@ -977,8 +977,8 @@ test_mode4_tx_burst(void) int retval; unsigned delay; - struct ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; - struct ether_addr bonded_mac; + struct rte_ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; + struct rte_ether_addr bonded_mac; retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -1351,7 +1351,7 @@ test_mode4_ext_ctrl(void) uint8_t i; struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; - struct ether_addr src_mac, dst_mac; + struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { .subtype = SLOW_SUBTYPE_LACP, @@ -1405,7 +1405,7 @@ test_mode4_ext_lacp(void) struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; struct rte_mbuf *buf[SLAVE_COUNT]; - struct ether_addr src_mac, dst_mac; + struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { .subtype = SLOW_SUBTYPE_LACP, diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c index d82de2cef..4392522ea 100644 --- a/app/test/test_link_bonding_rssconf.c +++ b/app/test/test_link_bonding_rssconf.c @@ -495,7 +495,7 @@ test_setup(void) int port_id; char name[256]; struct slave_conf *port; - struct ether_addr mac_addr = { .addr_bytes = {0} }; + struct rte_ether_addr mac_addr = { .addr_bytes = {0} }; if (test_params.mbuf_pool == NULL) { diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index ed8524a17..b85da914c 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -58,7 +58,7 @@ static struct rte_mempool *mbufpool[NB_SOCKETS]; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { @@ -171,7 +171,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -182,7 +182,7 @@ static int init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; @@ -191,8 +191,8 @@ init_traffic(struct rte_mempool *mp, initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, 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 40e411cab..c4554aa74 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -78,15 +78,15 @@ create_mempool(void) static void prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) { - struct ether_hdr *eth_hdr; - struct vlan_hdr *vlan1, *vlan2; + struct rte_ether_hdr *eth_hdr; + struct rte_vlan_hdr *vlan1, *vlan2; struct ipv4_hdr *ip_hdr; /* Simulate a classifier */ - eth_hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); - vlan1 = (struct vlan_hdr *)(ð_hdr->ether_type ); - vlan2 = (struct vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct vlan_hdr)); - eth_hdr = (struct ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct vlan_hdr)); + eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); + vlan1 = (struct rte_vlan_hdr *)(ð_hdr->ether_type ); + vlan2 = (struct rte_vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct rte_vlan_hdr)); + eth_hdr = (struct rte_ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct rte_vlan_hdr)); ip_hdr = (struct ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index f8ddc2db8..15ce64445 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -218,7 +218,7 @@ virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused) static int virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct ether_addr *addr) + __rte_unused struct rte_ether_addr *addr) { return 0; } @@ -496,7 +496,7 @@ virtual_ethdev_get_mbufs_from_tx_queue(uint16_t port_id, int -virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, +virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support) { struct rte_pci_device *pci_dev = NULL; diff --git a/app/test/virtual_pmd.h b/app/test/virtual_pmd.h index 5ca02bb50..120b58b27 100644 --- a/app/test/virtual_pmd.h +++ b/app/test/virtual_pmd.h @@ -15,7 +15,7 @@ int virtual_ethdev_init(void); int -virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, +virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support); void diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst index 9de14443e..fc9003a8b 100644 --- a/doc/guides/prog_guide/bbdev.rst +++ b/doc/guides/prog_guide/bbdev.rst @@ -752,12 +752,12 @@ buffers using (**sw_trubo**) bbdev PMD. for (j = 0; j < op_num; j++) { /* Append the size of the ethernet header */ rte_pktmbuf_append(input_pkts_burst[j], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* set op */ ops_burst[j]->turbo_enc.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); ops_burst[j]->turbo_enc->input.length = rte_pktmbuf_pkt_len(bbdev_pkts[j]); @@ -766,7 +766,7 @@ buffers using (**sw_trubo**) bbdev PMD. input_pkts_burst[j]; ops_burst[j]->turbo_enc->output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); ops_burst[j]->turbo_enc->output.data = output_pkts_burst[j]; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index a6383b3c7..9582b9376 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -91,7 +91,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -101,7 +101,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -111,7 +111,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -124,7 +124,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -134,7 +134,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -275,7 +275,7 @@ Forwarding application is shown below: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst index be3d63f90..02fc67550 100644 --- a/doc/guides/sample_app_ug/flow_filtering.rst +++ b/doc/guides/sample_app_ug/flow_filtering.rst @@ -304,7 +304,7 @@ looks like the following: main_loop(void) { struct rte_mbuf *mbufs[32]; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t nb_rx; uint16_t i; uint16_t j; @@ -318,7 +318,7 @@ looks like the following: struct rte_mbuf *m = mbufs[j]; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", @@ -348,7 +348,7 @@ queues and printing for each packet the destination queue: if (nb_rx) { for (j = 0; j < nb_rx; j++) { struct rte_mbuf *m = mbufs[j]; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", ð_hdr->d_addr); printf(" - queue=0x%x", (unsigned int)i); diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index f6efa7f6f..1fe6bf113 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct ether_hdr)); + iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -216,14 +216,14 @@ The actual packet transmission is done in the mcast_send_pkt() function: .. code-block:: c - static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) + static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t) sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t) sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index dfc1ed9ca..02c1367f5 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -451,13 +451,13 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index e5b28e425..54e5b8022 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -367,13 +367,13 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index ddd0f9a86..58c4aae92 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -270,10 +270,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index 571cd2d60..3fd043e82 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -311,11 +311,11 @@ The processing is very simple: processes the TX port from the RX port and then r static void lsi_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port = lsi_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/ptpclient.rst b/doc/guides/sample_app_ug/ptpclient.rst index 9d7446d5f..12b4f13d5 100644 --- a/doc/guides/sample_app_ug/ptpclient.rst +++ b/doc/guides/sample_app_ug/ptpclient.rst @@ -212,17 +212,17 @@ PTP IEEE1588 L2 functionality. void parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { struct ptp_header *ptp_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == PTP_PROTOCOL) { ptp_data.m = m; ptp_data.portid = portid; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); switch (ptp_hdr->msgtype) { case SYNC: diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst index 81463d28d..1ca959c55 100644 --- a/doc/guides/sample_app_ug/rxtx_callbacks.rst +++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst @@ -79,7 +79,7 @@ comments: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index adf258c0d..f7dab9e98 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -197,7 +197,7 @@ which tells the node where the packet has to be distributed. for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } @@ -357,7 +357,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst index 11ee521b3..715f5e91a 100644 --- a/doc/guides/sample_app_ug/skeleton.rst +++ b/doc/guides/sample_app_ug/skeleton.rst @@ -115,7 +115,7 @@ Forwarding application is shown below: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst b/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst index 707afe91a..8e1774d9e 100644 --- a/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst +++ b/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst @@ -165,7 +165,7 @@ the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02. }; /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ - static struct ether_addr pool_addr_template = { + static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; @@ -225,7 +225,7 @@ the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02. /* Set mac for each pool.*/ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; mac.addr_bytes[5] = q; diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 15bf73a40..d6eebc877 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -314,7 +314,7 @@ struct fman_if { /* The index of this MAC (within the Fman it belongs to) */ uint8_t mac_idx; /* The MAC address */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; /* The Qman channel to schedule Tx FQs to */ u16 tx_channel_id; /* The hard-coded FQIDs for this interface. Note: this doesn't cover diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h index 7818de68b..bf7bfae8c 100644 --- a/drivers/bus/dpaa/include/netcfg.h +++ b/drivers/bus/dpaa/include/netcfg.h @@ -30,8 +30,8 @@ struct netcfg_info { struct interface_info { char *name; - struct ether_addr mac_addr; - struct ether_addr peer_mac; + struct rte_ether_addr mac_addr; + struct rte_ether_addr peer_mac; int mac_present; int fman_enabled_mac_interface; }; diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 99e13fe48..b5c4befce 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -73,7 +73,7 @@ struct pmd_internals { int if_index; char *if_name; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct tpacket_req req; diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 007a1c6b4..4bd0392ef 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -109,7 +109,7 @@ struct pmd_internals { int if_index; char if_name[IFNAMSIZ]; uint16_t queue_idx; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct xsk_umem_info *umem; struct rte_mempool *mb_pool_share; @@ -778,7 +778,7 @@ parse_parameters(struct rte_kvargs *kvlist, static int get_iface_info(const char *if_name, - struct ether_addr *eth_addr, + struct rte_ether_addr *eth_addr, int *if_index) { struct ifreq ifr; diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 4f52e2bd1..b2b1fd78a 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -41,9 +41,9 @@ static int eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); static void eth_ark_dev_stats_reset(struct rte_eth_dev *dev); static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int eth_ark_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, @@ -220,14 +220,14 @@ check_for_ext(struct ark_adapter *ark) (void (*)(struct rte_eth_dev *, void *)) dlsym(ark->d_handle, "stats_reset"); ark->user_ext.mac_addr_add = - (void (*)(struct rte_eth_dev *, struct ether_addr *, uint32_t, + (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, uint32_t, uint32_t, void *)) dlsym(ark->d_handle, "mac_addr_add"); ark->user_ext.mac_addr_remove = (void (*)(struct rte_eth_dev *, uint32_t, void *)) dlsym(ark->d_handle, "mac_addr_remove"); ark->user_ext.mac_addr_set = - (void (*)(struct rte_eth_dev *, struct ether_addr *, + (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, void *)) dlsym(ark->d_handle, "mac_addr_set"); ark->user_ext.set_mtu = @@ -833,7 +833,7 @@ eth_ark_dev_stats_reset(struct rte_eth_dev *dev) static int eth_ark_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { @@ -864,7 +864,7 @@ eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private; diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h index f5af21538..5a987e4d6 100644 --- a/drivers/net/ark/ark_ext.h +++ b/drivers/net/ark/ark_ext.h @@ -70,7 +70,7 @@ void stats_reset(struct rte_eth_dev *dev, void *user_data); void mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *macadr, + struct rte_ether_addr *macadr, uint32_t index, uint32_t pool, void *user_data); @@ -80,7 +80,7 @@ void mac_addr_remove(struct rte_eth_dev *dev, void *user_data); void mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, void *user_data); int set_mtu(struct rte_eth_dev *dev, diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h index f820091d7..f6609054d 100644 --- a/drivers/net/ark/ark_global.h +++ b/drivers/net/ark/ark_global.h @@ -71,12 +71,12 @@ struct ark_user_ext { int (*stats_get)(struct rte_eth_dev *, struct rte_eth_stats *, void *); void (*stats_reset)(struct rte_eth_dev *, void *); void (*mac_addr_add)(struct rte_eth_dev *, - struct ether_addr *, + struct rte_ether_addr *, uint32_t, uint32_t, void *); void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *); - void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *); + void (*mac_addr_set)(struct rte_eth_dev *, struct rte_ether_addr *, void *); int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *); }; diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 8327863cd..78039f882 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -92,14 +92,14 @@ static void atl_dev_interrupt_handler(void *param); static int atl_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); static int atl_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* RSS */ @@ -1235,7 +1235,7 @@ atl_update_mac_addr(struct rte_eth_dev *dev, uint32_t index, } static int -atl_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index __rte_unused, uint32_t pool __rte_unused) { if (is_zero_ether_addr(mac_addr)) { @@ -1253,7 +1253,7 @@ atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } static int -atl_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +atl_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { atl_remove_mac_addr(dev, 0); atl_add_mac_addr(dev, addr, 0, 0); @@ -1420,7 +1420,7 @@ atl_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue_id, int on) static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c index 4299b7016..e4a1da0be 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c @@ -656,8 +656,8 @@ static int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self, mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct ether_addr *)mac_addr, - (struct ether_addr *)mac); + ether_addr_copy((struct rte_ether_addr *)mac_addr, + (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { /* chip revision */ @@ -867,8 +867,8 @@ static int aq_fw1x_set_wol(struct aq_hw_s *self, bool wol_enabled, u8 *mac) prpc->msg_wol.pattern_id = 1U; prpc->msg_wol.wol_packet_type = 2U; /* Magic Packet */ - ether_addr_copy((struct ether_addr *)mac, - (struct ether_addr *)&prpc->msg_wol.wol_pattern); + ether_addr_copy((struct rte_ether_addr *)mac, + (struct rte_ether_addr *)&prpc->msg_wol.wol_pattern); } else { rpc_size = sizeof(prpc->msg_id) + sizeof(prpc->msg_del_id); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c index f215ceb70..9111be9f4 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -222,8 +222,8 @@ int aq_fw2x_get_mac_permanent(struct aq_hw_s *self, u8 *mac) mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct ether_addr *)mac_addr, - (struct ether_addr *)mac); + ether_addr_copy((struct rte_ether_addr *)mac_addr, + (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { unsigned int rnd = (uint32_t)rte_rand(); diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 09388d05f..69a70d2cc 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -159,7 +159,7 @@ static const struct eth_dev_ops avp_eth_dev_ops = { struct avp_dev { uint32_t magic; /**< Memory validation marker */ uint64_t device_id; /**< Unique system identifier */ - struct ether_addr ethaddr; /**< Host specified MAC address */ + struct rte_ether_addr ethaddr; /**< Host specified MAC address */ struct rte_eth_dev_data *dev_data; /**< Back pointer to ethernet device data */ volatile uint32_t flags; /**< Device operational flags */ @@ -1199,7 +1199,7 @@ avp_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, } static inline int -_avp_cmp_ether_addr(struct ether_addr *a, struct ether_addr *b) +_avp_cmp_ether_addr(struct rte_ether_addr *a, struct rte_ether_addr *b) { uint16_t *_a = (uint16_t *)&a->addr_bytes[0]; uint16_t *_b = (uint16_t *)&b->addr_bytes[0]; @@ -1209,7 +1209,7 @@ _avp_cmp_ether_addr(struct ether_addr *a, struct ether_addr *b) static inline int _avp_mac_filter(struct avp_dev *avp, struct rte_mbuf *m) { - struct ether_hdr *eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (likely(_avp_cmp_ether_addr(&avp->ethaddr, ð->d_addr) == 0)) { /* allow all packets destined to our address */ diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index b1cd2980b..810ac4a74 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -539,7 +539,7 @@ struct axgbe_port { /* Hardware features of the device */ struct axgbe_hw_features hw_feat; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; /* Software Tx/Rx structure pointers*/ void **rx_queues; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index ab092e23f..77a0f56b2 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2177,8 +2177,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(pkt_prod); else { - struct ether_hdr *eh = - rte_pktmbuf_mtod(m0, struct ether_hdr *); + struct rte_ether_hdr *eh = + rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type)); @@ -2188,8 +2188,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) bd_prod = NEXT_TX_BD(bd_prod); if (IS_VF(sc)) { struct eth_tx_parse_bd_e2 *tx_parse_bd; - const struct ether_hdr *eh = - rte_pktmbuf_mtod(m0, struct ether_hdr *); + const struct rte_ether_hdr *eh = + rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); uint8_t mac_type = UNICAST_ADDRESS; tx_parse_bd = diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 1f2eb92b7..5b3eff905 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -497,7 +497,7 @@ bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) } static int -bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct bnx2x_softc *sc = dev->data->dev_private; @@ -650,7 +650,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) } } - eth_dev->data->mac_addrs = (struct ether_addr *)sc->link_params.mac_addr; + eth_dev->data->mac_addrs = (struct rte_ether_addr *)sc->link_params.mac_addr; if (IS_VF(sc)) { rte_spinlock_init(&sc->vf2pf_lock); diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h index 45958db9a..160bdc194 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.h +++ b/drivers/net/bnx2x/bnx2x_ethdev.h @@ -75,7 +75,7 @@ typedef int bool; /* MAC address operations */ struct bnx2x_mac_ops { - void (*mac_addr_add)(struct rte_eth_dev *dev, struct ether_addr *addr, + void (*mac_addr_add)(struct rte_eth_dev *dev, struct rte_ether_addr *addr, uint16_t index, uint32_t pool); /* not implemented yet */ void (*mac_addr_remove)(struct rte_eth_dev *dev, uint16_t index); /* not implemented yet */ }; diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index 048bf126f..a044e6eac 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -302,7 +302,7 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ if (is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) ether_addr_copy(&sc_resp.resc.current_mac_addr, - (struct ether_addr *)sc->link_params.mac_addr); + (struct rte_ether_addr *)sc->link_params.mac_addr); else eth_random_addr(sc->link_params.mac_addr); diff --git a/drivers/net/bnx2x/bnx2x_vfpf.h b/drivers/net/bnx2x/bnx2x_vfpf.h index cc6fef956..6964c9d98 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.h +++ b/drivers/net/bnx2x/bnx2x_vfpf.h @@ -115,7 +115,7 @@ struct vf_resc { uint8_t num_vlan_filters; uint8_t num_mc_filters; uint8_t permanent_mac_addr[ETH_ALEN]; - struct ether_addr current_mac_addr; + struct rte_ether_addr current_mac_addr; uint16_t pf_link_speed; uint32_t pf_link_supported; }; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 78ab07d0c..0cad7a144 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -760,7 +760,7 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, } static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; @@ -1451,7 +1451,7 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) } static int -bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) +bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct bnxt *bp = (struct bnxt *)dev->data->dev_private; /* Default Filter is tied to VNIC 0 */ @@ -1489,7 +1489,7 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) static int bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index eb5c41ebb..59e75b0be 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2578,7 +2578,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, struct hwrm_func_cfg_input *cfg_req, int vf) { - struct ether_addr mac; + struct rte_ether_addr mac; if (bnxt_hwrm_func_qcfg_vf_default_mac(bp, vf, &mac)) return; @@ -3112,7 +3112,7 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id, } int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac) + struct rte_ether_addr *mac) { struct hwrm_func_qcfg_input req = {0}; struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index ec9b3e007..53d79f046 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -130,7 +130,7 @@ int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf, uint16_t max_bw, uint16_t enables); int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf); int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac); + struct rte_ether_addr *mac); int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf); int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port, uint8_t tunnel_type); diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index c298de83c..5e3d1bfb1 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.c +++ b/drivers/net/bnxt/rte_pmd_bnxt.c @@ -132,7 +132,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on) } int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; @@ -647,7 +647,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, count); } -int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr, +int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, uint32_t vf_id) { struct rte_eth_dev *dev; @@ -655,7 +655,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr, struct bnxt *bp; struct bnxt_filter_info *filter; struct bnxt_vnic_info vnic; - struct ether_addr dflt_mac; + struct rte_ether_addr dflt_mac; int rc; dev = &rte_eth_devices[port]; diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h index 68fbe34d6..2e893cc7b 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.h +++ b/drivers/net/bnxt/rte_pmd_bnxt.h @@ -67,7 +67,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on); * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable vf vlan strip for all queues in a pool @@ -303,7 +303,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, * - (-ENOTSUP) Ethernet device is not a PF * - (-ENOMEM) on an allocation failure */ -int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *mac_addr, +int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *mac_addr, uint32_t vf_id); /** diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h index b668ff9ad..874aa91a5 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -225,7 +225,7 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], */ int rte_eth_bond_mac_address_set(uint16_t bonded_port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Reset bonded device to use MAC from primary slave on bonded device and it's diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 1e6a3fc7c..51bf3f52e 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -126,7 +126,7 @@ bond_print_lacp(struct lacpdu *l) #define MODE4_DEBUG(fmt, ...) do { } while (0) #endif -static const struct ether_addr lacp_mac_addr = { +static const struct rte_ether_addr lacp_mac_addr = { .addr_bytes = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; @@ -810,7 +810,7 @@ bond_mode_8023ad_periodic_cb(void *arg) struct bond_dev_private *internals = bond_dev->data->dev_private; struct port *port; struct rte_eth_link link_info; - struct ether_addr slave_addr; + struct rte_ether_addr slave_addr; struct rte_mbuf *lacp_pkt = NULL; uint16_t slave_id; uint16_t i; @@ -1044,7 +1044,7 @@ void bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) { struct bond_dev_private *internals = bond_dev->data->dev_private; - struct ether_addr slave_addr; + struct rte_ether_addr slave_addr; struct port *slave, *agg_slave; uint16_t slave_id, i, j; diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h index d8b5dbc21..cbad59aa7 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h @@ -58,14 +58,14 @@ struct slow_protocol { /** Generic slow protocol frame type structure */ struct slow_protocol_frame { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct slow_protocol slow_protocol; } __attribute__((__packed__)); struct port_params { uint16_t system_priority; /**< System priority (unused in current implementation) */ - struct ether_addr system; + struct rte_ether_addr system; /**< System ID - Slave MAC address, same as bonding MAC address */ uint16_t key; /**< Speed information (implementation dependednt) and duplex. */ @@ -103,7 +103,7 @@ struct lacpdu { /** LACPDU frame: Contains ethernet header and LACPDU. */ struct lacpdu_header { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct lacpdu lacpdu; } __attribute__((__packed__)); @@ -114,7 +114,7 @@ struct marker { uint8_t tlv_type_marker; uint8_t info_length; uint16_t requester_port; - struct ether_addr requester_system; + struct rte_ether_addr requester_system; uint32_t requester_transaction_id; uint8_t reserved_2[2]; @@ -124,7 +124,7 @@ struct marker { } __attribute__((__packed__)); struct marker_header { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct marker marker; } __attribute__((__packed__)); diff --git a/drivers/net/bonding/rte_eth_bond_8023ad_private.h b/drivers/net/bonding/rte_eth_bond_8023ad_private.h index f91902ebd..d905de425 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad_private.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad_private.h @@ -150,7 +150,7 @@ struct mode8023ad_private { uint64_t update_timeout_us; rte_eth_bond_8023ad_ext_slowrx_fn slowrx_cb; uint8_t external_sm; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link slave_link; /***< slave link properties */ diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 3df28965c..d47046142 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -72,7 +72,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) return -ENOMEM; } -void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, +void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { struct rte_arp_hdr *arp; @@ -102,7 +102,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, client_info->app_ip != arp->arp_data.arp_tip || client_info->cli_ip != arp->arp_data.arp_sip || !is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || - client_info->vlan_count != offset / sizeof(struct vlan_hdr) || + client_info->vlan_count != offset / sizeof(struct rte_vlan_hdr) || memcmp(client_info->vlan, eth_h + 1, offset) != 0 ) { client_info->in_use = 1; @@ -113,14 +113,14 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); } internals->mode6.ntt = 1; rte_spinlock_unlock(&internals->mode6.lock); } uint16_t -bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { struct rte_arp_hdr *arp; @@ -130,7 +130,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, uint8_t hash_index; - struct ether_addr bonding_mac; + struct rte_ether_addr bonding_mac; arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); @@ -163,7 +163,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); return client_info->slave_idx; } @@ -179,7 +179,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); return client_info->slave_idx; } @@ -195,12 +195,12 @@ uint16_t bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals) { - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; struct rte_arp_hdr *arp_h; uint16_t slave_idx; rte_spinlock_lock(&internals->mode6.lock); - eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ether_addr_copy(&client_info->app_mac, ð_h->s_addr); ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); @@ -209,11 +209,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, else eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) - + client_info->vlan_count * sizeof(struct vlan_hdr)); + arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct rte_ether_hdr) + + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); memcpy(eth_h + 1, client_info->vlan, - client_info->vlan_count * sizeof(struct vlan_hdr)); + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); arp_h->arp_data.arp_sip = client_info->app_ip; diff --git a/drivers/net/bonding/rte_eth_bond_alb.h b/drivers/net/bonding/rte_eth_bond_alb.h index 4640fd24e..386e70c59 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.h +++ b/drivers/net/bonding/rte_eth_bond_alb.h @@ -13,11 +13,11 @@ struct client_data { /** ARP data of single client */ - struct ether_addr app_mac; + struct rte_ether_addr app_mac; /**< MAC address of application running DPDK */ uint32_t app_ip; /**< IP address of application running DPDK */ - struct ether_addr cli_mac; + struct rte_ether_addr cli_mac; /**< Client MAC address */ uint32_t cli_ip; /**< Client IP address */ @@ -29,7 +29,7 @@ struct client_data { uint8_t ntt; /**< Flag indicating if we need to send update to this client on next tx */ - struct vlan_hdr vlan[2]; + struct rte_vlan_hdr vlan[2]; /**< Content of vlan headers */ uint8_t vlan_count; /**< Number of nested vlan headers */ @@ -68,7 +68,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev); * @param internals Bonding data. */ void -bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** @@ -85,7 +85,7 @@ bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, * Index of slave on which packet should be sent. */ uint16_t -bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index a23988dc7..0fc4c5eda 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -840,7 +840,7 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], int rte_eth_bond_mac_address_set(uint16_t bonded_port_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index b60fde6a8..01bbb06c1 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -282,7 +282,7 @@ bond_ethdev_parse_bond_mac_addr_kvarg(const char *key __rte_unused, /* Parse MAC */ return cmdline_parse_etheraddr(NULL, value, extra_args, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } int diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 63df3568d..67a78603f 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -33,21 +33,21 @@ static uint64_t tlb_last_obytets[RTE_MAX_ETHPORTS]; static inline size_t -get_vlan_offset(struct ether_hdr *eth_hdr, uint16_t *proto) +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) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - vlan_offset = sizeof(struct vlan_hdr); + vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; - vlan_offset += sizeof(struct vlan_hdr); + vlan_offset += sizeof(struct rte_vlan_hdr); } } return vlan_offset; @@ -394,8 +394,8 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, struct bond_dev_private *internals = bd_rx_q->dev_private; struct rte_eth_dev *bonded_eth_dev = &rte_eth_devices[internals->port_id]; - struct ether_addr *bond_mac = bonded_eth_dev->data->mac_addrs; - struct ether_hdr *hdr; + 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); uint16_t num_rx_total = 0; /* Total number of received packets */ @@ -444,7 +444,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, if (j + 3 < num_rx_total) rte_prefetch0(rte_pktmbuf_mtod(bufs[j + 3], void *)); - hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); subtype = ((struct slow_protocol_frame *)hdr)->slow_protocol.subtype; /* Remove packet from array if it is slow packet or slave is not @@ -584,7 +584,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) #endif static void -mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, +mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_h, uint16_t port, uint32_t __attribute__((unused)) *burstnumber) { struct ipv4_hdr *ipv4_h; @@ -630,7 +630,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; uint16_t ether_type, offset; uint16_t nb_recv_pkts; int i; @@ -638,7 +638,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) nb_recv_pkts = bond_ethdev_rx_burst(queue, bufs, nb_pkts); for (i = 0; i < nb_recv_pkts; i++) { - eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(bufs[i], struct rte_ether_hdr *); ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); @@ -738,7 +738,7 @@ bond_ethdev_tx_burst_active_backup(void *queue, } static inline uint16_t -ether_hash(struct ether_hdr *eth_hdr) +ether_hash(struct rte_ether_hdr *eth_hdr) { unaligned_uint16_t *word_src_addr = (unaligned_uint16_t *)eth_hdr->s_addr.addr_bytes; @@ -775,12 +775,12 @@ void burst_xmit_l2_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t hash; int i; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); hash = ether_hash(eth_hdr); @@ -793,13 +793,13 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { uint16_t i; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t proto; size_t vlan_offset; uint32_t hash, l3hash; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); l3hash = 0; proto = eth_hdr->ether_type; @@ -830,7 +830,7 @@ void burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t proto; size_t vlan_offset; int i; @@ -840,7 +840,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); proto = eth_hdr->ether_type; vlan_offset = get_vlan_offset(eth_hdr, &proto); l3hash = 0; @@ -1003,9 +1003,9 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) uint16_t num_of_slaves = internals->active_slave_count; uint16_t slaves[RTE_MAX_ETHPORTS]; - struct ether_hdr *ether_hdr; - struct ether_addr primary_slave_addr; - struct ether_addr active_slave_addr; + struct rte_ether_hdr *ether_hdr; + struct rte_ether_addr primary_slave_addr; + struct rte_ether_addr active_slave_addr; if (num_of_slaves < 1) return num_tx_total; @@ -1027,7 +1027,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (j + 3 < nb_pkts) rte_prefetch0(rte_pktmbuf_mtod(bufs[j+3], void*)); - ether_hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *); + ether_hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); if (is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) @@ -1063,7 +1063,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; uint16_t ether_type, offset; struct client_data *client_info; @@ -1093,7 +1093,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) /* Search tx buffer for ARP packets and forward them to alb */ for (i = 0; i < nb_pkts; i++) { - eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(bufs[i], struct rte_ether_hdr *); ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); @@ -1127,8 +1127,8 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) "Failed to allocate ARP packet from pool"); continue; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr) - + client_info->vlan_count * sizeof(struct vlan_hdr); + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr) + + client_info->vlan_count * sizeof(struct rte_vlan_hdr); upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; @@ -1159,7 +1159,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) /* Print TX stats including update packets */ for (j = 0; j < slave_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct rte_ether_hdr *); mode6_debug("TX ARP:", eth_h, i, &burstnumberTX); } #endif @@ -1176,7 +1176,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) for (j = 0; j < update_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct rte_ether_hdr *); mode6_debug("TX ARPupd:", eth_h, i, &burstnumberTX); } #endif @@ -1494,9 +1494,9 @@ link_properties_valid(struct rte_eth_dev *ethdev, } int -mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) +mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr) { - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); @@ -1515,9 +1515,9 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) } int -mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) +mac_address_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *new_mac_addr) { - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); @@ -1538,7 +1538,7 @@ mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) return 0; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; /* * Add additional MAC addresses to the slave @@ -1548,7 +1548,7 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, uint16_t slave_port_id) { int i, ret; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; @@ -1576,7 +1576,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, uint16_t slave_port_id) { int i, rc, ret; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; rc = 0; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { @@ -1999,7 +1999,7 @@ slave_add(struct bond_dev_private *internals, slave_details->link_status_wait_to_complete = 0; /* clean tlb_last_obytes when adding port for bonding device */ memcpy(&(slave_details->persisted_mac_addr), slave_eth_dev->data->mac_addrs, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } void @@ -2045,7 +2045,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) } if (internals->user_defined_mac == 0) { - struct ether_addr *new_mac_addr = NULL; + struct rte_ether_addr *new_mac_addr = NULL; for (i = 0; i < internals->slave_count; i++) if (internals->slaves[i].port_id == internals->primary_port) @@ -2931,7 +2931,7 @@ bond_ethdev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } static int -bond_ethdev_mac_address_set(struct rte_eth_dev *dev, struct ether_addr *addr) +bond_ethdev_mac_address_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { if (mac_address_set(dev, addr)) { RTE_BOND_LOG(ERR, "Failed to update MAC address"); @@ -2953,7 +2953,7 @@ bond_filter_ctrl(struct rte_eth_dev *dev __rte_unused, } static int -bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t vmdq) { struct rte_eth_dev *slave_eth_dev; @@ -3004,7 +3004,7 @@ bond_ethdev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) goto end; } - struct ether_addr *mac_addr = &dev->data->mac_addrs[index]; + struct rte_ether_addr *mac_addr = &dev->data->mac_addrs[index]; for (i = 0; i < internals->slave_count; i++) rte_eth_dev_mac_addr_remove(internals->slaves[i].port_id, @@ -3382,7 +3382,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) /* Parse MAC address for bonded device */ arg_count = rte_kvargs_count(kvlist, PMD_BOND_MAC_ADDR_KVARG); if (arg_count == 1) { - struct ether_addr bond_mac; + struct rte_ether_addr bond_mac; if (rte_kvargs_process(kvlist, PMD_BOND_MAC_ADDR_KVARG, &bond_ethdev_parse_bond_mac_addr_kvarg, &bond_mac) < 0) { diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 8afef39ba..107a9ea1a 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -85,7 +85,7 @@ struct bond_slave_details { uint8_t link_status_wait_to_complete; uint8_t last_link_status; /**< Port Id of slave eth_dev */ - struct ether_addr persisted_mac_addr; + struct rte_ether_addr persisted_mac_addr; uint16_t reta_size; }; @@ -223,10 +223,10 @@ void activate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id); int -mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr); +mac_address_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *new_mac_addr); int -mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr); +mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr); int mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev); diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index fb8af5250..b54f75ebc 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -671,7 +671,7 @@ static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx, { struct port_info *pi = adap2pinfo(adapter, port_idx); - ether_addr_copy((struct ether_addr *)hw_addr, + ether_addr_copy((struct rte_ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0]); } diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 833dd1f5f..bdda51894 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1055,7 +1055,7 @@ static int cxgbe_get_regs(struct rte_eth_dev *eth_dev, return 0; } -int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct port_info *pi = (struct port_info *)(dev->data->dev_private); int ret; diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 8d0a105aa..03145cea6 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -16,7 +16,7 @@ void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev); -int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr); +int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr); int cxgbe_dev_configure(struct rte_eth_dev *eth_dev); int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 2e043feb2..0e1dc1ae8 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -934,7 +934,7 @@ dpaa_flow_ctrl_get(struct rte_eth_dev *dev, static int dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, __rte_unused uint32_t pool) { @@ -964,7 +964,7 @@ dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev, static int dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { int ret; struct dpaa_if *dpaa_intf = dev->data->dev_private; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index a4085f47e..dd8fd8fd5 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -198,7 +198,7 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) static inline void dpaa_checksum(struct rte_mbuf *mbuf) { - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 89d20d0bf..bfb9f9dad 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1124,7 +1124,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int dpaa2_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -1155,7 +1155,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev, struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; PMD_INIT_FUNC_TRACE(); @@ -1175,7 +1175,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev, static int dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { int ret; struct dpaa2_dev_priv *priv = dev->data->dev_private; @@ -1992,13 +1992,13 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { */ static int populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, - struct ether_addr *mac_entry) + struct rte_ether_addr *mac_entry) { int ret; - struct ether_addr phy_mac, prime_mac; + struct rte_ether_addr phy_mac, prime_mac; - memset(&phy_mac, 0, sizeof(struct ether_addr)); - memset(&prime_mac, 0, sizeof(struct ether_addr)); + memset(&phy_mac, 0, sizeof(struct rte_ether_addr)); + memset(&prime_mac, 0, sizeof(struct rte_ether_addr)); /* Get the physical device MAC address */ ret = dpni_get_port_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, @@ -2032,7 +2032,7 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, ret); goto cleanup; } - memcpy(&prime_mac, &phy_mac, sizeof(struct ether_addr)); + memcpy(&prime_mac, &phy_mac, sizeof(struct rte_ether_addr)); } } else if (is_zero_ether_addr(&prime_mac)) { /* In case phys and prime, both are zero, create random MAC */ @@ -2047,7 +2047,7 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, } /* prime_mac the final MAC address */ - memcpy(mac_entry, &prime_mac, sizeof(struct ether_addr)); + memcpy(mac_entry, &prime_mac, sizeof(struct rte_ether_addr)); return 0; cleanup: diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index c94c7ef6b..2b4b15e7e 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -215,27 +215,27 @@ dpaa2_configure_flow_eth(struct rte_flow *flow, /* Key rule */ key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_ETH; memcpy((void *)key_iova, (const void *)(spec->src.addr_bytes), - sizeof(struct ether_addr)); - key_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + key_iova += sizeof(struct rte_ether_addr); memcpy((void *)key_iova, (const void *)(spec->dst.addr_bytes), - sizeof(struct ether_addr)); - key_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + key_iova += sizeof(struct rte_ether_addr); memcpy((void *)key_iova, (const void *)(&spec->type), sizeof(rte_be16_t)); /* Key mask */ mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_ETH; memcpy((void *)mask_iova, (const void *)(mask->src.addr_bytes), - sizeof(struct ether_addr)); - mask_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + mask_iova += sizeof(struct rte_ether_addr); memcpy((void *)mask_iova, (const void *)(mask->dst.addr_bytes), - sizeof(struct ether_addr)); - mask_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + mask_iova += sizeof(struct rte_ether_addr); memcpy((void *)mask_iova, (const void *)(&mask->type), sizeof(rte_be16_t)); flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_ETH + - ((2 * sizeof(struct ether_addr)) + + ((2 * sizeof(struct rte_ether_addr)) + sizeof(rte_be16_t))); return device_configured; } diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 8230824e7..ae69a64ea 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -89,14 +89,14 @@ static int eth_em_led_on(struct rte_eth_dev *dev); static int eth_em_led_off(struct rte_eth_dev *dev); static int em_get_rx_buffer_size(struct e1000_hw *hw); -static int eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +static int eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index); static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); #define EM_FC_PAUSE_TIME 0x0680 @@ -293,7 +293,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, eth_dev->data->mac_addrs); /* initialize the vfta */ @@ -1735,7 +1735,7 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) } static int -eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, __rte_unused uint32_t pool) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1756,7 +1756,7 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { eth_em_rar_clear(dev, 0); @@ -1806,7 +1806,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct e1000_hw *hw; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index d3a8f5bf4..df1419f27 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -145,11 +145,11 @@ static int eth_igb_led_off(struct rte_eth_dev *dev); static void igb_intr_disable(struct rte_eth_dev *dev); static int igb_get_rx_buffer_size(struct e1000_hw *hw); static int eth_igb_rar_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index); static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static void igbvf_intr_disable(struct e1000_hw *hw); static int igbvf_dev_configure(struct rte_eth_dev *dev); @@ -174,7 +174,7 @@ static int igbvf_vlan_filter_set(struct rte_eth_dev *dev, static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on); static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on); static int igbvf_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static int igbvf_get_reg_length(struct rte_eth_dev *dev); static int igbvf_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs); @@ -231,7 +231,7 @@ static int eth_igb_get_module_info(struct rte_eth_dev *dev, static int eth_igb_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); static int igb_timesync_enable(struct rte_eth_dev *dev); static int igb_timesync_disable(struct rte_eth_dev *dev); @@ -840,7 +840,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* initialize the vfta */ memset(shadow_vfta, 0, sizeof(*shadow_vfta)); @@ -983,7 +983,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); int diag; - struct ether_addr *perm_addr = (struct ether_addr *)hw->mac.perm_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; PMD_INIT_FUNC_TRACE(); @@ -1057,7 +1057,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) return diag; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x " @@ -3119,7 +3119,7 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) #define E1000_RAH_POOLSEL_SHIFT (18) static int -eth_igb_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -3145,7 +3145,7 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { eth_igb_rar_clear(dev, 0); eth_igb_rar_set(dev, (void *)addr, 0, 0); @@ -3358,7 +3358,7 @@ igbvf_dev_close(struct rte_eth_dev *dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct e1000_adapter *adapter = E1000_DEV_PRIVATE(dev->data->dev_private); - struct ether_addr addr; + struct rte_ether_addr addr; PMD_INIT_FUNC_TRACE(); @@ -3503,7 +3503,7 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) } static int -igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4905,7 +4905,7 @@ eth_igb_filter_ctrl(struct rte_eth_dev *dev, static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct e1000_hw *hw; diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index b9f2e5391..9f1521350 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -306,8 +306,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); int rah; - if (is_unicast_ether_addr((struct ether_addr *)new_mac)) { - if (!is_zero_ether_addr((struct ether_addr *)new_mac)) + if (is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { + if (!is_zero_ether_addr((struct rte_ether_addr *)new_mac)) rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index a55b4a719..14846be94 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1813,9 +1813,9 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK) != 0; /* Copy MAC address and point DPDK to it */ - eth_dev->data->mac_addrs = (struct ether_addr *)adapter->mac_addr; - ether_addr_copy((struct ether_addr *)get_feat_ctx.dev_attr.mac_addr, - (struct ether_addr *)adapter->mac_addr); + eth_dev->data->mac_addrs = (struct rte_ether_addr *)adapter->mac_addr; + ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, + (struct rte_ether_addr *)adapter->mac_addr); /* * Pass the information to the rte_eth_dev_close() that it should also @@ -2151,7 +2151,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, * length of the ethernet header. */ if (unlikely(m->l2_len == 0)) - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 023fe7517..49fbf4e88 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -98,7 +98,7 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x", diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 9193fb038..20080af6f 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -197,7 +197,7 @@ struct enic { /* Multicast MAC addresses added to the NIC */ uint32_t mc_count; - struct ether_addr mc_addrs[ENIC_MULTICAST_PERFECT_FILTERS]; + struct rte_ether_addr mc_addrs[ENIC_MULTICAST_PERFECT_FILTERS]; }; /* Compute ethdev's max packet size from MTU */ diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 8d14d8ac7..71e1b9c7d 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -604,7 +604,7 @@ static void enicpmd_dev_allmulticast_disable(struct rte_eth_dev *eth_dev) } static int enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct enic *enic = pmd_priv(eth_dev); @@ -629,7 +629,7 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index) } static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct enic *enic = pmd_priv(eth_dev); int ret; @@ -644,7 +644,7 @@ static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, return enic_set_mac_address(enic, addr->addr_bytes); } -static void debug_log_add_del_addr(struct ether_addr *addr, bool add) +static void debug_log_add_del_addr(struct rte_ether_addr *addr, bool add) { char mac_str[ETHER_ADDR_FMT_SIZE]; @@ -654,12 +654,12 @@ static void debug_log_add_del_addr(struct ether_addr *addr, bool add) } static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct enic *enic = pmd_priv(eth_dev); char mac_str[ETHER_ADDR_FMT_SIZE]; - struct ether_addr *addr; + struct rte_ether_addr *addr; uint32_t i, j; int ret; @@ -730,7 +730,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, } /* Keep a copy so we can flush/apply later on.. */ memcpy(enic->mc_addrs, mc_addr_set, - nb_mc_addr * sizeof(struct ether_addr)); + nb_mc_addr * sizeof(struct rte_ether_addr)); enic->mc_count = nb_mc_addr; return 0; } diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 5924a01e3..94c443a98 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -571,9 +571,9 @@ enic_copy_item_inner_eth_v2(struct copy_item_args *arg) FLOW_TRACE(); if (!mask) mask = &rte_flow_item_eth_mask; - arg->l2_proto_off = *off + offsetof(struct ether_hdr, ether_type); + arg->l2_proto_off = *off + offsetof(struct rte_ether_hdr, ether_type); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ether_hdr), + arg->item->spec, mask, sizeof(struct rte_ether_hdr), 0 /* no previous protocol */, 0, 0); } @@ -589,9 +589,9 @@ enic_copy_item_inner_vlan_v2(struct copy_item_args *arg) mask = &rte_flow_item_vlan_mask; /* Append vlan header to L5 and set ether type = TPID */ eth_type_off = arg->l2_proto_off; - arg->l2_proto_off = *off + offsetof(struct vlan_hdr, eth_proto); + 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 vlan_hdr), + arg->item->spec, mask, sizeof(struct rte_vlan_hdr), eth_type_off, rte_cpu_to_be_16(ETHER_TYPE_VLAN), 2); } @@ -662,8 +662,8 @@ enic_copy_item_eth_v2(struct copy_item_args *arg) { const struct rte_flow_item *item = arg->item; struct filter_v2 *enic_filter = arg->filter; - struct ether_hdr enic_spec; - struct ether_hdr enic_mask; + struct rte_ether_hdr enic_spec; + struct rte_ether_hdr enic_mask; const struct rte_flow_item_eth *spec = item->spec; const struct rte_flow_item_eth *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; @@ -691,9 +691,9 @@ enic_copy_item_eth_v2(struct copy_item_args *arg) /* outer header */ memcpy(gp->layer[FILTER_GENERIC_1_L2].mask, &enic_mask, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L2].val, &enic_spec, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); return 0; } @@ -705,8 +705,8 @@ enic_copy_item_vlan_v2(struct copy_item_args *arg) const struct rte_flow_item_vlan *spec = item->spec; const struct rte_flow_item_vlan *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; - struct ether_hdr *eth_mask; - struct ether_hdr *eth_val; + struct rte_ether_hdr *eth_mask; + struct rte_ether_hdr *eth_val; FLOW_TRACE(); @@ -932,11 +932,11 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) mask = &rte_flow_item_vxlan_mask; memcpy(gp->layer[FILTER_GENERIC_1_L5].mask, mask, - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L5].val, spec, - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); - *inner_ofst = sizeof(struct vxlan_hdr); + *inner_ofst = sizeof(struct rte_vxlan_hdr); return 0; } @@ -1035,7 +1035,7 @@ fixup_l5_layer(struct enic *enic, struct filter_generic_1 *gp, if (!(inner_ofst > 0 && enic->vxlan)) return; FLOW_TRACE(); - vxlan = sizeof(struct vxlan_hdr); + vxlan = sizeof(struct rte_vxlan_hdr); memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), gp->layer[FILTER_GENERIC_1_L5].mask, vxlan); memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index ea9eb2edf..6e8c5cf91 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1667,13 +1667,13 @@ static int enic_dev_init(struct enic *enic) enic_fdir_info(enic); eth_dev->data->mac_addrs = rte_zmalloc("enic_mac_addr", - sizeof(struct ether_addr) * + sizeof(struct rte_ether_addr) * ENIC_UNICAST_PERFECT_FILTERS, 0); if (!eth_dev->data->mac_addrs) { dev_err(enic, "mac addr storage alloc failed, aborting.\n"); return -1; } - ether_addr_copy((struct ether_addr *) enic->mac_addr, + ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, eth_dev->data->mac_addrs); vnic_dev_set_reset_flag(enic->vdev, 0); diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 42dfaca30..8f7d91169 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -166,7 +166,7 @@ static int fs_eth_dev_create(struct rte_vdev_device *vdev) { struct rte_eth_dev *dev; - struct ether_addr *mac; + struct rte_ether_addr *mac; struct fs_priv *priv; struct sub_device *sdev; const char *params; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 3351c5bca..5fc6be403 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -367,7 +367,7 @@ static int fs_get_mac_addr_arg(const char *key __rte_unused, const char *value, void *out) { - struct ether_addr *ea = out; + struct rte_ether_addr *ea = out; int ret; if ((value == NULL) || (out == NULL)) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 7ac23d49a..549ee6bb8 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -166,7 +166,7 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, DEBUG("Configure additional MAC address%s", (PRIV(dev)->nb_mac_addr > 2 ? "es" : "")); for (i = 1; i < PRIV(dev)->nb_mac_addr; i++) { - struct ether_addr *ea; + struct rte_ether_addr *ea; ea = &dev->data->mac_addrs[i]; ret = rte_eth_dev_mac_addr_add(PORT_ID(sdev), ea, diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 65957a2e5..ec40bbe86 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -1082,7 +1082,7 @@ fs_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) static int fs_mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { @@ -1111,7 +1111,7 @@ fs_mac_addr_add(struct rte_eth_dev *dev, } static int -fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +fs_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct sub_device *sdev; uint8_t i; @@ -1135,7 +1135,7 @@ fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) static int fs_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct sub_device *sdev; uint8_t i; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 4f58a5c91..231b89edd 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -152,10 +152,10 @@ struct fs_priv { TAILQ_HEAD(sub_flows, rte_flow) flow_list; /* current number of mac_addr slots allocated. */ uint32_t nb_mac_addr; - struct ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; + struct rte_ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; uint32_t mac_addr_pool[FAILSAFE_MAX_ETHADDR]; uint32_t nb_mcast_addr; - struct ether_addr *mcast_addrs; + struct rte_ether_addr *mcast_addrs; /* current capabilities */ struct rte_eth_dev_info infos; struct rte_eth_dev_owner my_owner; /* Unique owner. */ diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index caf4d1bc0..ac00828dd 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -614,7 +614,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); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); macvlan->nb_queue_pools = nb_queue_pools; @@ -1664,7 +1664,7 @@ static void fm10k_MAC_filter_set(struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int fm10k_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { @@ -3080,7 +3080,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_read_mac_addr(hw); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); if (diag != FM10K_SUCCESS || @@ -3089,7 +3089,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /* Generate a random addr */ eth_random_addr(hw->mac.addr); memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 5b01dc1f0..331519ff4 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -266,7 +266,7 @@ static int i40e_flow_ctrl_set(struct rte_eth_dev *dev, static int i40e_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf); static int i40e_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); @@ -380,7 +380,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); @@ -1467,8 +1467,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) goto err_get_mac_addr; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.addr, - (struct ether_addr *) hw->mac.perm_addr); + ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + (struct rte_ether_addr *) hw->mac.perm_addr); /* Disable flow control */ hw->fc.requested_mode = I40E_FC_NONE; @@ -1519,7 +1519,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) "Failed to allocated memory for storing mac address"); goto err_mac_alloc; } - ether_addr_copy((struct ether_addr *)hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, &dev->data->mac_addrs[0]); /* Init dcb to sw mode by default */ @@ -4001,7 +4001,7 @@ i40e_priority_flow_ctrl_set(__rte_unused struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int i40e_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t pool) { @@ -4052,7 +4052,7 @@ i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_vsi *vsi; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; int ret; uint32_t i; uint64_t pool_sel; @@ -4093,8 +4093,8 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, { struct i40e_hw *hw; struct i40e_mac_filter_info mac_filter; - struct ether_addr old_mac; - struct ether_addr *new_mac; + struct rte_ether_addr old_mac; + struct rte_ether_addr *new_mac; struct i40e_pf_vf *vf = NULL; uint16_t vf_id; int ret; @@ -4155,7 +4155,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, /* Clear device address as it has been removed */ if (is_same_ether_addr(&(pf->dev_addr), new_mac)) - memset(&pf->dev_addr, 0, sizeof(struct ether_addr)); + memset(&pf->dev_addr, 0, sizeof(struct rte_ether_addr)); } return 0; @@ -5332,7 +5332,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) ret = i40e_aq_remove_macvlan(hw, vsi->seid, &def_filter, 1, NULL); if (ret != I40E_SUCCESS) { struct i40e_mac_filter *f; - struct ether_addr *mac; + struct rte_ether_addr *mac; PMD_DRV_LOG(DEBUG, "Cannot remove the default macvlan filter"); @@ -5352,7 +5352,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) return ret; } rte_memcpy(&filter.mac_addr, - (struct ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); + (struct rte_ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; return i40e_vsi_add_mac(vsi, &filter); } @@ -5470,7 +5470,7 @@ i40e_vsi_setup(struct i40e_pf *pf, struct i40e_mac_filter_info filter; int ret; struct i40e_vsi_context ctxt; - struct ether_addr broadcast = + struct rte_ether_addr broadcast = {.addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; if (type != I40E_VSI_MAIN && type != I40E_VSI_SRIOV && @@ -6897,7 +6897,7 @@ i40e_remove_macvlan_filters(struct i40e_vsi *vsi, /* Find out specific MAC filter */ static struct i40e_mac_filter * i40e_find_mac_filter(struct i40e_vsi *vsi, - struct ether_addr *macaddr) + struct rte_ether_addr *macaddr) { struct i40e_mac_filter *f; @@ -6981,7 +6981,7 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, - int num, struct ether_addr *addr) + int num, struct rte_ether_addr *addr) { int i; uint32_t j, k; @@ -7275,7 +7275,7 @@ i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *mac_filter) } int -i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr) +i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr) { struct i40e_mac_filter *f; struct i40e_macvlan_filter *mv_f; @@ -7575,10 +7575,10 @@ i40e_tunnel_filter_convert( struct i40e_aqc_cloud_filters_element_bb *cld_filter, struct i40e_tunnel_filter *tunnel_filter) { - ether_addr_copy((struct ether_addr *)&cld_filter->element.outer_mac, - (struct ether_addr *)&tunnel_filter->input.outer_mac); - ether_addr_copy((struct ether_addr *)&cld_filter->element.inner_mac, - (struct ether_addr *)&tunnel_filter->input.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, + (struct rte_ether_addr *)&tunnel_filter->input.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, + (struct rte_ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->element.inner_vlan; if ((rte_le_to_cpu_16(cld_filter->element.flags) & I40E_AQC_ADD_CLOUD_FLAGS_IPV6) == @@ -7687,9 +7687,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, pfilter = cld_filter; ether_addr_copy(&tunnel_filter->outer_mac, - (struct ether_addr *)&pfilter->element.outer_mac); + (struct rte_ether_addr *)&pfilter->element.outer_mac); ether_addr_copy(&tunnel_filter->inner_mac, - (struct ether_addr *)&pfilter->element.inner_mac); + (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); @@ -8134,9 +8134,9 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, pfilter = cld_filter; ether_addr_copy(&tunnel_filter->outer_mac, - (struct ether_addr *)&pfilter->element.outer_mac); + (struct rte_ether_addr *)&pfilter->element.outer_mac); ether_addr_copy(&tunnel_filter->inner_mac, - (struct ether_addr *)&pfilter->element.inner_mac); + (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); @@ -11939,7 +11939,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, } static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -12072,10 +12072,10 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) vsi = vf->vsi; } memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct ether_addr *)&f->input.outer_mac, - (struct ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct ether_addr *)&f->input.inner_mac, - (struct ether_addr *)&cld_filter.element.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, + (struct rte_ether_addr *)&cld_filter.element.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, + (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = f->input.inner_vlan; cld_filter.element.flags = f->input.flags; cld_filter.element.tenant_id = f->input.tenant_id; diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 930eb9aba..0b8cb780d 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -278,7 +278,7 @@ struct i40e_adapter; */ struct i40e_mac_filter_info { enum rte_mac_filter_type filter_type; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; TAILQ_HEAD(i40e_mac_filter_list, i40e_mac_filter); @@ -331,7 +331,7 @@ struct i40e_veb { /* i40e MACVLAN filter structure */ struct i40e_macvlan_filter { - struct ether_addr macaddr; + struct rte_ether_addr macaddr; enum rte_mac_filter_type filter_type; uint16_t vlan_id; }; @@ -422,7 +422,7 @@ struct i40e_pf_vf { uint16_t vf_idx; /* VF index in pf->vfs */ uint16_t lan_nb_qps; /* Actual queues allocated */ uint16_t reset_cnt; /* Total vf reset times */ - struct ether_addr mac_addr; /* Default MAC address */ + struct rte_ether_addr mac_addr; /* Default MAC address */ /* version of the virtchnl from VF */ struct virtchnl_version_info version; uint32_t request_caps; /* offload caps requested from VF */ @@ -642,7 +642,7 @@ struct i40e_fdir_info { /* Ethertype filter struct */ struct i40e_ethertype_filter_input { - struct ether_addr mac_addr; /* Mac address to match */ + struct rte_ether_addr mac_addr; /* Mac address to match */ uint16_t ether_type; /* Ether type to match */ }; @@ -760,8 +760,8 @@ enum i40e_tunnel_type { * Tunneling Packet filter configuration. */ struct i40e_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ uint32_t outer_vlan; /**< Outer VLAN to match */ enum i40e_tunnel_iptype ip_type; /**< IP address type. */ @@ -920,7 +920,7 @@ struct i40e_pf { bool offset_loaded; struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ - struct ether_addr dev_addr; /* PF device mac address */ + struct rte_ether_addr dev_addr; /* PF device mac address */ uint64_t flags; /* PF feature flags */ /* All kinds of queue pair setting for different VSIs */ struct i40e_pf_vf *vfs; @@ -1024,7 +1024,7 @@ struct i40e_vf { uint16_t promisc_flags; /* Promiscuous setting */ uint32_t vlan[I40E_VFTA_SIZE]; /* VLAN bit map */ - struct ether_addr mc_addrs[I40E_NUM_MACADDR_MAX]; /* Multicast addrs */ + struct rte_ether_addr mc_addrs[I40E_NUM_MACADDR_MAX]; /* Multicast addrs */ uint16_t mc_addrs_num; /* Multicast mac addresses number */ /* Event from pf */ @@ -1132,7 +1132,7 @@ int i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on); int i40e_vsi_add_vlan(struct i40e_vsi *vsi, uint16_t vlan); int i40e_vsi_delete_vlan(struct i40e_vsi *vsi, uint16_t vlan); int i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *filter); -int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr); +int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr); void i40e_update_vsi_stats(struct i40e_vsi *vsi); void i40e_pf_disable_irq0(struct i40e_hw *hw); void i40e_pf_enable_irq0(struct i40e_hw *hw); @@ -1207,7 +1207,7 @@ int i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, int i40e_fdir_flush(struct rte_eth_dev *dev); int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, - int num, struct ether_addr *addr); + int num, struct rte_ether_addr *addr); int i40e_remove_macvlan_filters(struct i40e_vsi *vsi, struct i40e_macvlan_filter *filter, int total); diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index add7b2223..6fe062d16 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -106,7 +106,7 @@ static int i40evf_dev_tx_queue_start(struct rte_eth_dev *dev, static int i40evf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); static int i40evf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, uint32_t pool); static void i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index); @@ -123,7 +123,7 @@ static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int @@ -134,10 +134,10 @@ static void i40evf_handle_pf_event(struct rte_eth_dev *dev, static int i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr, bool add); static int -i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, +i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* Default hash key buffer for RSS */ @@ -776,7 +776,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev) static int i40evf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -818,7 +818,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev, static void i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct virtchnl_ether_addr_list *list; struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); @@ -859,7 +859,7 @@ static void i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) { struct rte_eth_dev_data *data = dev->data; - struct ether_addr *addr; + struct rte_ether_addr *addr; addr = &data->mac_addrs[index]; @@ -1273,7 +1273,7 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - if (is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; else eth_random_addr(hw->mac.addr); /* Generate a random one */ @@ -1511,7 +1511,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); return 0; @@ -1930,7 +1930,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) int next_begin = 0; int begin = 0; uint32_t len; - struct ether_addr *addr; + struct rte_ether_addr *addr; struct vf_cmd_info args; do { @@ -2702,7 +2702,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2715,18 +2715,18 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, if (vf->flags & I40E_FLAG_VF_MAC_BY_PF) return -EPERM; - i40evf_del_mac_addr_by_addr(dev, (struct ether_addr *)hw->mac.addr); + i40evf_del_mac_addr_by_addr(dev, (struct rte_ether_addr *)hw->mac.addr); if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0) return -EIO; - ether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } static int i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addrs, + struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num, bool add) { struct virtchnl_ether_addr_list *list; @@ -2780,7 +2780,7 @@ i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, } static int -i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addrs, +i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4b32fee1e..dd940cecb 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -685,7 +685,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, { static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; - uint8_t len = 2 * sizeof(struct ether_addr); + uint8_t len = 2 * sizeof(struct rte_ether_addr); struct ipv4_hdr *ip; struct ipv6_hdr *ip6; static const uint8_t next_proto[] = { @@ -701,7 +701,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, [RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), @@ -959,7 +959,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, struct i40e_customized_pctype *cus_pctype = NULL; static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; - uint8_t len = 2 * sizeof(struct ether_addr); + uint8_t len = 2 * sizeof(struct rte_ether_addr); struct ipv4_hdr *ip; struct ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; @@ -977,7 +977,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 3694df255..ae88ccd48 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -4803,10 +4803,10 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, int ret = 0; memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct ether_addr *)&filter->input.outer_mac, - (struct ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct ether_addr *)&filter->input.inner_mac, - (struct ether_addr *)&cld_filter.element.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, + (struct rte_ether_addr *)&cld_filter.element.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, + (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = filter->input.inner_vlan; cld_filter.element.flags = filter->input.flags; cld_filter.element.tenant_id = filter->input.tenant_id; diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 91be45027..4d7001df5 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -349,7 +349,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; ether_addr_copy(&vf->mac_addr, - (struct ether_addr *)vf_res->vsi_res[0].default_mac_addr); + (struct rte_ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_VF_RESOURCES, @@ -823,7 +823,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, (struct virtchnl_ether_addr_list *)msg; struct i40e_mac_filter_info filter; int i; - struct ether_addr *mac; + struct rte_ether_addr *mac; if (!b_op) { i40e_pf_host_send_msg_to_vf( @@ -842,7 +842,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 ether_addr *)(addr_list->list[i].addr); + mac = (struct rte_ether_addr *)(addr_list->list[i].addr); rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; if (is_zero_ether_addr(mac) || @@ -869,7 +869,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf, struct virtchnl_ether_addr_list *addr_list = (struct virtchnl_ether_addr_list *)msg; int i; - struct ether_addr *mac; + struct rte_ether_addr *mac; if (!b_op) { i40e_pf_host_send_msg_to_vf( @@ -886,7 +886,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf, } for (i = 0; i < addr_list->num_elements; i++) { - mac = (struct ether_addr *)(addr_list->list[i].addr); + mac = (struct rte_ether_addr *)(addr_list->list[i].addr); if(is_zero_ether_addr(mac) || i40e_vsi_delete_mac(vf->vsi, mac)) { ret = I40E_ERR_INVALID_MAC_ADDR; diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index 45a15d3ab..633dca6c3 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -324,7 +324,7 @@ i40e_vf_representor_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index) static int i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_vf_representor *representor = ethdev->data->dev_private; diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index 7ae78e426..e6f18ab28 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -529,7 +529,7 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on) int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_mac_filter *f; struct rte_eth_dev *dev; @@ -571,11 +571,11 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, return 0; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct i40e_pf_vf *vf; @@ -724,7 +724,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, struct i40e_vsi *vsi; struct i40e_hw *hw; struct i40e_mac_filter_info filter; - struct ether_addr broadcast = { + struct rte_ether_addr broadcast = { .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; int ret; @@ -2355,7 +2355,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct i40e_pf_vf *vf; @@ -2492,10 +2492,10 @@ rte_pmd_i40e_flow_type_mapping_update( } int -rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct ether_addr *vf_mac) +rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct rte_ether_addr *vf_mac) { struct rte_eth_dev *dev; - struct ether_addr *mac; + struct rte_ether_addr *mac; struct i40e_pf *pf; int vf_id; struct i40e_pf_vf *vf; diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h index be4a6024a..55e7fa9f9 100644 --- a/drivers/net/i40e/rte_pmd_i40e.h +++ b/drivers/net/i40e/rte_pmd_i40e.h @@ -453,7 +453,7 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Remove the VF MAC address. @@ -471,7 +471,7 @@ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, */ int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable vf vlan strip for all queues in a pool @@ -854,7 +854,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); #define RTE_PMD_I40E_PCTYPE_MAX 64 #define RTE_PMD_I40E_FLOW_TYPE_MAX 64 @@ -924,7 +924,7 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port); * -ENOTSUP: i40e not supported for this port. */ int rte_pmd_i40e_query_vfid_by_mac(uint16_t port, - const struct ether_addr *vf_mac); + const struct rte_ether_addr *vf_mac); /** * Do RSS queue region configuration for that port as diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index e6e3e8d30..e8f453bd8 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -211,6 +211,6 @@ int iavf_query_stats(struct iavf_adapter *adapter, int iavf_config_promisc(struct iavf_adapter *adapter, bool enable_unicast, bool enable_multicast); int iavf_add_del_eth_addr(struct iavf_adapter *adapter, - struct ether_addr *addr, bool add); + struct rte_ether_addr *addr, bool add); int iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add); #endif /* _IAVF_ETHDEV_H_ */ diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 846e604a6..7ecd86804 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -47,7 +47,7 @@ static void iavf_dev_promiscuous_disable(struct rte_eth_dev *dev); static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev); static void iavf_dev_allmulticast_disable(struct rte_eth_dev *dev); static int iavf_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, uint32_t pool); static void iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index); @@ -66,7 +66,7 @@ static int iavf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, @@ -687,7 +687,7 @@ iavf_dev_allmulticast_disable(struct rte_eth_dev *dev) } static int -iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr, +iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -718,7 +718,7 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct ether_addr *addr; + struct rte_ether_addr *addr; int err; addr = &dev->data->mac_addrs[index]; @@ -930,16 +930,16 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter); - struct ether_addr *perm_addr, *old_addr; + struct rte_ether_addr *perm_addr, *old_addr; int ret; - old_addr = (struct ether_addr *)hw->mac.addr; - perm_addr = (struct ether_addr *)hw->mac.perm_addr; + old_addr = (struct rte_ether_addr *)hw->mac.addr; + perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; if (is_same_ether_addr(mac_addr, old_addr)) return 0; @@ -973,7 +973,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, if (ret) return -EIO; - ether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } @@ -1244,9 +1244,9 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) /* If the MAC address is not configured by host, * generate a random one. */ - if (!is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) + if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) eth_random_addr(hw->mac.addr); - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* register callback func to eal lib */ diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 6381fb63c..0303e7809 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -636,7 +636,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) { struct virtchnl_ether_addr_list *list; struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct ether_addr *addr; + struct rte_ether_addr *addr; struct iavf_cmd_info args; int len, err, i, j; int next_begin = 0; @@ -753,7 +753,7 @@ iavf_config_promisc(struct iavf_adapter *adapter, } int -iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct ether_addr *addr, +iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr, bool add) { struct virtchnl_ether_addr_list *list; diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 9d0101870..092051a9c 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -54,9 +54,9 @@ static int ice_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int ice_macaddr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int ice_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t pool); static void ice_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); @@ -480,29 +480,29 @@ ice_init_mac_address(struct rte_eth_dev *dev) struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (!is_unicast_ether_addr - ((struct ether_addr *)hw->port_info[0].mac.lan_addr)) { + ((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr)) { PMD_INIT_LOG(ERR, "Invalid MAC address"); return -EINVAL; } - ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.lan_addr, - (struct ether_addr *)hw->port_info[0].mac.perm_addr); + ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, + (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); - dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct ether_addr), 0); + dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0); if (!dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to allocate memory to store mac address"); return -ENOMEM; } /* store it to dev data */ - ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, &dev->data->mac_addrs[0]); return 0; } /* Find out specific MAC filter */ static struct ice_mac_filter * -ice_find_mac_filter(struct ice_vsi *vsi, struct ether_addr *macaddr) +ice_find_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *macaddr) { struct ice_mac_filter *f; @@ -515,7 +515,7 @@ ice_find_mac_filter(struct ice_vsi *vsi, struct ether_addr *macaddr) } static int -ice_add_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) +ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) { struct ice_fltr_list_entry *m_list_itr = NULL; struct ice_mac_filter *f; @@ -574,7 +574,7 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) } static int -ice_remove_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) +ice_remove_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) { struct ice_fltr_list_entry *m_list_itr = NULL; struct ice_mac_filter *f; @@ -1123,9 +1123,9 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) struct ice_vsi *vsi = NULL; struct ice_vsi_ctx vsi_ctx; int ret; - struct ether_addr broadcast = { + struct rte_ether_addr broadcast = { .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; uint8_t tc_bitmap = 0x1; @@ -2234,7 +2234,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } static int ice_macaddr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -2281,7 +2281,7 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int ice_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -2305,7 +2305,7 @@ ice_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_vsi *vsi = pf->main_vsi; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; int ret; macaddr = &data->mac_addrs[index]; diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 9c29f225e..6fea15aa1 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -123,7 +123,7 @@ struct ice_adapter; * MAC filter structure */ struct ice_mac_filter_info { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; TAILQ_HEAD(ice_mac_filter_list, ice_mac_filter); @@ -240,7 +240,7 @@ struct ice_pf { struct ice_res_pool_info qp_pool; /*Queue pair pool */ struct ice_res_pool_info msix_pool; /* MSIX interrupt pool */ struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ - struct ether_addr dev_addr; /* PF device mac address */ + struct rte_ether_addr dev_addr; /* PF device mac address */ uint64_t flags; /* PF feature flags */ uint16_t hash_lut_size; /* The size of hash lookup table */ uint16_t lan_nb_qp_max; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 975fa474c..a3b045e71 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -223,11 +223,11 @@ static void ixgbe_dev_interrupt_handler(void *param); static void ixgbe_dev_interrupt_delayed_handler(void *param); static void ixgbe_dev_setup_link_alarm_handler(void *param); -static int ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +static int ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index); static int ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config); static bool is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv); @@ -268,7 +268,7 @@ static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev); /* For Eth VMDQ APIs support */ static int ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct - ether_addr * mac_addr, uint8_t on); + rte_ether_addr * mac_addr, uint8_t on); static int ixgbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on); static int ixgbe_mirror_rule_set(struct rte_eth_dev *dev, struct rte_eth_mirror_conf *mirror_conf, @@ -284,11 +284,11 @@ static void ixgbe_set_ivar_map(struct ixgbe_hw *hw, int8_t direction, static void ixgbe_configure_msix(struct rte_eth_dev *dev); static int ixgbevf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); static int ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int ixgbe_syn_filter_get(struct rte_eth_dev *dev, struct rte_eth_syn_filter *filter); static int ixgbe_syn_filter_handle(struct rte_eth_dev *dev, @@ -315,7 +315,7 @@ static int ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu); static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); static int ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info); @@ -1222,7 +1222,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ @@ -1530,7 +1530,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw) } static void -generate_random_mac_addr(struct ether_addr *mac_addr) +generate_random_mac_addr(struct rte_ether_addr *mac_addr) { uint64_t random; @@ -1561,7 +1561,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) IXGBE_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private); struct ixgbe_hwstrip *hwstrip = IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private); - struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *) hw->mac.perm_addr; PMD_INIT_FUNC_TRACE(); @@ -4898,7 +4898,7 @@ ixgbe_dev_rss_reta_query(struct rte_eth_dev *dev, } static int -ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4917,7 +4917,7 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) } static int -ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -5367,7 +5367,7 @@ ixgbe_vt_check(struct ixgbe_hw *hw) } static uint32_t -ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr) +ixgbe_uta_vector(struct ixgbe_hw *hw, struct rte_ether_addr *uc_addr) { uint32_t vector = 0; @@ -5398,7 +5398,7 @@ ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr) } static int -ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint8_t on) { uint32_t vector; @@ -6030,7 +6030,7 @@ ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev, } static int -ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __attribute__((unused)) uint32_t index, __attribute__((unused)) uint32_t pool) { @@ -6042,7 +6042,7 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * operation. Trap this case to avoid exhausting the [very limited] * set of PF resources used to store VF MAC addresses. */ - if (memcmp(hw->mac.perm_addr, mac_addr, sizeof(struct ether_addr)) == 0) + if (memcmp(hw->mac.perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) return -1; diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes); if (diag != 0) @@ -6062,8 +6062,8 @@ static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr; - struct ether_addr *mac_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *) hw->mac.perm_addr; + struct rte_ether_addr *mac_addr; uint32_t i; int diag; @@ -6088,7 +6088,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) if (is_zero_ether_addr(mac_addr)) continue; /* Skip the permanent MAC address */ - if (memcmp(perm_addr, mac_addr, sizeof(struct ether_addr)) == 0) + if (memcmp(perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) continue; diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes); if (diag != 0) @@ -6107,7 +6107,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } static int -ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -6836,13 +6836,13 @@ ixgbe_dev_addr_list_itr(__attribute__((unused)) struct ixgbe_hw *hw, *vmdq = 0; mc_addr = *mc_addr_ptr; - *mc_addr_ptr = (mc_addr + sizeof(struct ether_addr)); + *mc_addr_ptr = (mc_addr + sizeof(struct rte_ether_addr)); return mc_addr; } static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct ixgbe_hw *hw; diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index fafff6b03..6180c9473 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -463,7 +463,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) { + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c index 5d2e3e023..2c01f6e33 100644 --- a/drivers/net/ixgbe/ixgbe_vf_representor.c +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c @@ -25,7 +25,7 @@ ixgbe_vf_representor_link_update(struct rte_eth_dev *ethdev, static int ixgbe_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ixgbe_vf_representor *representor = ethdev->data->dev_private; @@ -211,7 +211,7 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) vf_data = *IXGBE_DEV_PRIVATE_TO_P_VFDATA( representor->pf_ethdev->data->dev_private); - ethdev->data->mac_addrs = (struct ether_addr *) + ethdev->data->mac_addrs = (struct rte_ether_addr *) vf_data[representor->vf_id].vf_mac_addresses; /* Link state. Inherited from PF */ diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 3a874f9a9..3defba175 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -11,7 +11,7 @@ int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ixgbe_hw *hw; struct ixgbe_vf_info *vfinfo; @@ -35,7 +35,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); rar_entry = hw->mac.num_rar_entries - (vf + 1); - if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) { + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, ETHER_ADDR_LEN); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h index 72a941f9d..84c688472 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h @@ -42,7 +42,7 @@ int rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf); * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable VF VLAN anti spoofing. diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 89f44737c..a88469223 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -54,7 +54,7 @@ struct pmd_internals { int stop_thread; int no_request_thread; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct pmd_queue rx_queues[KNI_MAX_QUEUE_PER_PORT]; struct pmd_queue tx_queues[KNI_MAX_QUEUE_PER_PORT]; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index c9cabd65a..925581a78 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1835,7 +1835,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) 2 + i)); /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)mac, ð_dev->data->mac_addrs[0]); + ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); /* enable firmware checksum support for tunnel packets */ lio_enable_hw_tunnel_rx_checksum(eth_dev); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 252658fc6..01678df2d 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -972,7 +972,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) struct ibv_pd *pd = NULL; struct mlx4_priv *priv = NULL; struct rte_eth_dev *eth_dev = NULL; - struct ether_addr mac; + struct rte_ether_addr mac; char name[RTE_ETH_NAME_MAX_LEN]; /* If port is not enabled, skip. */ diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 1db23d6cc..13e1b31e2 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -189,7 +189,7 @@ struct mlx4_priv { } mr; LIST_HEAD(, mlx4_rss) rss; /**< Shared targets for Rx flow rules. */ LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */ - struct ether_addr mac[MLX4_MAX_MAC_ADDRESSES]; + struct rte_ether_addr mac[MLX4_MAX_MAC_ADDRESSES]; /**< Configured MAC addresses. Unused entries are zeroed. */ struct mlx4_verbs_alloc_ctx verbs_alloc_ctx; /**< Context for Verbs allocator. */ @@ -211,9 +211,9 @@ void mlx4_promiscuous_disable(struct rte_eth_dev *dev); void mlx4_allmulticast_enable(struct rte_eth_dev *dev); void mlx4_allmulticast_disable(struct rte_eth_dev *dev); void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); -int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); -int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); +int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); void mlx4_stats_reset(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 4dae67a1b..20715390e 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -463,7 +463,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { struct mlx4_priv *priv = dev->data->dev_private; @@ -541,7 +541,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { return mlx4_mac_addr_add(dev, mac_addr, 0, 0); } diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 038dc71d3..ea2709b29 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -1355,7 +1355,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) .type = RTE_FLOW_ACTION_TYPE_END, }, }; - struct ether_addr *rule_mac = ð_spec.dst; + struct rte_ether_addr *rule_mac = ð_spec.dst; rte_be16_t *rule_vlan = (ETH_DEV(priv)->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_VLAN_FILTER) && @@ -1392,7 +1392,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) } } for (i = 0; i != RTE_DIM(priv->mac) + 1; ++i) { - const struct ether_addr *mac; + const struct rte_ether_addr *mac; /* Broadcasts are handled by an extra iteration. */ if (i < RTE_DIM(priv->mac)) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index f571ba2e9..194c87aae 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1143,7 +1143,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, unsigned int mprq_max_stride_size_n = 0; unsigned int mprq_min_stride_num_n = 0; unsigned int mprq_max_stride_num_n = 0; - struct ether_addr mac; + struct rte_ether_addr mac; char name[RTE_ETH_NAME_MAX_LEN]; int own_domain_id = 0; uint16_t port_id; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index ef05d9f97..d9d3179df 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -289,7 +289,7 @@ struct mlx5_priv { struct rte_eth_dev_data *dev_data; /* Pointer to device data. */ struct mlx5_ibv_shared *sh; /* Shared IB device context. */ uint32_t ibv_port; /* IB device port number. */ - struct ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */ + struct rte_ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */ BITFIELD_DECLARE(mac_own, uint64_t, MLX5_MAX_MAC_ADDRESSES); /* Bit-field of MAC addresses owned by the PMD. */ uint16_t vlan_filter[MLX5_MAX_VLAN_IDS]; /* VLAN filters table. */ @@ -403,11 +403,11 @@ bool mlx5_translate_port_name(const char *port_name_in, int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[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 ether_addr *mac, +int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq); -int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); +int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr); + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* mlx5_rss.c */ @@ -510,9 +510,9 @@ void mlx5_mp_uninit_secondary(void); /* mlx5_nl.c */ int mlx5_nl_init(int protocol); -int mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +int mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); -int mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +int mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev); void mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 52be8b32c..fbcb2880b 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1050,13 +1050,13 @@ static int flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, size_t *size, struct rte_flow_error *error) { - struct ether_hdr *eth = NULL; - struct vlan_hdr *vlan = NULL; + struct rte_ether_hdr *eth = NULL; + struct rte_vlan_hdr *vlan = NULL; struct ipv4_hdr *ipv4 = NULL; struct ipv6_hdr *ipv6 = NULL; struct udp_hdr *udp = NULL; - struct vxlan_hdr *vxlan = NULL; - struct vxlan_gpe_hdr *vxlan_gpe = NULL; + struct rte_vxlan_hdr *vxlan = NULL; + struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; struct gre_hdr *gre = NULL; size_t len; size_t temp_size = 0; @@ -1076,10 +1076,10 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, rte_memcpy((void *)&buf[temp_size], items->spec, len); switch (items->type) { case RTE_FLOW_ITEM_TYPE_ETH: - eth = (struct ether_hdr *)&buf[temp_size]; + eth = (struct rte_ether_hdr *)&buf[temp_size]; break; case RTE_FLOW_ITEM_TYPE_VLAN: - vlan = (struct vlan_hdr *)&buf[temp_size]; + vlan = (struct rte_vlan_hdr *)&buf[temp_size]; if (!eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1137,7 +1137,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv6->proto = IPPROTO_UDP; break; case RTE_FLOW_ITEM_TYPE_VXLAN: - vxlan = (struct vxlan_hdr *)&buf[temp_size]; + vxlan = (struct rte_vxlan_hdr *)&buf[temp_size]; if (!udp) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1150,7 +1150,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, RTE_BE32(MLX5_ENCAP_VXLAN_FLAGS); break; case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: - vxlan_gpe = (struct vxlan_gpe_hdr *)&buf[temp_size]; + vxlan_gpe = (struct rte_vxlan_gpe_hdr *)&buf[temp_size]; if (!udp) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 3006f8386..90f586675 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -402,7 +402,7 @@ struct mlx5_flow_tcf_context { struct tcf_neigh_rule { LIST_ENTRY(tcf_neigh_rule) next; uint32_t refcnt; - struct ether_addr eth; + struct rte_ether_addr eth; uint16_t mask; union { struct { @@ -475,8 +475,8 @@ struct flow_tcf_vxlan_encap { uint8_t ip_tos; uint8_t ip_ttl_hop; struct { - struct ether_addr dst; - struct ether_addr src; + struct rte_ether_addr dst; + struct rte_ether_addr src; } eth; union { struct { @@ -689,8 +689,8 @@ flow_tcf_pedit_key_set_mac(const struct rte_flow_action *actions, { int idx = p_parser->sel.nkeys; uint32_t off = actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_SRC ? - offsetof(struct ether_hdr, s_addr) : - offsetof(struct ether_hdr, d_addr); + offsetof(struct rte_ether_hdr, s_addr) : + offsetof(struct rte_ether_hdr, d_addr); const struct rte_flow_action_set_mac *conf = (const struct rte_flow_action_set_mac *)actions->conf; diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index bce026f98..9f6b89a82 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -76,7 +76,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], index); - memset(&dev->data->mac_addrs[index], 0, sizeof(struct ether_addr)); + memset(&dev->data->mac_addrs[index], 0, sizeof(struct rte_ether_addr)); } /** @@ -93,7 +93,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -166,7 +166,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq __rte_unused) { int ret; @@ -195,7 +195,7 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { DRV_LOG(DEBUG, "port %u setting primary MAC address", dev->data->port_id); @@ -209,7 +209,7 @@ mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) */ int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { uint32_t i; int ret; diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index fd9226bdd..e0de54489 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -80,7 +80,7 @@ /* Add/remove MAC address through Netlink */ struct mlx5_nl_mac_addr { - struct ether_addr (*mac)[]; + struct rte_ether_addr (*mac)[]; /**< MAC address handled by the device. */ int mac_n; /**< Number of addresses in the array. */ }; @@ -365,7 +365,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], +mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr (*mac)[], int *mac_n) { struct mlx5_priv *priv = dev->data->dev_private; @@ -424,7 +424,7 @@ mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, int add) { struct mlx5_priv *priv = dev->data->dev_private; @@ -496,7 +496,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -524,7 +524,7 @@ mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -542,7 +542,7 @@ mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) { - struct ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; + struct rte_ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; int macs_n = 0; int i; int ret; @@ -583,7 +583,7 @@ mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev) int i; for (i = MLX5_MAX_MAC_ADDRESSES - 1; i >= 0; --i) { - struct ether_addr *m = &dev->data->mac_addrs[i]; + struct rte_ether_addr *m = &dev->data->mac_addrs[i]; if (BITFIELD_ISSET(priv->mac_own, i)) mlx5_nl_mac_addr_remove(dev, m, i); diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index ced994588..9aadacafc 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -780,7 +780,7 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, * in if any of SWP offsets is set. Therefore, all of the L3 offsets * should be set regardless of HW offload. */ - off = buf->outer_l2_len + (vlan ? sizeof(struct vlan_hdr) : 0); + off = buf->outer_l2_len + (vlan ? sizeof(struct rte_vlan_hdr) : 0); offsets[1] = off >> 1; /* Outer L3 offset. */ off += buf->outer_l3_len; if (tunnel == PKT_TX_TUNNEL_UDP) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 5b73f0ff0..d8a6b50b0 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -274,7 +274,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", }; const unsigned int vlan_filter_n = priv->vlan_filter_n; - const struct ether_addr cmp = { + const struct rte_ether_addr cmp = { .addr_bytes = "\x00\x00\x00\x00\x00\x00", }; unsigned int i; @@ -337,7 +337,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) } /* Add MAC address flows. */ for (i = 0; i != MLX5_MAX_MAC_ADDRESSES; ++i) { - struct ether_addr *mac = &dev->data->mac_addrs[i]; + struct rte_ether_addr *mac = &dev->data->mac_addrs[i]; if (!memcmp(mac, &cmp, sizeof(*mac))) continue; diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 8923a1634..d539ba6a1 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -617,7 +617,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative error value otherwise. */ static int -mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +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; @@ -650,7 +650,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * MAC address to register. */ static int -mvneta_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mvneta_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct mvneta_priv *priv = dev->data->dev_private; int ret; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index ce52f0901..8647c9b0d 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1102,7 +1102,7 @@ mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative error value otherwise. */ static int -mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +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; @@ -1154,7 +1154,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * 0 on success, negative error value otherwise. */ static int -mrvl_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mrvl_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct mrvl_priv *priv = dev->data->dev_private; int ret; diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index ffd1dab9b..738986575 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -989,7 +989,7 @@ mrvl_parse_eth(const struct rte_flow_item *item, struct rte_flow *flow, struct rte_flow_error *error) { const struct rte_flow_item_eth *spec = NULL, *mask = NULL; - struct ether_addr zero; + struct rte_ether_addr zero; int ret; ret = mrvl_parse_init(item, (const void **)&spec, (const void **)&mask, diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 407ee4849..dadff166e 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -289,7 +289,7 @@ hn_dev_allmulticast_disable(struct rte_eth_dev *dev) static int hn_dev_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { /* No filtering on the synthetic path, but can do it on VF */ diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index c67e9ae25..cfb502523 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -108,7 +108,7 @@ static void hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) { uint32_t s = m->pkt_len; - const struct ether_addr *ea; + const struct rte_ether_addr *ea; if (s == 64) { stats->size_bins[1]++; @@ -127,7 +127,7 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) stats->size_bins[7]++; } - ea = rte_pktmbuf_mtod(m, const struct ether_addr *); + ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) stats->broadcast++; diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index 8383f3246..6d0a4eeb8 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -131,7 +131,7 @@ struct hn_data { rte_atomic32_t rndis_req_id; uint8_t rndis_resp[256]; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_dev_owner owner; struct rte_intr_handle vf_intr; @@ -212,7 +212,7 @@ void hn_vf_allmulticast_disable(struct rte_eth_dev *dev); void hn_vf_promiscuous_enable(struct rte_eth_dev *dev); void hn_vf_promiscuous_disable(struct rte_eth_dev *dev); int hn_vf_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); int hn_vf_link_update(struct rte_eth_dev *dev, diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index 883272ff4..6a851a8ff 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -32,12 +32,12 @@ /* Search for VF with matching MAC address, return port id */ static int hn_vf_match(const struct rte_eth_dev *dev) { - const struct ether_addr *mac = dev->data->mac_addrs; + const struct rte_ether_addr *mac = dev->data->mac_addrs; int i; RTE_ETH_FOREACH_DEV(i) { const struct rte_eth_dev *vf_dev = &rte_eth_devices[i]; - const struct ether_addr *vf_mac = vf_dev->data->mac_addrs; + const struct rte_ether_addr *vf_mac = vf_dev->data->mac_addrs; if (vf_dev == dev) continue; @@ -391,7 +391,7 @@ void hn_vf_promiscuous_disable(struct rte_eth_dev *dev) } int hn_vf_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct hn_data *hv = dev->data->dev_private; diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 3e6178c7b..c1b42e504 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -119,7 +119,7 @@ static int nfp_net_rss_reta_write(struct rte_eth_dev *dev, static int nfp_net_rss_hash_write(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int nfp_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE(_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) @@ -553,7 +553,7 @@ nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) } int -nfp_set_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct nfp_net_hw *hw; uint32_t update, ctrl; @@ -2962,7 +2962,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_vf_read_mac(hw); } - if (!is_valid_assigned_ether_addr((struct ether_addr *)&hw->mac_addr)) { + if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { PMD_INIT_LOG(INFO, "Using random mac address for port %d", port); /* Using random mac addresses for VFs */ @@ -2971,7 +2971,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) } /* Copying mac address to DPDK eth_dev struct */ - ether_addr_copy((struct ether_addr *)hw->mac_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 159c1c1fd..7683511cf 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -73,7 +73,7 @@ struct pmd_internals { struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT]; struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT]; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; /** Bit mask of RSS offloads, the bit offset also means flow type */ uint64_t flow_type_rss_offloads; @@ -467,7 +467,7 @@ eth_rss_hash_conf_get(struct rte_eth_dev *dev, static int eth_mac_address_set(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct ether_addr *addr) + __rte_unused struct rte_ether_addr *addr) { return 0; } diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 046e12986..643479254 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -555,7 +555,7 @@ octeontx_dev_stats_reset(struct rte_eth_dev *dev) static int octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct octeontx_nic *nic = octeontx_pmd_priv(dev); int ret; diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 353538f16..7655b3a7a 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -78,7 +78,7 @@ struct pmd_internals { struct pcap_rx_queue rx_queue[RTE_PMD_PCAP_MAX_QUEUES]; struct pcap_tx_queue tx_queue[RTE_PMD_PCAP_MAX_QUEUES]; char devargs[ETH_PCAP_ARG_MAXLEN]; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; int if_index; int single_iface; int phy_mac; @@ -953,7 +953,7 @@ pmd_init_internals(struct rte_vdev_device *vdev, * derived from: 'locally administered':'p':'c':'a':'p':'iface_idx' * where the middle 4 characters are converted to hex. */ - (*internals)->eth_addr = (struct ether_addr) { + (*internals)->eth_addr = (struct rte_ether_addr) { .addr_bytes = { 0x02, 0x70, 0x63, 0x61, 0x70, iface_idx++ } }; (*internals)->phy_mac = 0; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index b2fd2fd90..205740016 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -559,9 +559,9 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); struct qede_ucast_entry *tmp = NULL; struct qede_ucast_entry *u; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; - mac_addr = (struct ether_addr *)ucast->mac; + mac_addr = (struct rte_ether_addr *)ucast->mac; if (add) { SLIST_FOREACH(tmp, &qdev->uc_list_head, list) { if ((memcmp(mac_addr, &tmp->mac, @@ -605,7 +605,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } static int -qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, +qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); @@ -629,7 +629,7 @@ qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, mcast.num_mc_addrs = mc_addrs_num; mcast.opcode = ECORE_FILTER_ADD; for (i = 0; i < mc_addrs_num; i++) - ether_addr_copy(&mc_addrs[i], (struct ether_addr *) + ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) &mcast.mac[i]); rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { @@ -654,7 +654,7 @@ static int qede_del_mcast_filters(struct rte_eth_dev *eth_dev) mcast.opcode = ECORE_FILTER_REMOVE; j = 0; SLIST_FOREACH(tmp, &qdev->mc_list_head, list) { - ether_addr_copy(&tmp->mac, (struct ether_addr *)&mcast.mac[j]); + ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); j++; } rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); @@ -701,7 +701,7 @@ qede_mac_int_ops(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } static int -qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, +qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct ecore_filter_ucast ucast; @@ -713,7 +713,7 @@ qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, qede_set_ucast_cmn_params(&ucast); ucast.opcode = ECORE_FILTER_ADD; ucast.type = ECORE_FILTER_MAC; - ether_addr_copy(mac_addr, (struct ether_addr *)&ucast.mac); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); re = (int)qede_mac_int_ops(eth_dev, &ucast, 1); return re; } @@ -742,13 +742,13 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) /* Use the index maintained by rte */ ether_addr_copy(ð_dev->data->mac_addrs[index], - (struct ether_addr *)&ucast.mac); + (struct rte_ether_addr *)&ucast.mac); qede_mac_int_ops(eth_dev, &ucast, false); } static int -qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr) +qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); @@ -1757,7 +1757,7 @@ static void qede_allmulticast_disable(struct rte_eth_dev *eth_dev) } static int -qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, +qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); @@ -2549,7 +2549,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) } if (!is_vf) { - ether_addr_copy((struct ether_addr *)edev->hwfns[0]. + ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. hw_info.hw_mac_addr, ð_dev->data->mac_addrs[0]); ether_addr_copy(ð_dev->data->mac_addrs[0], @@ -2565,7 +2565,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) &is_mac_forced); if (is_mac_exist) { DP_INFO(edev, "VF macaddr received from PF\n"); - ether_addr_copy((struct ether_addr *)&vf_mac, + ether_addr_copy((struct rte_ether_addr *)&vf_mac, ð_dev->data->mac_addrs[0]); ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index c06274d94..d0e7c70be 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -140,12 +140,12 @@ struct qede_vlan_entry { }; struct qede_mcast_entry { - struct ether_addr mac; + struct rte_ether_addr mac; SLIST_ENTRY(qede_mcast_entry) list; }; struct qede_ucast_entry { - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t vlan; uint16_t vni; SLIST_ENTRY(qede_ucast_entry) list; @@ -228,7 +228,7 @@ struct qede_dev { SLIST_HEAD(vlan_list_head, qede_vlan_entry)vlan_list_head; uint16_t configured_vlans; bool accept_any_vlan; - struct ether_addr primary_mac; + struct rte_ether_addr primary_mac; SLIST_HEAD(mc_list_head, qede_mcast_entry) mc_list_head; uint16_t num_mc_addr; SLIST_HEAD(uc_list_head, qede_ucast_entry) uc_list_head; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 5e6571ca6..27fbe538a 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -465,8 +465,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; - len = 2 * sizeof(struct ether_addr); - raw_pkt += 2 * sizeof(struct ether_addr); + len = 2 * sizeof(struct rte_ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); ether_type = (uint16_t *)raw_pkt; raw_pkt += sizeof(uint16_t); len += sizeof(uint16_t); diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h index ee5e54c19..b840c743c 100644 --- a/drivers/net/qede/qede_if.h +++ b/drivers/net/qede/qede_if.h @@ -59,7 +59,7 @@ struct qed_dev_eth_info { uint8_t num_queues; uint8_t num_tc; - struct ether_addr port_mac; + struct rte_ether_addr port_mac; uint16_t num_vlan_filters; uint32_t num_mac_filters; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 27bac0995..0e8a3675b 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -950,23 +950,23 @@ static inline uint8_t qede_check_notunn_csum_l4(uint16_t flag) static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - struct vlan_hdr *vlan_hdr; + struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; uint16_t len; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); - len = sizeof(struct ether_hdr); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); + len = sizeof(struct rte_ether_hdr); ethertype = rte_cpu_to_be_16(eth_hdr->ether_type); /* Note: Valid only if VLAN stripping is disabled */ if (ethertype == ETHER_TYPE_VLAN) { vlan_tagged = 1; - vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - len += sizeof(struct vlan_hdr); + 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); } @@ -1153,7 +1153,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; calc_csum = rte_ipv4_cksum(ip); diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 115a882b5..49419b26b 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -51,7 +51,7 @@ struct pmd_internals { struct ring_queue rx_ring_queues[RTE_PMD_RING_MAX_RX_RINGS]; struct ring_queue tx_ring_queues[RTE_PMD_RING_MAX_TX_RINGS]; - struct ether_addr address; + struct rte_ether_addr address; enum dev_action action; }; @@ -215,7 +215,7 @@ eth_mac_addr_remove(struct rte_eth_dev *dev __rte_unused, static int eth_mac_addr_add(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mac_addr __rte_unused, + struct rte_ether_addr *mac_addr __rte_unused, uint32_t index __rte_unused, uint32_t vmdq __rte_unused) { diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index ecd20e546..dde25c553 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -134,7 +134,7 @@ struct sfc_port { boolean_t promisc; boolean_t allmulti; - struct ether_addr default_mac_addr; + struct rte_ether_addr default_mac_addr; unsigned int max_mcast_addrs; unsigned int nb_mcast_addrs; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 6c33601e7..2a5fb22e3 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -931,12 +931,12 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) return -rc; } static int -sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); struct sfc_port *port = &sa->port; - struct ether_addr *old_addr = &dev->data->mac_addrs[0]; + struct rte_ether_addr *old_addr = &dev->data->mac_addrs[0]; int rc = 0; sfc_adapter_lock(sa); @@ -1015,7 +1015,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) static int -sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, +sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); @@ -2015,7 +2015,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) struct sfc_adapter *sa; int rc; const efx_nic_cfg_t *encp; - const struct ether_addr *from; + const struct rte_ether_addr *from; sfc_register_dp(); @@ -2087,7 +2087,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) * The arguments are really reverse order in comparison to * Linux kernel. Copy from NIC config to Ethernet device data. */ - from = (const struct ether_addr *)(encp->enc_mac_addr); + from = (const struct rte_ether_addr *)(encp->enc_mac_addr); ether_addr_copy(from, &dev->data->mac_addrs[0]); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 1709dba4e..8de5f0c60 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -227,7 +227,7 @@ sfc_port_start(struct sfc_adapter *sa) goto fail_mac_pdu_set; if (!sfc_sa2shared(sa)->isolated) { - struct ether_addr *addr = &port->default_mac_addr; + struct rte_ether_addr *addr = &port->default_mac_addr; sfc_log_init(sa, "set MAC address"); rc = efx_mac_addr_set(sa->nic, addr->addr_bytes); @@ -386,7 +386,7 @@ sfc_port_attach(struct sfc_adapter *sa) { struct sfc_port *port = &sa->port; const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); - const struct ether_addr *from; + const struct rte_ether_addr *from; uint32_t mac_nstats; size_t mac_stats_size; long kvarg_stats_update_period_ms; @@ -401,7 +401,7 @@ sfc_port_attach(struct sfc_adapter *sa) port->flow_ctrl_autoneg = B_TRUE; RTE_BUILD_BUG_ON(sizeof(encp->enc_mac_addr) != sizeof(*from)); - from = (const struct ether_addr *)(encp->enc_mac_addr); + from = (const struct rte_ether_addr *)(encp->enc_mac_addr); ether_addr_copy(from, &port->default_mac_addr); port->max_mcast_addrs = EFX_MAC_MULTICAST_LIST_MAX; diff --git a/drivers/net/softnic/parser.c b/drivers/net/softnic/parser.c index a8688a21e..7ea6eb4fa 100644 --- a/drivers/net/softnic/parser.c +++ b/drivers/net/softnic/parser.c @@ -528,13 +528,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -568,7 +568,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -596,15 +596,15 @@ softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -softnic_parse_mac_addr(const char *token, struct ether_addr *addr) +softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; } diff --git a/drivers/net/softnic/parser.h b/drivers/net/softnic/parser.h index 1ee3f82a7..6f408b248 100644 --- a/drivers/net/softnic/parser.h +++ b/drivers/net/softnic/parser.h @@ -49,7 +49,7 @@ int softnic_parse_hex_string(char *src, uint8_t *dst, uint32_t *size); int softnic_parse_ipv4_addr(const char *token, struct in_addr *ipv4); int softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6); -int softnic_parse_mac_addr(const char *token, struct ether_addr *addr); +int softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr); int softnic_parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 32b001fd3..4bda2f2b0 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -339,7 +339,7 @@ pmd_free(struct pmd_internals *p) rte_free(p); } -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = {0}, }; diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 88448eff6..43a66432a 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -105,7 +105,7 @@ struct szedata2_tx_queue { int szedata2_logtype_init; int szedata2_logtype_driver; -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 } }; @@ -1332,7 +1332,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, static int eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mac_addr __rte_unused) + struct rte_ether_addr *mac_addr __rte_unused) { return 0; } @@ -1514,7 +1514,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi) eth_link_update(dev, 0); /* Allocate space for one mac address */ - data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr), + data->mac_addrs = rte_zmalloc(data->name, sizeof(struct rte_ether_addr), RTE_CACHE_LINE_SIZE); if (data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Could not alloc space for MAC address!"); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index e9fda8cf6..3206c533f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -261,7 +261,7 @@ tap_verify_csum(struct rte_mbuf *mbuf) uint32_t l2 = mbuf->packet_type & RTE_PTYPE_L2_MASK; uint32_t l3 = mbuf->packet_type & RTE_PTYPE_L3_MASK; uint32_t l4 = mbuf->packet_type & RTE_PTYPE_L4_MASK; - unsigned int l2_len = sizeof(struct ether_hdr); + unsigned int l2_len = sizeof(struct rte_ether_hdr); unsigned int l3_len; uint16_t cksum = 0; void *l3_hdr; @@ -1150,7 +1150,7 @@ tap_allmulti_disable(struct rte_eth_dev *dev) } static int -tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct pmd_internals *pmd = dev->data->dev_private; enum ioctl_mode mode = LOCAL_ONLY; @@ -1172,14 +1172,14 @@ tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY); if (ret < 0) return ret; - if (is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) return 0; /* Check the current MAC address on the remote */ ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY); if (ret < 0) return ret; - if (!is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (!is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; @@ -1458,7 +1458,7 @@ tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int tap_set_mc_addr_list(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mc_addr_set __rte_unused, + struct rte_ether_addr *mc_addr_set __rte_unused, uint32_t nb_mc_addr __rte_unused) { /* @@ -1682,7 +1682,7 @@ static const char *tuntap_types[ETH_TUNTAP_TYPE_MAX] = { static int eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, - char *remote_iface, struct ether_addr *mac_addr, + char *remote_iface, struct rte_ether_addr *mac_addr, enum rte_tuntap_type type) { int numa_node = rte_socket_id(); @@ -1957,7 +1957,7 @@ set_remote_iface(const char *key __rte_unused, return 0; } -static int parse_user_mac(struct ether_addr *user_mac, +static int parse_user_mac(struct rte_ether_addr *user_mac, const char *value) { unsigned int index = 0; @@ -1985,7 +1985,7 @@ set_mac_type(const char *key __rte_unused, const char *value, void *extra_args) { - struct ether_addr *user_mac = extra_args; + struct rte_ether_addr *user_mac = extra_args; if (!value) return 0; @@ -2188,7 +2188,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) int speed; char tap_name[RTE_ETH_NAME_MAX_LEN]; char remote_iface[RTE_ETH_NAME_MAX_LEN]; - struct ether_addr user_mac = { .addr_bytes = {0} }; + struct rte_ether_addr user_mac = { .addr_bytes = {0} }; struct rte_eth_dev *eth_dev; int tap_devices_count_increased = 0; diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h index dc3579ac0..529b0aeca 100644 --- a/drivers/net/tap/rte_eth_tap.h +++ b/drivers/net/tap/rte_eth_tap.h @@ -70,7 +70,7 @@ struct pmd_internals { char remote_iface[RTE_ETH_NAME_MAX_LEN]; /* Remote netdevice name */ char name[RTE_ETH_NAME_MAX_LEN]; /* Internal Tap device name */ int type; /* Type field - TUN|TAP */ - struct ether_addr eth_addr; /* Mac address of the device port */ + struct rte_ether_addr eth_addr; /* Mac address of the device port */ struct ifreq remote_initial_flags; /* Remote netdevice flags on init */ int remote_if_index; /* remote netdevice IF_INDEX */ int if_index; /* IF_INDEX for the port */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index 532e8838f..2b1dba15b 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -37,7 +37,7 @@ #define KEY_IDX 0 #define BPF_MAP_ID_KEY 1 -struct vlan_hdr { +struct rte_vlan_hdr { __be16 proto; __be16 tci; }; @@ -141,12 +141,12 @@ rss_l3_l4(struct __sk_buff *skb) /* Get correct proto for 802.1ad */ if (skb->vlan_present && skb->vlan_proto == htons(ETH_P_8021AD)) { - if (data + ETH_ALEN * 2 + sizeof(struct vlan_hdr) + + if (data + ETH_ALEN * 2 + sizeof(struct rte_vlan_hdr) + sizeof(proto) > data_end) return TC_ACT_OK; proto = *(__u16 *)(data + ETH_ALEN * 2 + - sizeof(struct vlan_hdr)); - off += sizeof(struct vlan_hdr); + sizeof(struct rte_vlan_hdr)); + off += sizeof(struct rte_vlan_hdr); } if (proto == htons(ETH_P_IP)) { diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c index 8f83d41dd..2a793a4b1 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.c +++ b/drivers/net/thunderx/base/nicvf_mbox.c @@ -135,8 +135,8 @@ nicvf_handle_mbx_intr(struct nicvf *nic) nic->node = mbx.nic_cfg.node_id; nic->sqs_mode = mbx.nic_cfg.sqs_mode; nic->loopback_supported = mbx.nic_cfg.loopback_supported; - ether_addr_copy((struct ether_addr *)mbx.nic_cfg.mac_addr, - (struct ether_addr *)nic->mac_addr); + ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, + (struct rte_ether_addr *)nic->mac_addr); nic->pf_acked = true; break; case NIC_MBOX_MSG_ACK: diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 879d88998..ec2087924 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2179,10 +2179,10 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) ret = -ENOMEM; goto alarm_fail; } - if (is_zero_ether_addr((struct ether_addr *)nic->mac_addr)) + if (is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) eth_random_addr(&nic->mac_addr[0]); - ether_addr_copy((struct ether_addr *)nic->mac_addr, + ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, ð_dev->data->mac_addrs[0]); ret = nicvf_mbox_set_mac_addr(nic, nic->mac_addr); diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index 801f54c96..ef02fdcdd 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -68,7 +68,7 @@ struct vdev_netvsc_ctx { char devargs[256]; /**< Fail-safe device arguments. */ char if_name[IF_NAMESIZE]; /**< NetVSC netdevice name. */ unsigned int if_index; /**< NetVSC netdevice index. */ - struct ether_addr if_addr; /**< NetVSC MAC address. */ + struct rte_ether_addr if_addr; /**< NetVSC MAC address. */ int pipe[2]; /**< Fail-safe communication pipe. */ char yield[256]; /**< PCI sub-device arguments. */ }; @@ -157,7 +157,7 @@ vdev_netvsc_iface_is_netvsc(const struct if_nameindex *iface) */ static int vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap), int is_netvsc, ...) { struct if_nameindex *iface = if_nameindex(); @@ -178,7 +178,7 @@ vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface, for (i = 0; iface[i].if_name; ++i) { int is_netvsc_ret; struct ifreq req; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; va_list ap; is_netvsc_ret = vdev_netvsc_iface_is_netvsc(&iface[i]) ? 1 : 0; @@ -368,7 +368,7 @@ vdev_netvsc_sysfs_readlink(char *buf, size_t size, const char *if_name, */ static int vdev_netvsc_device_probe(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap) { struct vdev_netvsc_ctx *ctx = va_arg(ap, struct vdev_netvsc_ctx *); @@ -507,7 +507,7 @@ vdev_netvsc_alarm(__rte_unused void *arg) */ static int vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap) { const char *name = va_arg(ap, const char *); @@ -527,7 +527,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, if (!strcmp(pair->value, iface->if_name)) break; } else if (!strcmp(pair->key, VDEV_NETVSC_ARG_MAC)) { - struct ether_addr tmp; + struct rte_ether_addr tmp; if (sscanf(pair->value, "%" SCNx8 ":%" SCNx8 ":%" SCNx8 ":" diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index b2cda0483..6705e90db 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -43,7 +43,7 @@ static const char *valid_arguments[] = { NULL }; -static struct ether_addr base_eth_addr = { +static struct rte_ether_addr base_eth_addr = { .addr_bytes = { 0x56 /* V */, 0x48 /* H */, @@ -325,10 +325,10 @@ static inline void vhost_count_multicast_broadcast(struct vhost_queue *vq, struct rte_mbuf *mbuf) { - struct ether_addr *ea = NULL; + struct rte_ether_addr *ea = NULL; struct vhost_stats *pstats = &vq->stats; - ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *); + ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) pstats->xstats[VHOST_BROADCAST_PKT]++; @@ -1206,7 +1206,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name, struct rte_eth_dev_data *data; struct pmd_internal *internal = NULL; struct rte_eth_dev *eth_dev = NULL; - struct ether_addr *eth_addr = NULL; + struct rte_ether_addr *eth_addr = NULL; struct rte_vhost_vring_state *vring_state = NULL; struct internal_list *list = NULL; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 2272bb2e5..d34d94482 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -65,11 +65,11 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev); static int virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int virtio_mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); static int virtio_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int virtio_intr_disable(struct rte_eth_dev *dev); @@ -1142,11 +1142,11 @@ virtio_mac_table_set(struct virtio_hw *hw, } static int -virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq __rte_unused) { struct virtio_hw *hw = dev->data->dev_private; - const struct ether_addr *addrs = dev->data->mac_addrs; + const struct rte_ether_addr *addrs = dev->data->mac_addrs; unsigned int i; struct virtio_net_ctrl_mac *uc, *mc; @@ -1161,7 +1161,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, mc->entries = 0; for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { - const struct ether_addr *addr + const struct rte_ether_addr *addr = (i == index) ? mac_addr : addrs + i; struct virtio_net_ctrl_mac *tbl = is_multicast_ether_addr(addr) ? mc : uc; @@ -1176,7 +1176,7 @@ static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct virtio_hw *hw = dev->data->dev_private; - struct ether_addr *addrs = dev->data->mac_addrs; + struct rte_ether_addr *addrs = dev->data->mac_addrs; struct virtio_net_ctrl_mac *uc, *mc; unsigned int i; @@ -1204,7 +1204,7 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) } static int -virtio_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct virtio_hw *hw = dev->data->dev_private; @@ -1395,7 +1395,7 @@ virtio_notify_peers(struct rte_eth_dev *dev) return; rarp_mbuf = rte_net_make_rarp_packet(rxvq->mpool, - (struct ether_addr *)hw->mac_addr); + (struct rte_ether_addr *)hw->mac_addr); if (rarp_mbuf == NULL) { PMD_DRV_LOG(ERR, "failed to make RARP packet."); return; @@ -1662,7 +1662,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Copy the permanent MAC address to: virtio_hw */ virtio_get_hwaddr(hw); - ether_addr_copy((struct ether_addr *) hw->mac_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index e6f3706d6..d6f46586e 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1092,7 +1092,7 @@ static inline void virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) { uint32_t s = mbuf->pkt_len; - struct ether_addr *ea; + struct rte_ether_addr *ea; stats->bytes += s; @@ -1113,7 +1113,7 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) stats->size_bins[7]++; } - ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *); + ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) stats->broadcast++; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 93e5de9a7..2c42f2677 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -91,7 +91,7 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on); static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); static int vmxnet3_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static void vmxnet3_interrupt_handler(void *param); int vmxnet3_logtype_init; @@ -311,7 +311,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -1185,11 +1185,11 @@ vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev) } static int -vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct vmxnet3_hw *hw = dev->data->dev_private; - ether_addr_copy(mac_addr, (struct ether_addr *)(hw->perm_addr)); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); vmxnet3_write_mac(hw, mac_addr->addr_bytes); return 0; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index d30914a8a..a2c047ec6 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -676,7 +676,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, ptr = rte_pktmbuf_mtod(rxm, char *); slen = rte_pktmbuf_data_len(rxm); - hlen = sizeof(struct ether_hdr); + hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) @@ -703,7 +703,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) return hw->mtu - hlen - sizeof(struct tcp_hdr) + - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); tcp_hdr = (struct tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; @@ -712,7 +712,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, return (rte_pktmbuf_pkt_len(rxm) - hlen + rxm->udata64 - 1) / rxm->udata64; else - return hw->mtu - hlen + sizeof(struct ether_hdr); + return hw->mtu - hlen + sizeof(struct rte_ether_hdr); } /* Receive side checksum and other offloads */ diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index d68c06aef..9fa492978 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -273,7 +273,7 @@ signal_handler(int signum) } static void -print_mac(unsigned int portid, struct ether_addr *bbdev_ports_eth_address) +print_mac(unsigned int portid, struct rte_ether_addr *bbdev_ports_eth_address) { printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", (unsigned int) portid, @@ -341,14 +341,14 @@ check_port_link_status(uint16_t port_id) static inline void add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst) { - struct ether_hdr *eth_from; - struct ether_hdr *eth_to; + struct rte_ether_hdr *eth_from; + struct rte_ether_hdr *eth_to; - eth_from = rte_pktmbuf_mtod(pkt_src, struct ether_hdr *); - eth_to = rte_pktmbuf_mtod(pkt_dst, struct ether_hdr *); + eth_from = rte_pktmbuf_mtod(pkt_src, struct rte_ether_hdr *); + eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *); /* copy header */ - rte_memcpy(eth_to, eth_from, sizeof(struct ether_hdr)); + rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); } static inline void @@ -377,7 +377,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, for (i = 0; i < num_pkts; ++i) { uint16_t pkt_data_len = rte_pktmbuf_data_len(mbufs[i]) - - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* Resize the packet if needed */ if (pkt_data_len < ncb) { @@ -395,7 +395,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, for (l = start_bit_idx; l < start_bit_idx + d; ++l) { uint8_t *data = rte_pktmbuf_mtod_offset( mbufs[i], uint8_t *, - sizeof(struct ether_hdr) + (l >> 3)); + sizeof(struct rte_ether_hdr) + (l >> 3)); if (*data & (0x80 >> (l & 7))) temp_buf[out_idx] = LLR_1_BIT; else @@ -410,7 +410,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, } rte_memcpy(rte_pktmbuf_mtod_offset(mbufs[i], uint8_t *, - sizeof(struct ether_hdr)), temp_buf, ncb); + sizeof(struct rte_ether_hdr)), temp_buf, ncb); } } @@ -423,9 +423,9 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts) struct rte_mbuf *in = out->userdata; if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *, - sizeof(struct ether_hdr)), + sizeof(struct rte_ether_hdr)), rte_pktmbuf_mtod_offset(out, uint8_t *, - sizeof(struct ether_hdr)), + sizeof(struct rte_ether_hdr)), K / 8 - CRC_24B_LEN)) printf("Input and output buffers are not equal!\n"); } @@ -439,7 +439,7 @@ initialize_ports(struct app_config_params *app_params, uint16_t port_id = app_params->port_id; uint16_t q; /* ethernet addresses of ports */ - struct ether_addr bbdev_port_eth_addr; + struct rte_ether_addr bbdev_port_eth_addr; /* initialize ports */ printf("\nInitializing port %u...\n", app_params->port_id); @@ -707,14 +707,14 @@ run_encoding(struct lcore_conf *lcore_conf) char *data; const uint16_t pkt_data_len = rte_pktmbuf_data_len(rx_pkts_burst[i]) - - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* save input mbuf pointer for later comparison */ enc_out_pkts[i]->userdata = rx_pkts_burst[i]; /* copy ethernet header */ rte_pktmbuf_reset(enc_out_pkts[i]); data = rte_pktmbuf_append(enc_out_pkts[i], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (data == NULL) { printf( "Not enough space for ethernet header in encoder output mbuf\n"); @@ -728,7 +728,7 @@ run_encoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_enc.input.data = rx_pkts_burst[i]; bbdev_ops_burst[i]->turbo_enc.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* Encoder will attach the CRC24B, adjust the length */ bbdev_ops_burst[i]->turbo_enc.input.length = in_data_len; @@ -746,7 +746,7 @@ run_encoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_enc.output.data = enc_out_pkts[i]; bbdev_ops_burst[i]->turbo_enc.output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); } /* Enqueue packets on BBDevice */ @@ -834,15 +834,15 @@ run_decoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_dec.input.data = recv_pkts_burst[i]; bbdev_ops_burst[i]->turbo_dec.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); bbdev_ops_burst[i]->turbo_dec.input.length = rte_pktmbuf_data_len(recv_pkts_burst[i]) - - sizeof(struct ether_hdr); + - sizeof(struct rte_ether_hdr); bbdev_ops_burst[i]->turbo_dec.hard_output.data = recv_pkts_burst[i]; bbdev_ops_burst[i]->turbo_dec.hard_output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); } /* Enqueue packets on BBDevice */ diff --git a/examples/bond/main.c b/examples/bond/main.c index cf7335ddf..8b510cab8 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -201,7 +201,7 @@ slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) "Start port %d failed (res=%d)", portid, retval); - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(portid, &addr); printf("Port %u MAC: ", portid); @@ -291,7 +291,7 @@ bond_port_init(struct rte_mempool *mbuf_pool) rte_eth_promiscuous_enable(BOND_PORT); - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(BOND_PORT, &addr); printf("Port %u MAC: ", (unsigned)BOND_PORT); @@ -300,21 +300,21 @@ bond_port_init(struct rte_mempool *mbuf_pool) } static inline size_t -get_vlan_offset(struct ether_hdr *eth_hdr, uint16_t *proto) +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) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - vlan_offset = sizeof(struct vlan_hdr); + vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; - vlan_offset += sizeof(struct vlan_hdr); + vlan_offset += sizeof(struct rte_vlan_hdr); } } return vlan_offset; @@ -336,9 +336,9 @@ struct global_flag_stru_t *global_flag_stru_p = &global_flag_stru; static int lcore_main(__attribute__((unused)) void *arg1) { struct rte_mbuf *pkts[MAX_PKT_BURST] __rte_cache_aligned; - struct ether_addr d_addr; + struct rte_ether_addr d_addr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; @@ -370,7 +370,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[0]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - eth_hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + 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)) printf("VLAN taged frame, offset:"); @@ -449,7 +449,7 @@ static void cmd_obj_send_parsed(void *parsed_result, char ip_str[INET6_ADDRSTRLEN]; struct rte_mbuf *created_pkt; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; @@ -469,16 +469,16 @@ static void cmd_obj_send_parsed(void *parsed_result, return; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr); + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; - eth_hdr = rte_pktmbuf_mtod(created_pkt, struct ether_hdr *); + 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); - arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); + 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; @@ -698,7 +698,7 @@ static void cmd_show_parsed(__attribute__((unused)) void *parsed_result, { uint16_t slaves[16] = {0}; uint8_t len = 16; - struct ether_addr addr; + struct rte_ether_addr addr; uint16_t i = 0; while (i < slaves_count) { diff --git a/examples/distributor/main.c b/examples/distributor/main.c index b5499bb12..e4c8c3c18 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -179,7 +179,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return 0; } - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index a4e64b354..ce7f715f8 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -30,7 +30,7 @@ struct pcmd_intstr_params { struct pcmd_intmac_params { cmdline_fixed_string_t cmd; uint16_t port; - struct ether_addr mac; + struct rte_ether_addr mac; }; struct pcmd_str_params { cmdline_fixed_string_t cmd; @@ -475,7 +475,7 @@ pcmd_macaddr_callback(void *ptr_params, void *ptr_data) { struct pcmd_intmac_params *params = ptr_params; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; int stat; stat = 0; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index e23d3afd2..27c22cf90 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -32,7 +32,7 @@ struct txq_port { }; struct app_port { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct txq_port txq; rte_spinlock_t lock; int port_active; @@ -158,9 +158,9 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports) static void process_frame(struct app_port *ptr_port, struct rte_mbuf *ptr_frame) { - struct ether_hdr *ptr_mac_hdr; + struct rte_ether_hdr *ptr_mac_hdr; - ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct ether_hdr *); + ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *); ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); } diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index bf10139e7..299488c1c 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -303,7 +303,7 @@ rte_ethtool_net_stop(uint16_t port_id) } int -rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr) +rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); if (addr == NULL) @@ -314,7 +314,7 @@ rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr) } int -rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr) +rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { if (addr == NULL) return -EINVAL; @@ -323,7 +323,7 @@ rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr) int rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused, - struct ether_addr *addr) + struct rte_ether_addr *addr) { if (addr == NULL) return -EINVAL; diff --git a/examples/ethtool/lib/rte_ethtool.h b/examples/ethtool/lib/rte_ethtool.h index 31cd5ae4e..0ccceb1c3 100644 --- a/examples/ethtool/lib/rte_ethtool.h +++ b/examples/ethtool/lib/rte_ethtool.h @@ -260,7 +260,7 @@ int rte_ethtool_net_stop(uint16_t port_id); * - (0) if successful. * - (-ENODEV) if *port_id* invalid. */ -int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Setting the Ethernet device MAC address. @@ -276,7 +276,7 @@ int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr); * - (-EINVAL) if parameters invalid. * - others depends on the specific operations implementation. */ -int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Validate if the provided MAC address is valid unicast address @@ -292,7 +292,7 @@ int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr); * - (-EINVAL) if parameters invalid. * - others depends on the specific operations implementation. */ -int rte_ethtool_net_validate_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_validate_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Setting the Ethernet device maximum Tx unit. diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index 58f8904e0..63227f0d5 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -317,7 +317,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) } /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index a6cc912fb..ef23d963a 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -99,11 +99,11 @@ struct config_data cdata; static __rte_always_inline void exchange_mac(struct rte_mbuf *m) { - struct ether_hdr *eth; - struct ether_addr addr; + struct rte_ether_hdr *eth; + struct rte_ether_addr addr; /* change mac addresses on packet (to use mbuf data) */ - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_addr_copy(ð->d_addr, &addr); ether_addr_copy(&addr, ð->d_addr); } diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index 199612926..5ae81fab1 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -98,7 +98,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -108,7 +108,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -118,7 +118,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -131,7 +131,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -141,7 +141,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -192,7 +192,7 @@ static inline int port_init(uint8_t port, struct rte_mempool *mbuf_pool) { struct rte_eth_conf port_conf = port_conf_default; - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rx_rings = 1, tx_rings = 1; int retval; uint16_t q; diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index a582ac075..7b8e7c4fa 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -45,7 +45,7 @@ struct rte_flow *flow; #include "flow_blocks.c" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -56,7 +56,7 @@ static void main_loop(void) { struct rte_mbuf *mbufs[32]; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_flow_error error; uint16_t nb_rx; uint16_t i; @@ -71,7 +71,7 @@ main_loop(void) struct rte_mbuf *m = mbufs[j]; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index e90a61e35..175803078 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -60,7 +60,7 @@ * We have to consider the max possible overhead. */ #define MTU_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct vlan_hdr)) + (ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct rte_vlan_hdr)) /* * Default payload in bytes for the IPv6 packet. @@ -90,7 +90,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #ifndef IPv4_BYTES #define IPv4_BYTES_FMT "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 @@ -252,7 +252,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, port_out = port_in; /* Remove the Ethernet header and trailer from the input packet */ - rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); /* Build transmission burst */ len = qconf->tx_mbufs[port_out].len; @@ -340,13 +340,13 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, void *d_addr_bytes; m = qconf->tx_mbufs[port_out].m_table[i]; - struct ether_hdr *eth_hdr = (struct ether_hdr *) - rte_pktmbuf_prepend(m, (uint16_t)sizeof(struct ether_hdr)); + struct rte_ether_hdr *eth_hdr = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(m, (uint16_t)sizeof(struct rte_ether_hdr)); if (eth_hdr == NULL) { rte_panic("No headroom in mbuf.\n"); } - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); /* 02:00:00:00:00:xx */ d_addr_bytes = ð_hdr->d_addr.addr_bytes[0]; @@ -568,7 +568,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -669,11 +669,11 @@ check_ptype(int portid) static inline void parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index 74215857b..803537232 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -245,7 +245,7 @@ static void print_link_info(struct link *link, char *out, size_t out_size) { struct rte_eth_stats stats; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link eth_link; uint16_t mtu; @@ -4777,7 +4777,7 @@ cmd_pipeline_table_rule_delete_default(char **tokens, } static void -ether_addr_show(FILE *f, struct ether_addr *addr) +ether_addr_show(FILE *f, struct rte_ether_addr *addr) { fprintf(f, "%02x:%02x:%02x:%02x:%02x:%02x", (uint32_t)addr->addr_bytes[0], (uint32_t)addr->addr_bytes[1], diff --git a/examples/ip_pipeline/parser.c b/examples/ip_pipeline/parser.c index ffcdeb3a6..4777f9ffd 100644 --- a/examples/ip_pipeline/parser.c +++ b/examples/ip_pipeline/parser.c @@ -513,13 +513,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -553,7 +553,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -581,15 +581,15 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -parse_mac_addr(const char *token, struct ether_addr *addr) +parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; } diff --git a/examples/ip_pipeline/parser.h b/examples/ip_pipeline/parser.h index 261a8c858..4538f675d 100644 --- a/examples/ip_pipeline/parser.h +++ b/examples/ip_pipeline/parser.h @@ -47,7 +47,7 @@ int parse_hex_string(char *src, uint8_t *dst, uint32_t *size); int parse_ipv4_addr(const char *token, struct in_addr *ipv4); int parse_ipv6_addr(const char *token, struct in6_addr *ipv6); -int parse_mac_addr(const char *token, struct ether_addr *addr); +int parse_mac_addr(const char *token, struct rte_ether_addr *addr); int parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); struct cpu_core_params { diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 17b55d4c7..226153968 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -95,7 +95,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #ifndef IPv4_BYTES #define IPv4_BYTES_FMT "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 @@ -308,7 +308,7 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, struct lcore_queue_conf *qconf, uint64_t tms) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_ip_frag_tbl *tbl; struct rte_ip_frag_death_row *dr; struct rx_queue *rxq; @@ -318,7 +318,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, rxq = &qconf->rx_queue_list[queue]; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_port = portid; @@ -350,7 +350,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); } } @@ -388,7 +388,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); } } @@ -691,7 +691,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index ffbd00b08..10af1280a 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -233,9 +233,9 @@ static inline void prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) { uint8_t *nlp; - struct ether_hdr *eth; + struct rte_ether_hdr *eth; - eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + 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); nlp = RTE_PTR_ADD(nlp, offsetof(struct ip, ip_p)); @@ -325,11 +325,11 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, const struct lcore_conf *qconf) { struct ip *ip; - struct ether_hdr *ethhdr; + struct rte_ether_hdr *ethhdr; ip = rte_pktmbuf_mtod(pkt, struct ip *); - ethhdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); + ethhdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); if (ip->ip_v == IPVERSION) { pkt->ol_flags |= qconf->outbound.ipv4_offloads; @@ -352,9 +352,9 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, } memcpy(ðhdr->s_addr, ðaddr_tbl[port].src, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); memcpy(ðhdr->d_addr, ðaddr_tbl[port].dst, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } static inline void @@ -1426,7 +1426,7 @@ parse_args(int32_t argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -1437,7 +1437,7 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr) * Update destination ethaddr for the port. */ int -add_dst_ethaddr(uint16_t port, const struct ether_addr *addr) +add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr) { if (port >= RTE_DIM(ethaddr_tbl)) return -EINVAL; @@ -1833,7 +1833,7 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) uint16_t tx_queueid, rx_queueid, queue, lcore_id; int32_t ret, socket_id; struct lcore_conf *qconf; - struct ether_addr ethaddr; + struct rte_ether_addr ethaddr; struct rte_eth_conf local_port_conf = port_conf; rte_eth_dev_info_get(portid, &dev_info); diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 99f49d65f..ca4391849 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -300,7 +300,7 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, uint64_t *tx_offloads); int -add_dst_ethaddr(uint16_t port, const struct ether_addr *addr); +add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr); void enqueue_cop_burst(struct cdev_qp *cqp); diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c index b0a8ee23b..fc8c238fe 100644 --- a/examples/ipsec-secgw/parser.c +++ b/examples/ipsec-secgw/parser.c @@ -324,7 +324,7 @@ parse_uint8x16(const char *s, uint8_t *v, uint8_t ls) } static int -parse_mac(const char *str, struct ether_addr *addr) +parse_mac(const char *str, struct rte_ether_addr *addr) { uint32_t i; @@ -499,7 +499,7 @@ cfg_parse_neigh(void *parsed_result, __rte_unused struct cmdline *cl, int32_t rc; struct cfg_neigh_add_item *res; struct parse_status *st; - struct ether_addr mac; + struct rte_ether_addr mac; st = data; res = parsed_result; diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 1eef29159..a38aabe75 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -80,7 +80,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[MAX_PORTS]; +static struct rte_ether_addr ports_eth_addr[MAX_PORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -267,14 +267,14 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone) * and put it into the outgoing queue for the given port. */ static inline void -mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, +mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); ether_addr_copy(dest_addr, ðdr->d_addr); @@ -302,11 +302,11 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) uint16_t port; union { uint64_t as_int; - struct ether_addr as_addr; + struct rte_ether_addr as_addr; } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -535,7 +535,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/kni/main.c b/examples/kni/main.c index a58774a33..e4e27e87e 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -832,7 +832,7 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) } static void -print_ethaddr(const char *name, struct ether_addr *mac_addr) +print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); @@ -851,10 +851,10 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) } RTE_LOG(INFO, APP, "Configure mac address of %d\n", port_id); - print_ethaddr("Address:", (struct ether_addr *)mac_addr); + print_ethaddr("Address:", (struct rte_ether_addr *)mac_addr); ret = rte_eth_dev_default_mac_addr_set(port_id, - (struct ether_addr *)mac_addr); + (struct rte_ether_addr *)mac_addr); if (ret < 0) RTE_LOG(ERR, APP, "Failed to config mac_addr for port %d\n", port_id); @@ -912,7 +912,7 @@ kni_alloc(uint16_t port_id) } /* Get the interface default mac address */ rte_eth_macaddr_get(port_id, - (struct ether_addr *)&conf.mac_addr); + (struct rte_ether_addr *)&conf.mac_addr); rte_eth_dev_get_mtu(port_id, &conf.mtu); diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c index 0e6078aad..1a8af28e2 100644 --- a/examples/l2fwd-cat/l2fwd-cat.c +++ b/examples/l2fwd-cat/l2fwd-cat.c @@ -73,7 +73,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 06517b471..dd09855e7 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -79,7 +79,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint64_t l2fwd_enabled_port_mask; @@ -387,19 +387,19 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct rte_crypto_op *op, struct l2fwd_crypto_params *cparams) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; char *padding; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (eth_hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_IPv4)) return -1; - ipdata_offset = sizeof(struct ether_hdr); + ipdata_offset = sizeof(struct rte_ether_hdr); ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); @@ -593,10 +593,10 @@ l2fwd_send_packet(struct rte_mbuf *m, uint16_t port) static void l2fwd_mac_updating(struct rte_mbuf *m, uint16_t dest_portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index a4d28e178..033104d63 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -52,7 +52,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask; @@ -335,14 +335,14 @@ show_stats_cb(__rte_unused void *param) static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; int sent; unsigned dst_port; struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 0bf2b5336..21d19932d 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -58,7 +58,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask; @@ -165,14 +165,14 @@ print_stats(__attribute__((unused)) struct rte_timer *ptr_timer, static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; int sent; unsigned dst_port; struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 6c23215a5..c1d6797b0 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -59,7 +59,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask = 0; @@ -151,10 +151,10 @@ print_stats(void) static void l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index a322ce4f2..ed25f75d8 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -82,7 +82,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask; @@ -173,7 +173,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *c = (unsigned char)(ip >> 8 & 0xff);\ *d = (unsigned char)(ip & 0xff);\ } while (0) -#define OFF_ETHHEAD (sizeof(struct ether_hdr)) +#define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) #define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) #define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ @@ -544,7 +544,7 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) unsigned char a, b, c, d; struct ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); printf("Packet Src:%hhu.%hhu.%hhu.%hhu ", a, b, c, d); @@ -568,7 +568,7 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) uint32_t offset = sig & ~ACL_DENY_SIGNATURE; struct ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); printf("Packet Src"); for (i = 0; i < RTE_DIM(ipv6_hdr->src_addr); i += sizeof(uint16_t)) @@ -625,7 +625,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt_len) >= 0) { @@ -1754,7 +1754,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 3b448acc4..bcd584d3e 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -135,7 +135,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* ethernet addresses of ports */ static rte_spinlock_t locks[RTE_MAX_ETHPORTS]; @@ -618,11 +618,11 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, static inline void parse_ptype_one(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -661,18 +661,18 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -710,7 +710,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -1577,7 +1577,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 41137f978..2c0c89e21 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -112,7 +112,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -417,15 +417,15 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -788,7 +788,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index c962deac3..1893f8c3a 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -73,7 +73,7 @@ extern volatile bool force_quit; /* ethernet addresses of ports */ extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ extern uint32_t enabled_port_mask; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 5ec99f961..0c68aa01c 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,13 +68,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -121,10 +121,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, vector unsigned short dp1, static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; vector unsigned int te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index fa8f82be6..64e79b946 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -561,7 +561,7 @@ em_check_ptype(int portid) static inline void em_parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; void *l3; @@ -569,9 +569,9 @@ em_parse_ptype(struct rte_mbuf *m) struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - l3 = (uint8_t *)eth_hdr + sizeof(struct ether_hdr); + l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { ipv4_hdr = (struct ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 228164e26..5612ef378 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -9,20 +9,20 @@ static __rte_always_inline void l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); tcp_or_udp = m->packet_type & (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP); l3_ptypes = m->packet_type & RTE_PTYPE_L3_MASK; if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -55,7 +55,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 22c26dce3..5afe77591 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -92,7 +92,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); @@ -107,7 +107,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv6 headers.*/ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -142,7 +142,7 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, for (j = 0; j < EM_HASH_LOOKUP_COUNT && j < nb_rx; j++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (j = 0; j < n; j += EM_HASH_LOOKUP_COUNT) { @@ -160,7 +160,7 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, for (i = 0, pos = j + EM_HASH_LOOKUP_COUNT; i < EM_HASH_LOOKUP_COUNT && pos < nb_rx; i++, pos++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[pos], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } if (tcp_or_udp && (l3_type == RTE_PTYPE_L3_IPV4)) { diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 16c8b04ac..3ee2304b5 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -13,7 +13,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, union ipv4_5tuple_host *key) { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); @@ -25,17 +25,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 41e2be958..8156bbb90 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -13,7 +13,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); @@ -25,18 +25,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 35cf5eac0..6e7096c01 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -37,7 +37,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); @@ -52,7 +52,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv6 headers.*/ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -81,13 +81,13 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (nb_rx > 0) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[0], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (i = 1, j = 0; j < nb_rx; i++, j++) { if (i < nb_rx) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } dst_port[j] = em_get_dst_port(qconf, pkts_burst[j], portid); } diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index b1dc195ad..d7e1aef86 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -104,18 +104,18 @@ lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, { struct ipv6_hdr *ipv6_hdr; struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, @@ -136,7 +136,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, { uint32_t next_hop; struct ipv6_hdr *ipv6_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { return (uint16_t) ((rte_lpm_lookup(qconf->ipv4_lookup_struct, @@ -145,7 +145,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, @@ -372,11 +372,11 @@ lpm_check_ptype(int portid) static inline void lpm_parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index b68868f44..28635bf03 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -9,16 +9,16 @@ static __rte_always_inline void l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -51,7 +51,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index 4c9e2438b..b36e991ac 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -18,28 +18,28 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index 02ec0d802..a3e42cfa7 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -19,25 +19,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -98,14 +98,14 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (k) { for (i = 0; i < FWDSTEP; i++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (j = 0; j != k - FWDSTEP; j += FWDSTEP) { for (i = 0; i < FWDSTEP; i++) { rte_prefetch0(rte_pktmbuf_mtod( pkts_burst[j + i + FWDSTEP], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } processx4_step1(&pkts_burst[j], &dip, &ipv4_flag); @@ -125,17 +125,17 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, switch (m) { case 3: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 2: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 1: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; } diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 1d1615906..4603e0749 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -16,25 +16,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index 76ccdfa73..af2dc47ac 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -104,10 +104,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32x4_t te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = vld1q_u32((uint32_t *)eth_hdr); ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index ed5267c11..3349f2747 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -101,10 +101,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2) static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; __m128i te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index e4b99efe0..a91a0a16c 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -79,7 +79,7 @@ volatile bool force_quit; /* ethernet addresses of ports */ uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; xmm_t val_eth[RTE_MAX_ETHPORTS]; @@ -634,7 +634,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -889,14 +889,14 @@ main(int argc, char **argv) print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", - (const struct ether_addr *)&dest_eth_addr[portid]); + (const struct rte_ether_addr *)&dest_eth_addr[portid]); printf(", "); /* * prepare src MACs for each port. */ ether_addr_copy(&ports_eth_addr[portid], - (struct ether_addr *)(val_eth + portid) + 1); + (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ ret = init_mem(NB_MBUF); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index f3346d23b..9997c58f4 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -53,7 +53,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t lsi_enabled_port_mask = 0; @@ -163,13 +163,13 @@ print_stats(void) static void lsi_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port = lsi_dst_ports[portid]; int sent; struct rte_eth_dev_tx_buffer *buffer; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index 39a846a56..c4e6b4ac8 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -509,7 +509,7 @@ app_lcore_worker( pkt = lp->mbuf_in.array[j]; ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) { diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index 0ddc63e92..9a8e422d4 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -66,7 +66,7 @@ get_printable_mac_addr(uint16_t port) if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; if (unlikely(addresses[port][0]=='\0')){ - struct ether_addr mac; + struct rte_ether_addr mac; rte_eth_macaddr_get(port, &mac); snprintf(addresses[port], sizeof(addresses[port]), "%02x:%02x:%02x:%02x:%02x:%02x\n", diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index 149bfdd02..ca312029e 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -255,7 +255,7 @@ configure_tx_buffers(struct rte_eth_dev_tx_buffer *tx_buffer[]) static inline int configure_eth_port(uint16_t port_id) { - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rxRings = 1, txRings = 1; int ret; uint16_t q; diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 4f8747bc3..b29ed9e97 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -92,11 +92,11 @@ check_ptype(int portid) static inline void parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -186,7 +186,7 @@ static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ static uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static xmm_t val_eth[RTE_MAX_ETHPORTS]; @@ -884,39 +884,39 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { - struct ether_hdr *eth_hdr[8]; + struct rte_ether_hdr *eth_hdr[8]; struct ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; __m128i data[8]; - eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct ether_hdr *); - eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct ether_hdr *); - eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct ether_hdr *); - eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct ether_hdr *); - eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct ether_hdr *); - eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct ether_hdr *); - eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct ether_hdr *); - eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct rte_ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct rte_ether_hdr *); + eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct rte_ether_hdr *); + eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct rte_ether_hdr *); + eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct rte_ether_hdr *); + eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -967,28 +967,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) #endif /* End of #ifdef DO_RFC_1812_CHECKS */ data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); @@ -1094,13 +1094,13 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i mask1, union ipv6_5tuple_host *key) { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); @@ -1113,37 +1113,37 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { int32_t ret[8]; uint16_t dst_port[8]; - struct ether_hdr *eth_hdr[8]; + struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; - eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct ether_hdr *); - eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct ether_hdr *); - eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct ether_hdr *); - eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct ether_hdr *); - eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct ether_hdr *); - eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct ether_hdr *); - eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct ether_hdr *); - eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct rte_ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct rte_ether_hdr *); + eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct rte_ether_hdr *); + eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct rte_ether_hdr *); + eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct rte_ether_hdr *); + eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); get_ipv6_5tuple(m[1], mask1, mask2, &key[1]); @@ -1228,16 +1228,16 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -1270,7 +1270,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct); @@ -1346,7 +1346,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; struct ipv6_hdr *ipv6_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { return (uint16_t) ((rte_lpm_lookup( @@ -1355,7 +1355,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( @@ -1371,13 +1371,13 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; @@ -1403,25 +1403,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1503,13 +1503,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -3020,7 +3020,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; @@ -3576,14 +3576,14 @@ main(int argc, char **argv) print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", - (const struct ether_addr *)&dest_eth_addr[portid]); + (const struct rte_ether_addr *)&dest_eth_addr[portid]); printf(", "); /* * prepare src MACs for each port. */ ether_addr_copy(&ports_eth_addr[portid], - (struct ether_addr *)(val_eth + portid) + 1); + (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ ret = init_mem(NB_MBUF); diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 82ae71c19..7d28f59ce 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -53,7 +53,7 @@ static const struct rte_eth_conf port_conf_default = { }, }; -static const struct ether_addr ether_multicast = { +static const struct rte_ether_addr ether_multicast = { .addr_bytes = {0x01, 0x1b, 0x19, 0x0, 0x0, 0x0} }; @@ -334,7 +334,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) struct ptp_header *ptp_hdr; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(ptp_data->m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id); if (ptp_data->ptpset == 0) { @@ -361,20 +361,20 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) static void parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ptp_header *ptp_hdr; struct clock_id *client_clkid; struct ptp_message *ptp_msg; struct rte_mbuf *created_pkt; struct tstamp *origin_tstamp; - struct ether_addr eth_multicast = ether_multicast; + struct rte_ether_addr eth_multicast = ether_multicast; size_t pkt_size; int wait_us; struct rte_mbuf *m = ptp_data->m; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); if (memcmp(&ptp_data->master_clock_id, &ptp_hdr->source_port_id.clock_id, sizeof(struct clock_id)) != 0) @@ -382,7 +382,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) ptp_data->seqID_FOLLOWUP = rte_be_to_cpu_16(ptp_hdr->seq_id); ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(m, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); origin_tstamp = &ptp_msg->follow_up.precise_origin_tstamp; ptp_data->tstamp1.tv_nsec = ntohl(origin_tstamp->ns); @@ -393,11 +393,11 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) if (ptp_data->seqID_FOLLOWUP == ptp_data->seqID_SYNC) { created_pkt = rte_pktmbuf_alloc(mbuf_pool); - pkt_size = sizeof(struct ether_hdr) + + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct ptp_message); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; - eth_hdr = rte_pktmbuf_mtod(created_pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ @@ -406,7 +406,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) eth_hdr->ether_type = htons(PTP_PROTOCOL); ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(created_pkt, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ptp_msg->delay_req.hdr.seq_id = htons(ptp_data->seqID_SYNC); ptp_msg->delay_req.hdr.msg_type = DELAY_REQ; @@ -499,7 +499,7 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) uint16_t seq_id; ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(m, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); seq_id = rte_be_to_cpu_16(ptp_msg->delay_resp.hdr.seq_id); if (memcmp(&ptp_data->client_clock_id, &ptp_msg->delay_resp.req_port_id.clock_id, @@ -535,17 +535,17 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) static void parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { struct ptp_header *ptp_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == PTP_PROTOCOL) { ptp_data.m = m; ptp_data.portid = portid; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); switch (ptp_hdr->msg_type) { case SYNC: diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 9b0112449..9f3344bf1 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -145,7 +145,7 @@ app_pkt_handle(struct rte_mbuf *pkt, uint64_t time) { uint8_t input_color, output_color; uint8_t *pkt_data = rte_pktmbuf_mtod(pkt, uint8_t *); - uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct ether_hdr); + uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct rte_ether_hdr); uint8_t flow_id = (uint8_t)(pkt_data[APP_PKT_FLOW_POS] & (APP_FLOWS_MAX - 1)); input_color = pkt_data[APP_PKT_COLOR_POS]; enum policer_action action; diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index c55d38744..61e92a820 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -50,8 +50,8 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) { struct rte_mbuf *mbuf; struct ether_fc_frame *pause_frame; - struct ether_hdr *hdr; - struct ether_addr mac_addr; + struct rte_ether_hdr *hdr; + struct rte_ether_addr mac_addr; RTE_LOG_DP(DEBUG, USER1, "Sending PAUSE frame (duration=%d) on port %d\n", @@ -63,7 +63,7 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) return; /* Prepare a PAUSE frame */ - hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); pause_frame = (struct ether_fc_frame *) &hdr[1]; rte_eth_macaddr_get(port_id, &mac_addr); diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 2058be627..a277519f5 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -115,7 +115,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) if (retval < 0) return retval; - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 3b97fbd45..8bec351ec 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -275,7 +275,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index 404f1f165..a086c5a77 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -68,7 +68,7 @@ get_printable_mac_addr(uint16_t port) { static const char err_address[] = "00:00:00:00:00:00"; static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)]; - struct ether_addr mac; + struct rte_ether_addr mac; if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; @@ -253,7 +253,7 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index 4aba1dc38..7e3cd8715 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -82,7 +82,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c index e0fe7bd2f..9d8ab17dd 100644 --- a/examples/tep_termination/main.c +++ b/examples/tep_termination/main.c @@ -157,7 +157,7 @@ uint16_t ports[RTE_MAX_ETHPORTS]; static unsigned nb_ports; /**< The number of ports specified in command line */ /* ethernet addresses of ports */ -struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* heads for the main used and free linked lists for the data path. */ static struct virtio_net_data_ll *ll_root_used; diff --git a/examples/tep_termination/main.h b/examples/tep_termination/main.h index 966c63a51..7a70f7396 100644 --- a/examples/tep_termination/main.h +++ b/examples/tep_termination/main.h @@ -50,7 +50,7 @@ struct vhost_dev { /**< Memory region information for gpa to hpa translation. */ struct virtio_memory_regions_hpa *regions_hpa; /**< Device MAC address (Obtained on first TX packet). */ - struct ether_addr mac_address; + struct rte_ether_addr mac_address; /**< RX queue number. */ uint16_t rx_q; /**< Data core that the device is added to. */ diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 7732821d9..ed2a405d5 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -28,19 +28,19 @@ get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags) * header. */ static void -parse_ethernet(struct ether_hdr *eth_hdr, union tunnel_offload_info *info, +parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; uint16_t ethertype; - info->outer_l2_len = sizeof(struct ether_hdr); + info->outer_l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - info->outer_l2_len += sizeof(struct vlan_hdr); + 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); } @@ -68,7 +68,7 @@ parse_ethernet(struct ether_hdr *eth_hdr, union tunnel_offload_info *info, * Calculate the checksum of a packet in hardware */ static uint64_t -process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info) +process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info) { void *l3_hdr = NULL; uint8_t l4_proto; @@ -80,12 +80,12 @@ process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info) struct sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; - info->l2_len = sizeof(struct ether_hdr); + info->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - info->l2_len += sizeof(struct vlan_hdr); + 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); } @@ -141,7 +141,7 @@ decapsulation(struct rte_mbuf *pkt) uint16_t outer_header_len; struct udp_hdr *udp_hdr; union tunnel_offload_info info = { .data = 0 }; - struct ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); parse_ethernet(phdr, &info, &l4_proto); @@ -158,7 +158,7 @@ decapsulation(struct rte_mbuf *pkt) (pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0) return -1; outer_header_len = info.outer_l2_len + info.outer_l3_len - + sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr); + + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr); rte_pktmbuf_adj(pkt, outer_header_len); @@ -172,29 +172,29 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) uint64_t ol_flags = 0; uint32_t old_len = m->pkt_len, hash; union tunnel_offload_info tx_offload = { .data = 0 }; - struct ether_hdr *phdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ - struct ether_hdr *pneth = (struct ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) - + sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr)); + struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, + sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; - struct vxlan_hdr *vxlan = (struct vxlan_hdr *) &udp[1]; + struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; /* convert TX queue ID to vport ID */ vport_id = queue_id - 1; /* replace original Ethernet header with ours */ pneth = rte_memcpy(pneth, &app_l2_hdr[vport_id], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], sizeof(struct ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - - sizeof(struct ether_hdr)); + - sizeof(struct rte_ether_hdr)); /* outer IP checksum */ ol_flags |= PKT_TX_OUTER_IP_CKSUM; @@ -209,7 +209,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) m->l2_len += ETHER_VXLAN_HLEN; } - m->outer_l2_len = sizeof(struct ether_hdr); + m->outer_l2_len = sizeof(struct rte_ether_hdr); m->outer_l3_len = sizeof(struct ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; @@ -225,7 +225,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) udp->dgram_cksum = 0; udp->dgram_len = rte_cpu_to_be_16(old_len + sizeof(struct udp_hdr) - + sizeof(struct vxlan_hdr)); + + 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); diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index bff786a2a..780ae73cc 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -17,15 +17,15 @@ #define DEFAULT_VXLAN_PORT 4789 extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; -extern struct ether_hdr app_l2_hdr[VXLAN_N_PORTS]; +extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; struct vxlan_port { uint32_t vport_id; /**< VirtIO port id */ uint32_t peer_ip; /**< remote VTEP IP address */ - struct ether_addr peer_mac; /**< remote VTEP MAC address */ - struct ether_addr vport_mac; /**< VirtIO port MAC address */ + struct rte_ether_addr peer_mac; /**< remote VTEP MAC address */ + struct rte_ether_addr vport_mac; /**< VirtIO port MAC address */ } __rte_cache_aligned; struct vxlan_conf { diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index ad7fbe9c6..e4af7bc4d 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -49,7 +49,7 @@ struct vxlan_conf vxdev; struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; -struct ether_hdr app_l2_hdr[VXLAN_N_PORTS]; +struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ uint8_t vxlan_multicast_ips[2][4] = { {239, 1, 1, 1 }, {239, 1, 2, 1 } }; @@ -227,7 +227,7 @@ int vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) { int i, ret; - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; struct ipv4_hdr *ip; @@ -242,7 +242,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) } /* Learn MAC address of guest device from packet */ - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: This device is using an existing" diff --git a/examples/tep_termination/vxlan_setup.h b/examples/tep_termination/vxlan_setup.h index 2c20e2e39..4dc37d673 100644 --- a/examples/tep_termination/vxlan_setup.h +++ b/examples/tep_termination/vxlan_setup.h @@ -9,7 +9,7 @@ extern uint16_t nb_devices; extern uint16_t udp_port; extern uint8_t filter_idx; extern uint16_t ports[RTE_MAX_ETHPORTS]; -extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; extern uint32_t enable_stats; extern struct device_statistics dev_statistics[MAX_DEVICES]; extern uint8_t rx_decap; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 8f7b758c3..5a3614117 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -161,7 +161,7 @@ const uint16_t vlan_tags[] = { }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; static struct vhost_dev_tailq_list vhost_dev_list = TAILQ_HEAD_INITIALIZER(vhost_dev_list); @@ -660,7 +660,7 @@ static unsigned check_ports_num(unsigned nb_ports) } static __rte_always_inline struct vhost_dev * -find_vhost_dev(struct ether_addr *mac) +find_vhost_dev(struct rte_ether_addr *mac) { struct vhost_dev *vdev; @@ -680,11 +680,11 @@ find_vhost_dev(struct ether_addr *mac) static int link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m) { - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; int i, ret; /* Learn MAC address of guest device from packet */ - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (find_vhost_dev(&pkt_hdr->s_addr)) { RTE_LOG(ERR, VHOST_DATA, @@ -786,10 +786,10 @@ virtio_xmit(struct vhost_dev *dst_vdev, struct vhost_dev *src_vdev, static __rte_always_inline int virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m) { - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; struct vhost_dev *dst_vdev; - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_vdev = find_vhost_dev(&pkt_hdr->d_addr); if (!dst_vdev) @@ -824,7 +824,7 @@ find_local_dest(struct vhost_dev *vdev, struct rte_mbuf *m, uint32_t *offset, uint16_t *vlan_tag) { struct vhost_dev *dst_vdev; - struct ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_vdev = find_vhost_dev(&pkt_hdr->d_addr); if (!dst_vdev) @@ -866,7 +866,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) void *l3_hdr; struct ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); l3_hdr = (char *)eth_hdr + m->l2_len; @@ -910,10 +910,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) struct mbuf_table *tx_q; unsigned offset = 0; const uint16_t lcore_id = rte_lcore_id(); - struct ether_hdr *nh; + struct rte_ether_hdr *nh; - nh = rte_pktmbuf_mtod(m, struct ether_hdr *); + nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) { struct vhost_dev *vdev2; @@ -946,10 +946,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) /*Add packet to the port tx queue*/ tx_q = &lcore_tx_queue[lcore_id]; - nh = rte_pktmbuf_mtod(m, struct ether_hdr *); + nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (unlikely(nh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN))) { /* Guest has inserted the vlan tag. */ - struct vlan_hdr *vh = (struct vlan_hdr *) (nh + 1); + struct rte_vlan_hdr *vh = (struct rte_vlan_hdr *) (nh + 1); uint16_t vlan_tag_be = rte_cpu_to_be_16(vlan_tag); if ((vm2vm_mode == VM2VM_HARDWARE) && (vh->vlan_tci != vlan_tag_be)) diff --git a/examples/vhost/main.h b/examples/vhost/main.h index 764c33afe..7cba0edbf 100644 --- a/examples/vhost/main.h +++ b/examples/vhost/main.h @@ -35,7 +35,7 @@ struct vhost_dev { /**< Number of memory regions for gpa to hpa translation. */ uint32_t nregions_hpa; /**< Device MAC address (Obtained on first TX packet). */ - struct ether_addr mac_address; + struct rte_ether_addr mac_address; /**< RX VMDQ queue number. */ uint16_t vmdq_rx_q; /**< Vlan tag assigned to the pool */ diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 74df0fe20..a2bec6242 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -56,12 +56,12 @@ static struct policy policies[MAX_CLIENTS]; #ifdef USE_JANSSON union PFID { - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t pfid; }; static int -str_to_ether_addr(const char *a, struct ether_addr *ether_addr) +str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr) { int i; char *end; @@ -403,7 +403,7 @@ get_pfid(struct policy *pol) RTE_ETH_FOREACH_DEV(x) { ret = rte_pmd_i40e_query_vfid_by_mac(x, - (struct ether_addr *)&(pol->pkt.vfid[i])); + (struct rte_ether_addr *)&(pol->pkt.vfid[i])); if (ret != -EINVAL) { pol->port[i] = x; break; diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c index 2d9e7689a..78c3aa0a1 100644 --- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c @@ -34,7 +34,7 @@ struct cmd_quit_result { }; union PFID { - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t pfid; }; diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 893bf4cdd..f018e1509 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -99,7 +99,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", @@ -348,7 +348,7 @@ main(int argc, char **argv) /* Initialize ports. */ RTE_ETH_FOREACH_DEV(portid) { - struct ether_addr eth; + struct rte_ether_addr eth; int w, j; int ret; diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 627a5da48..5195a515a 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -106,12 +106,12 @@ const uint16_t num_vlans = RTE_DIM(vlan_tags); static uint16_t num_pf_queues, num_vmdq_queues; static uint16_t vmdq_pool_base, vmdq_queue_base; /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ -static struct ether_addr pool_addr_template = { +static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; #define MAX_QUEUE_NUM_10G 128 #define MAX_QUEUE_NUM_1G 8 @@ -281,7 +281,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) * Removes this after i40e fixes this issue. */ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; mac.addr_bytes[5] = q; @@ -407,10 +407,10 @@ vmdq_parse_args(int argc, char **argv) static void update_mac_address(struct rte_mbuf *m, unsigned dst_port) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 646368395..75cf31a10 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -121,12 +121,12 @@ const uint16_t vlan_tags[] = { const uint16_t num_vlans = RTE_DIM(vlan_tags); /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ -static struct ether_addr pool_addr_template = { +static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; /* Builds up the correct configuration for vmdq+dcb based on the vlan tags array * given above, and the number of traffic classes available for use. */ @@ -332,7 +332,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) /* Set mac for each pool.*/ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; @@ -494,10 +494,10 @@ vmdq_parse_args(int argc, char **argv) static void update_mac_address(struct rte_mbuf *m, unsigned dst_port) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/lib/librte_ethdev/rte_class_eth.c b/lib/librte_ethdev/rte_class_eth.c index cb99c92ec..e554668da 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/rte_class_eth.c @@ -44,7 +44,7 @@ eth_mac_cmp(const char *key __rte_unused, const char *value, void *opaque) { int ret; - struct ether_addr mac; + struct rte_ether_addr mac; const struct rte_eth_dev_data *data = opaque; struct rte_eth_dev_info dev_info; uint32_t index; diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h index b3416341b..dc4e5af3e 100644 --- a/lib/librte_ethdev/rte_eth_ctrl.h +++ b/lib/librte_ethdev/rte_eth_ctrl.h @@ -110,7 +110,7 @@ struct rte_eth_mac_filter { uint8_t is_vf; /**< 1 for VF, 0 for port dev */ uint16_t dst_id; /**< VF ID, available when is_vf is 1*/ enum rte_mac_filter_type filter_type; /**< MAC filter type */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; /** @@ -126,7 +126,7 @@ struct rte_eth_mac_filter { * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. */ struct rte_eth_ethertype_filter { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ uint16_t ether_type; /**< Ether type to match */ uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ uint16_t queue; /**< Queue assigned to when match*/ @@ -266,8 +266,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ /** Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP @@ -474,7 +474,7 @@ struct rte_eth_sctpv6_flow { * A structure used to define the input for MAC VLAN flow */ struct rte_eth_mac_vlan_flow { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** @@ -494,7 +494,7 @@ struct rte_eth_tunnel_flow { enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */ /** Tunnel ID to match. TNI, VNI... in big endian. */ uint32_t tunnel_id; - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 243beb4dd..e5fc7ffdf 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1343,7 +1343,7 @@ static void rte_eth_dev_mac_restore(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { - struct ether_addr *addr; + struct rte_ether_addr *addr; uint16_t i; uint32_t pool = 0; uint64_t pool_mask; @@ -2588,7 +2588,7 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask, } void -rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr) +rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; @@ -3075,7 +3075,7 @@ rte_eth_led_off(uint16_t port_id) * an empty spot. */ static int -get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) +get_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3091,10 +3091,10 @@ get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) return -1; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; int -rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr, +rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, uint32_t pool) { struct rte_eth_dev *dev; @@ -3147,7 +3147,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr, } int -rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr) +rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr) { struct rte_eth_dev *dev; int index; @@ -3178,7 +3178,7 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr) } int -rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) +rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) { struct rte_eth_dev *dev; int ret; @@ -3207,7 +3207,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) * an empty spot. */ static int -get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) +get_hash_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3226,7 +3226,7 @@ get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) } int -rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on) { int index; @@ -4063,7 +4063,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct rte_eth_dev *dev; diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 40a068fe8..fd8366043 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2264,7 +2264,7 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, * A pointer to a structure of type *ether_addr* to be filled with * the Ethernet address of the Ethernet device. */ -void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr); +void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Retrieve the contextual information of an Ethernet device. @@ -2977,7 +2977,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, * - (-ENOSPC) if no more MAC addresses can be added. * - (-EINVAL) if MAC address is invalid. */ -int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, +int rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool); /** @@ -2993,7 +2993,7 @@ int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, * - (-ENODEV) if *port* invalid. * - (-EADDRINUSE) if attempting to remove the default MAC address */ -int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); +int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Set the default MAC address. @@ -3009,7 +3009,7 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); * - (-EINVAL) if MAC address is invalid. */ int rte_eth_dev_default_mac_addr_set(uint16_t port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device. @@ -3071,7 +3071,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port_id, * - (-EIO) if device is removed. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on); /** @@ -3614,7 +3614,7 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id, * - (-ENOSPC) if *port_id* has not enough multicast filtering resources. */ int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /** diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 8f03f83f6..e0191cb09 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -250,17 +250,17 @@ typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); /**< @internal Remove MAC address from receive address register */ typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint8_t on); /**< @internal Set a Unicast Hash bitmap */ @@ -292,7 +292,7 @@ typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, /**< @internal Delete tunneling UDP port */ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /**< @internal set the list of multicast addresses on an Ethernet device */ @@ -597,13 +597,13 @@ struct rte_eth_dev_data { /**< Common RX buffer size handled by all queues. */ uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */ - struct ether_addr *mac_addrs; + struct rte_ether_addr *mac_addrs; /**< Device Ethernet link address. * @see rte_eth_dev_release_port() */ uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR]; /**< Bitmap associating MAC addresses to pools. */ - struct ether_addr *hash_mac_addrs; + struct rte_ether_addr *hash_mac_addrs; /**< Device Ethernet MAC addresses of hash filtering. * @see rte_eth_dev_release_port() */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index c0fe87924..958a8e77c 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -585,8 +585,8 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = { * same order as on the wire. */ struct rte_flow_item_eth { - struct ether_addr dst; /**< Destination MAC. */ - struct ether_addr src; /**< Source MAC. */ + struct rte_ether_addr dst; /**< Destination MAC. */ + struct rte_ether_addr src; /**< Source MAC. */ rte_be16_t type; /**< EtherType or TPID. */ }; @@ -982,9 +982,9 @@ struct rte_flow_item_arp_eth_ipv4 { uint8_t hln; /**< Hardware address length, normally 6. */ uint8_t pln; /**< Protocol address length, normally 4. */ rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ - struct ether_addr sha; /**< Sender hardware address. */ + struct rte_ether_addr sha; /**< Sender hardware address. */ rte_be32_t spa; /**< Sender IPv4 address. */ - struct ether_addr tha; /**< Target hardware address. */ + struct rte_ether_addr tha; /**< Target hardware address. */ rte_be32_t tpa; /**< Target IPv4 address. */ }; @@ -1128,7 +1128,7 @@ rte_flow_item_icmp6_nd_opt_mask = { struct rte_flow_item_icmp6_nd_opt_sla_eth { uint8_t type; /**< ND option type, normally 1. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr sla; /**< Source Ethernet LLA. */ + struct rte_ether_addr sla; /**< Source Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */ @@ -1153,7 +1153,7 @@ rte_flow_item_icmp6_nd_opt_sla_eth_mask = { struct rte_flow_item_icmp6_nd_opt_tla_eth { uint8_t type; /**< ND option type, normally 2. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr tla; /**< Target Ethernet LLA. */ + struct rte_ether_addr tla; /**< Target Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index 8d178be15..d248f387f 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -614,8 +614,8 @@ static inline void rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, struct ipv6_hdr **ipv6_hdr) { - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); - struct vlan_hdr *vlan_hdr; + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); + struct rte_vlan_hdr *vlan_hdr; *ipv4_hdr = NULL; *ipv6_hdr = NULL; @@ -630,7 +630,7 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, break; case RTE_BE16(ETHER_TYPE_VLAN): - vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(ETHER_TYPE_IPv4): *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 7d128a431..284219517 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -194,7 +194,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, struct gro_tcp4_tbl *tbl, uint64_t start_time) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; @@ -215,7 +215,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, if (unlikely(INVALID_TCP_HDRLEN(pkt->l4_len))) return -1; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index d97924883..988cca8c6 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -24,8 +24,8 @@ /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { - struct ether_addr eth_saddr; - struct ether_addr eth_daddr; + struct rte_ether_addr eth_saddr; + struct rte_ether_addr eth_daddr; uint32_t ip_src_addr; uint32_t ip_dst_addr; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index acb9bc919..d713e3dd6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -289,11 +289,11 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, struct gro_vxlan_tcp4_tbl *tbl, uint64_t start_time) { - struct ether_hdr *outer_eth_hdr, *eth_hdr; + struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; - struct vxlan_hdr *vxlan_hdr; + struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; int32_t tcp_dl; uint16_t frag_off, outer_ip_id, ip_id; @@ -313,15 +313,15 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, if (unlikely(INVALID_TCP_HDRLEN(pkt->l4_len))) return -1; - outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); - vxlan_hdr = (struct vxlan_hdr *)((char *)udp_hdr + + vxlan_hdr = (struct rte_vxlan_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr)); - eth_hdr = (struct ether_hdr *)((char *)vxlan_hdr + - sizeof(struct vxlan_hdr)); + eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); diff --git a/lib/librte_gro/gro_vxlan_tcp4.h b/lib/librte_gro/gro_vxlan_tcp4.h index 0cafb9211..7832942a6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.h +++ b/lib/librte_gro/gro_vxlan_tcp4.h @@ -12,10 +12,10 @@ /* Header fields representing a VxLAN flow */ struct vxlan_tcp4_flow_key { struct tcp4_flow_key inner_key; - struct vxlan_hdr vxlan_hdr; + struct rte_vxlan_hdr vxlan_hdr; - struct ether_addr outer_eth_saddr; - struct ether_addr outer_eth_daddr; + struct rte_ether_addr outer_eth_saddr; + struct rte_ether_addr outer_eth_daddr; uint32_t outer_ip_src_addr; uint32_t outer_ip_dst_addr; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index a626a11e3..433f2c8bb 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -18,11 +18,11 @@ extern "C" { #include <rte_mbuf.h> /* Minimum GSO segment size for TCP based packets. */ -#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ +#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ -#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ +#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 946459c79..d0975eda8 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -451,7 +451,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) RTE_LOG(INFO, KNI, "Configure mac address of %d", port_id); ret = rte_eth_dev_default_mac_addr_set(port_id, - (struct ether_addr *)mac_addr); + (struct rte_ether_addr *)mac_addr); if (ret < 0) RTE_LOG(ERR, KNI, "Failed to config mac_addr for port %d\n", port_id); diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 877874a5e..921adb4cf 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -9,9 +9,9 @@ #define RARP_PKT_SIZE 64 struct rte_mbuf * __rte_experimental rte_net_make_rarp_packet(struct rte_mempool *mpool, - const struct ether_addr *mac) + const struct rte_ether_addr *mac) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *rarp; struct rte_mbuf *mbuf; @@ -22,7 +22,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, if (mbuf == NULL) return NULL; - eth_hdr = (struct ether_hdr *)rte_pktmbuf_append(mbuf, RARP_PKT_SIZE); + eth_hdr = (struct rte_ether_hdr *)rte_pktmbuf_append(mbuf, RARP_PKT_SIZE); if (eth_hdr == NULL) { rte_pktmbuf_free(mbuf); return NULL; diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index a94fa6a00..f17c52972 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -22,9 +22,9 @@ extern "C" { * ARP header IPv4 payload. */ struct rte_arp_ipv4 { - struct ether_addr arp_sha; /**< sender hardware address */ + struct rte_ether_addr arp_sha; /**< sender hardware address */ uint32_t arp_sip; /**< sender IP address */ - struct ether_addr arp_tha; /**< target hardware address */ + struct rte_ether_addr arp_tha; /**< target hardware address */ uint32_t arp_tip; /**< target IP address */ } __attribute__((__packed__)); @@ -65,7 +65,7 @@ struct rte_arp_hdr { */ struct rte_mbuf * __rte_experimental rte_net_make_rarp_packet(struct rte_mempool *mpool, - const struct ether_addr *mac); + const struct rte_ether_addr *mac); #ifdef __cplusplus } diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 3a87ff184..afdbaa1a7 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -54,7 +54,7 @@ extern "C" { * administrator and does not contain OUIs. * See http://standards.ieee.org/regauth/groupmac/tutorial.html */ -struct ether_addr { +struct rte_ether_addr { uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ } __attribute__((__packed__)); @@ -75,8 +75,8 @@ struct ether_addr { * True (1) if the given two ethernet address are the same; * False (0) otherwise. */ -static inline int is_same_ether_addr(const struct ether_addr *ea1, - const struct ether_addr *ea2) +static inline int 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++) @@ -95,7 +95,7 @@ static inline int is_same_ether_addr(const struct ether_addr *ea1, * True (1) if the given ethernet address is filled with zeros; * false (0) otherwise. */ -static inline int is_zero_ether_addr(const struct ether_addr *ea) +static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -114,7 +114,7 @@ static inline int is_zero_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a unicast address; * false (0) otherwise. */ -static inline int is_unicast_ether_addr(const struct ether_addr *ea) +static inline int is_unicast_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_GROUP_ADDR) == 0; } @@ -129,7 +129,7 @@ static inline int is_unicast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a multicast address; * false (0) otherwise. */ -static inline int is_multicast_ether_addr(const struct ether_addr *ea) +static inline int is_multicast_ether_addr(const struct rte_ether_addr *ea) { return ea->addr_bytes[0] & ETHER_GROUP_ADDR; } @@ -144,7 +144,7 @@ static inline int is_multicast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a broadcast address; * false (0) otherwise. */ -static inline int is_broadcast_ether_addr(const struct ether_addr *ea) +static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) { const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; @@ -162,7 +162,7 @@ static inline int is_broadcast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a universally assigned address; * false (0) otherwise. */ -static inline int is_universal_ether_addr(const struct ether_addr *ea) +static inline int is_universal_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) == 0; } @@ -177,7 +177,7 @@ static inline int is_universal_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a locally assigned address; * false (0) otherwise. */ -static inline int is_local_admin_ether_addr(const struct ether_addr *ea) +static inline int is_local_admin_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) != 0; } @@ -193,7 +193,7 @@ static inline int is_local_admin_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is valid; * false (0) otherwise. */ -static inline int is_valid_assigned_ether_addr(const struct ether_addr *ea) +static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) { return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); } @@ -222,8 +222,8 @@ static inline void eth_random_addr(uint8_t *addr) * @param ea_to * A pointer to a ether_addr structure where to copy the Ethernet address. */ -static inline void ether_addr_copy(const struct ether_addr *ea_from, - struct ether_addr *ea_to) +static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { #ifdef __INTEL_COMPILER uint16_t *from_words = (uint16_t *)(ea_from->addr_bytes); @@ -253,7 +253,7 @@ static inline void ether_addr_copy(const struct ether_addr *ea_from, */ static inline void ether_format_addr(char *buf, uint16_t size, - const struct ether_addr *eth_addr) + const struct rte_ether_addr *eth_addr) { snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", eth_addr->addr_bytes[0], @@ -268,9 +268,9 @@ ether_format_addr(char *buf, uint16_t size, * Ethernet header: Contains the destination address, source address * and frame type. */ -struct ether_hdr { - struct ether_addr d_addr; /**< Destination address. */ - struct ether_addr s_addr; /**< Source address. */ +struct rte_ether_hdr { + struct rte_ether_addr d_addr; /**< Destination address. */ + struct rte_ether_addr s_addr; /**< Source address. */ uint16_t ether_type; /**< Frame type. */ } __attribute__((__packed__)); @@ -279,7 +279,7 @@ struct ether_hdr { * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type * of the encapsulated frame. */ -struct vlan_hdr { +struct rte_vlan_hdr { uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */ uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */ } __attribute__((__packed__)); @@ -289,7 +289,7 @@ struct vlan_hdr { * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and * Reserved fields (24 bits and 8 bits) */ -struct vxlan_hdr { +struct rte_vxlan_hdr { uint32_t vx_flags; /**< flag (8) + Reserved (24). */ uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ } __attribute__((__packed__)); @@ -311,7 +311,7 @@ struct vxlan_hdr { #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 vxlan_hdr)) +#define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -319,7 +319,7 @@ struct vxlan_hdr { * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network * Identifier and Reserved fields (16 bits and 8 bits). */ -struct vxlan_gpe_hdr { +struct rte_vxlan_gpe_hdr { uint8_t vx_flags; /**< flag (8). */ uint8_t reserved[2]; /**< Reserved (16). */ uint8_t proto; /**< next-protocol (8). */ @@ -336,7 +336,7 @@ struct vxlan_gpe_hdr { #define VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ #define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \ - sizeof(struct vxlan_gpe_hdr)) + sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ /** @@ -352,19 +352,19 @@ struct vxlan_gpe_hdr { */ static inline int rte_vlan_strip(struct rte_mbuf *m) { - struct ether_hdr *eh - = rte_pktmbuf_mtod(m, struct ether_hdr *); - struct vlan_hdr *vh; + struct rte_ether_hdr *eh + = 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)) return -1; - vh = (struct vlan_hdr *)(eh + 1); + vh = (struct rte_vlan_hdr *)(eh + 1); m->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci); /* Copy ether header over rather than moving whole packet */ - memmove(rte_pktmbuf_adj(m, sizeof(struct vlan_hdr)), + memmove(rte_pktmbuf_adj(m, sizeof(struct rte_vlan_hdr)), eh, 2 * ETHER_ADDR_LEN); return 0; @@ -384,8 +384,8 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) */ static inline int rte_vlan_insert(struct rte_mbuf **m) { - struct ether_hdr *oh, *nh; - struct vlan_hdr *vh; + struct rte_ether_hdr *oh, *nh; + struct rte_vlan_hdr *vh; /* Can't insert header if mbuf is shared */ if (rte_mbuf_refcnt_read(*m) > 1) { @@ -398,16 +398,16 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) *m = copy; } - oh = rte_pktmbuf_mtod(*m, struct ether_hdr *); - nh = (struct ether_hdr *) - rte_pktmbuf_prepend(*m, sizeof(struct vlan_hdr)); + oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *); + nh = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(*m, sizeof(struct rte_vlan_hdr)); if (nh == NULL) return -ENOSPC; memmove(nh, oh, 2 * ETHER_ADDR_LEN); nh->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); - vh = (struct vlan_hdr *) (nh + 1); + vh = (struct rte_vlan_hdr *) (nh + 1); vh->vlan_tci = rte_cpu_to_be_16((*m)->vlan_tci); (*m)->ol_flags &= ~(PKT_RX_VLAN_STRIPPED | PKT_TX_VLAN); diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 378a4126c..315c37c55 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -229,8 +229,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, struct rte_net_hdr_lens *hdr_lens, uint32_t layers) { struct rte_net_hdr_lens local_hdr_lens; - const struct ether_hdr *eh; - struct ether_hdr eh_copy; + const struct rte_ether_hdr *eh; + struct rte_ether_hdr eh_copy; uint32_t pkt_type = RTE_PTYPE_L2_ETHER; uint32_t off = 0; uint16_t proto; @@ -253,8 +253,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, goto l3; /* fast path if packet is IPv4 */ if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type = RTE_PTYPE_L2_ETHER_VLAN; vh = rte_pktmbuf_read(m, off, sizeof(*vh), &vh_copy); @@ -264,8 +264,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l2_len += sizeof(*vh); proto = vh->eth_proto; } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type = RTE_PTYPE_L2_ETHER_QINQ; vh = rte_pktmbuf_read(m, off + sizeof(*vh), sizeof(*vh), @@ -402,8 +402,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type &= ~RTE_PTYPE_INNER_L2_MASK; pkt_type |= RTE_PTYPE_INNER_L2_ETHER_VLAN; @@ -414,8 +414,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l2_len += sizeof(*vh); proto = vh->eth_proto; } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type &= ~RTE_PTYPE_INNER_L2_MASK; pkt_type |= RTE_PTYPE_INNER_L2_ETHER_QINQ; diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 6712bb697..8841de64f 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -438,7 +438,7 @@ encap_cfg_check(struct rte_table_action_encap_config *encap) } struct encap_ether_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; } __attribute__((__packed__)); #define VLAN(pcp, dei, vid) \ @@ -447,14 +447,14 @@ struct encap_ether_data { (((uint64_t)(vid)) & 0xFFFLLU)) \ struct encap_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; } __attribute__((__packed__)); struct encap_qinq_data { - struct ether_hdr ether; - struct vlan_hdr svlan; - struct vlan_hdr cvlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr svlan; + struct rte_vlan_hdr cvlan; } __attribute__((__packed__)); #define ETHER_TYPE_MPLS_UNICAST 0x8847 @@ -468,7 +468,7 @@ struct encap_qinq_data { (((uint64_t)(ttl)) & 0xFFLLU))) struct encap_mpls_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX]; uint32_t mpls_count; } __attribute__((__packed__)); @@ -483,46 +483,46 @@ struct pppoe_ppp_hdr { } __attribute__((__packed__)); struct encap_pppoe_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct pppoe_ppp_hdr pppoe_ppp; } __attribute__((__packed__)); #define IP_PROTO_UDP 17 struct encap_vxlan_ipv4_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct ipv4_hdr ipv4; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv4_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; struct ipv4_hdr ipv4; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct ipv6_hdr ipv6; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; struct ipv6_hdr ipv6; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_qinq_pppoe_data { - struct ether_hdr ether; - struct vlan_hdr svlan; - struct vlan_hdr cvlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr svlan; + struct rte_vlan_hdr cvlan; struct pppoe_ppp_hdr pppoe_ppp; } __attribute__((__packed__)); @@ -997,13 +997,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + sizeof(struct ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1027,13 +1027,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + sizeof(struct ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1057,10 +1057,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1083,10 +1083,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1133,7 +1133,7 @@ pkt_work_encap(struct rte_mbuf *mbuf, case 1LLU << RTE_TABLE_ACTION_ENCAP_MPLS: { struct encap_mpls_data *mpls = data; - size_t size = sizeof(struct ether_hdr) + + size_t size = sizeof(struct rte_ether_hdr) + mpls->mpls_count * 4; encap(ip, data, size); diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index 53d16af8a..e88dd49e7 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -387,8 +387,8 @@ enum rte_table_action_encap_type { /** Pre-computed Ethernet header fields for encapsulation action. */ struct rte_table_action_ether_hdr { - struct ether_addr da; /**< Destination address. */ - struct ether_addr sa; /**< Source address. */ + struct rte_ether_addr da; /**< Destination address. */ + struct rte_ether_addr sa; /**< Source address. */ }; /** Pre-computed VLAN header fields for encapsulation action. */ diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index e9138dfab..d49c3b8a9 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -308,7 +308,7 @@ struct virtio_net { uint64_t log_size; uint64_t log_base; uint64_t log_addr; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t mtu; struct vhost_device_ops const *notify_ops; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index a6a33a101..a71cf0cf7 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -969,18 +969,18 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t ethertype; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - m->l2_len += sizeof(struct vlan_hdr); + m->l2_len += sizeof(struct rte_vlan_hdr); ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); } -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 03/14] net: add rte prefix to ether structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 03/14] net: add rte prefix to ether structures Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct ether_addr as struct rte_ether_addr. - rename struct ether_hdr as struct rte_ether_hdr. - rename struct vlan_hdr as struct rte_vlan_hdr. - rename struct vxlan_hdr as struct rte_vxlan_hdr. - rename struct vxlan_gpe_hdr as struct rte_vxlan_gpe_hdr. Do not update the command line library to avoid adding a dependency to librte_net. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/pdump/main.c | 2 +- app/test-pipeline/pipeline_acl.c | 10 +- app/test-pipeline/pipeline_hash.c | 4 +- app/test-pmd/cmdline.c | 50 +++---- app/test-pmd/cmdline_flow.c | 2 +- app/test-pmd/config.c | 24 ++-- app/test-pmd/csumonly.c | 30 ++--- app/test-pmd/flowgen.c | 10 +- app/test-pmd/icmpecho.c | 18 +-- app/test-pmd/ieee1588fwd.c | 8 +- app/test-pmd/macfwd.c | 6 +- app/test-pmd/macswap.h | 6 +- app/test-pmd/macswap_common.h | 2 +- app/test-pmd/macswap_neon.h | 12 +- app/test-pmd/macswap_sse.h | 12 +- app/test-pmd/testpmd.c | 4 +- app/test-pmd/testpmd.h | 10 +- app/test-pmd/txonly.c | 14 +- app/test-pmd/util.c | 12 +- app/test/packet_burst_generator.c | 26 ++-- app/test/packet_burst_generator.h | 12 +- app/test/test_cmdline_etheraddr.c | 14 +- app/test/test_event_eth_rx_adapter.c | 2 +- app/test/test_event_eth_tx_adapter.c | 2 +- app/test/test_flow_classify.c | 34 ++--- app/test/test_link_bonding.c | 146 ++++++++++----------- app/test/test_link_bonding_mode4.c | 52 ++++---- app/test/test_link_bonding_rssconf.c | 2 +- app/test/test_pmd_perf.c | 10 +- app/test/test_sched.c | 12 +- app/test/virtual_pmd.c | 4 +- app/test/virtual_pmd.h | 2 +- doc/guides/prog_guide/bbdev.rst | 6 +- doc/guides/sample_app_ug/flow_classify.rst | 12 +- doc/guides/sample_app_ug/flow_filtering.rst | 6 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 8 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 4 +- .../sample_app_ug/l2_forward_real_virtual.rst | 4 +- doc/guides/sample_app_ug/l3_forward.rst | 8 +- doc/guides/sample_app_ug/link_status_intr.rst | 4 +- doc/guides/sample_app_ug/ptpclient.rst | 6 +- doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- doc/guides/sample_app_ug/server_node_efd.rst | 4 +- doc/guides/sample_app_ug/skeleton.rst | 2 +- doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- drivers/bus/dpaa/include/fman.h | 2 +- drivers/bus/dpaa/include/netcfg.h | 4 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +- drivers/net/ark/ark_ethdev.c | 12 +- drivers/net/ark/ark_ext.h | 4 +- drivers/net/ark/ark_global.h | 4 +- drivers/net/atlantic/atl_ethdev.c | 12 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- drivers/net/avp/avp_ethdev.c | 6 +- drivers/net/axgbe/axgbe_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x.c | 8 +- drivers/net/bnx2x/bnx2x_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x_vfpf.c | 2 +- drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 6 +- drivers/net/bnxt/bnxt_hwrm.c | 4 +- drivers/net/bnxt/bnxt_hwrm.h | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 6 +- drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- drivers/net/bonding/rte_eth_bond.h | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 6 +- drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- drivers/net/bonding/rte_eth_bond_8023ad_private.h | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 24 ++-- drivers/net/bonding/rte_eth_bond_alb.h | 10 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_args.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 80 +++++------ drivers/net/bonding/rte_eth_bond_private.h | 6 +- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 18 +-- drivers/net/dpaa2/dpaa2_flow.c | 18 +-- drivers/net/e1000/em_ethdev.c | 14 +- drivers/net/e1000/igb_ethdev.c | 24 ++-- drivers/net/e1000/igb_pf.c | 4 +- drivers/net/ena/ena_ethdev.c | 8 +- drivers/net/enetc/enetc_ethdev.c | 2 +- drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_ethdev.c | 12 +- drivers/net/enic/enic_flow.c | 28 ++-- drivers/net/enic/enic_main.c | 4 +- drivers/net/failsafe/failsafe.c | 2 +- drivers/net/failsafe/failsafe_args.c | 2 +- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/failsafe/failsafe_private.h | 4 +- drivers/net/fm10k/fm10k_ethdev.c | 8 +- drivers/net/i40e/i40e_ethdev.c | 58 ++++---- drivers/net/i40e/i40e_ethdev.h | 20 +-- drivers/net/i40e/i40e_ethdev_vf.c | 30 ++--- drivers/net/i40e/i40e_fdir.c | 8 +- drivers/net/i40e/i40e_flow.c | 8 +- drivers/net/i40e/i40e_pf.c | 10 +- drivers/net/i40e/i40e_vf_representor.c | 2 +- drivers/net/i40e/rte_pmd_i40e.c | 14 +- drivers/net/i40e/rte_pmd_i40e.h | 8 +- drivers/net/iavf/iavf.h | 2 +- drivers/net/iavf/iavf_ethdev.c | 22 ++-- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_ethdev.c | 30 ++--- drivers/net/ice/ice_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_ethdev.c | 42 +++--- drivers/net/ixgbe/ixgbe_pf.c | 2 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4.h | 6 +- drivers/net/mlx4/mlx4_ethdev.c | 4 +- drivers/net/mlx4/mlx4_flow.c | 4 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mlx5/mlx5.h | 12 +- drivers/net/mlx5/mlx5_flow_dv.c | 16 +-- drivers/net/mlx5/mlx5_flow_tcf.c | 10 +- drivers/net/mlx5/mlx5_mac.c | 10 +- drivers/net/mlx5/mlx5_nl.c | 14 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mvneta/mvneta_ethdev.c | 4 +- drivers/net/mvpp2/mrvl_ethdev.c | 4 +- drivers/net/mvpp2/mrvl_flow.c | 2 +- drivers/net/netvsc/hn_ethdev.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 4 +- drivers/net/netvsc/hn_var.h | 4 +- drivers/net/netvsc/hn_vf.c | 6 +- drivers/net/nfp/nfp_net.c | 8 +- drivers/net/null/rte_eth_null.c | 4 +- drivers/net/octeontx/octeontx_ethdev.c | 2 +- drivers/net/pcap/rte_eth_pcap.c | 4 +- drivers/net/qede/qede_ethdev.c | 24 ++-- drivers/net/qede/qede_ethdev.h | 6 +- drivers/net/qede/qede_filter.c | 4 +- drivers/net/qede/qede_if.h | 2 +- drivers/net/qede/qede_rxtx.c | 14 +- drivers/net/ring/rte_eth_ring.c | 4 +- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ethdev.c | 10 +- drivers/net/sfc/sfc_port.c | 6 +- drivers/net/softnic/parser.c | 12 +- drivers/net/softnic/parser.h | 2 +- drivers/net/softnic/rte_eth_softnic.c | 2 +- drivers/net/szedata2/rte_eth_szedata2.c | 6 +- drivers/net/tap/rte_eth_tap.c | 18 +-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_bpf_program.c | 8 +- drivers/net/thunderx/base/nicvf_mbox.c | 4 +- drivers/net/thunderx/nicvf_ethdev.c | 4 +- drivers/net/vdev_netvsc/vdev_netvsc.c | 12 +- drivers/net/vhost/rte_eth_vhost.c | 8 +- drivers/net/virtio/virtio_ethdev.c | 18 +-- drivers/net/virtio/virtio_rxtx.c | 4 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 8 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 6 +- examples/bbdev_app/main.c | 38 +++--- examples/bond/main.c | 28 ++-- examples/distributor/main.c | 2 +- examples/ethtool/ethtool-app/ethapp.c | 4 +- examples/ethtool/ethtool-app/main.c | 6 +- examples/ethtool/lib/rte_ethtool.c | 6 +- examples/ethtool/lib/rte_ethtool.h | 6 +- examples/eventdev_pipeline/main.c | 2 +- examples/eventdev_pipeline/pipeline_common.h | 6 +- examples/flow_classify/flow_classify.c | 12 +- examples/flow_filtering/main.c | 6 +- examples/ip_fragmentation/main.c | 18 +-- examples/ip_pipeline/cli.c | 4 +- examples/ip_pipeline/parser.c | 12 +- examples/ip_pipeline/parser.h | 2 +- examples/ip_reassembly/main.c | 12 +- examples/ipsec-secgw/ipsec-secgw.c | 18 +-- examples/ipsec-secgw/ipsec.h | 2 +- examples/ipsec-secgw/parser.c | 4 +- examples/ipv4_multicast/main.c | 14 +- examples/kni/main.c | 8 +- examples/l2fwd-cat/l2fwd-cat.c | 2 +- examples/l2fwd-crypto/main.c | 12 +- examples/l2fwd-jobstats/main.c | 6 +- examples/l2fwd-keepalive/main.c | 6 +- examples/l2fwd/main.c | 6 +- examples/l3fwd-acl/main.c | 12 +- examples/l3fwd-power/main.c | 16 +-- examples/l3fwd-vf/main.c | 10 +- examples/l3fwd/l3fwd.h | 2 +- examples/l3fwd/l3fwd_altivec.h | 12 +- examples/l3fwd/l3fwd_em.c | 6 +- examples/l3fwd/l3fwd_em.h | 8 +- examples/l3fwd/l3fwd_em_hlm.h | 8 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 8 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 8 +- examples/l3fwd/l3fwd_em_sequential.h | 8 +- examples/l3fwd/l3fwd_lpm.c | 14 +- examples/l3fwd/l3fwd_lpm.h | 8 +- examples/l3fwd/l3fwd_lpm_altivec.h | 10 +- examples/l3fwd/l3fwd_lpm_neon.h | 20 +-- examples/l3fwd/l3fwd_lpm_sse.h | 10 +- examples/l3fwd/l3fwd_neon.h | 12 +- examples/l3fwd/l3fwd_sse.h | 12 +- examples/l3fwd/main.c | 8 +- examples/link_status_interrupt/main.c | 6 +- examples/load_balancer/runtime.c | 2 +- .../client_server_mp/mp_server/main.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 136 +++++++++---------- examples/ptpclient/ptpclient.c | 28 ++-- examples/qos_meter/main.c | 2 +- examples/quota_watermark/qw/main.c | 6 +- examples/rxtx_callbacks/main.c | 2 +- examples/server_node_efd/node/node.c | 2 +- examples/server_node_efd/server/main.c | 4 +- examples/skeleton/basicfwd.c | 2 +- examples/tep_termination/main.c | 2 +- examples/tep_termination/main.h | 2 +- examples/tep_termination/vxlan.c | 38 +++--- examples/tep_termination/vxlan.h | 6 +- examples/tep_termination/vxlan_setup.c | 6 +- examples/tep_termination/vxlan_setup.h | 2 +- examples/vhost/main.c | 24 ++-- examples/vhost/main.h | 2 +- examples/vm_power_manager/channel_monitor.c | 6 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/main.c | 4 +- examples/vmdq/main.c | 10 +- examples/vmdq_dcb/main.c | 10 +- lib/librte_ethdev/rte_class_eth.c | 2 +- lib/librte_ethdev/rte_eth_ctrl.h | 12 +- lib/librte_ethdev/rte_ethdev.c | 20 +-- lib/librte_ethdev/rte_ethdev.h | 12 +- lib/librte_ethdev/rte_ethdev_core.h | 12 +- lib/librte_ethdev/rte_flow.h | 12 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 6 +- lib/librte_gro/gro_tcp4.c | 4 +- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 12 +- lib/librte_gro/gro_vxlan_tcp4.h | 6 +- lib/librte_gso/rte_gso.h | 4 +- lib/librte_kni/rte_kni.c | 2 +- lib/librte_net/rte_arp.c | 6 +- lib/librte_net/rte_arp.h | 6 +- lib/librte_net/rte_ether.h | 64 ++++----- lib/librte_net/rte_net.c | 20 +-- lib/librte_pipeline/rte_table_action.c | 60 ++++----- lib/librte_pipeline/rte_table_action.h | 4 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/virtio_net.c | 10 +- 258 files changed, 1329 insertions(+), 1329 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index ae0cf282f..fbf9aa4fe 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -543,7 +543,7 @@ signal_handler(int sig_num) static inline int configure_vdev(uint16_t port_id) { - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rxRings = 0, txRings = 1; int ret; uint16_t q; diff --git a/app/test-pipeline/pipeline_acl.c b/app/test-pipeline/pipeline_acl.c index 524d2212d..8853d4376 100644 --- a/app/test-pipeline/pipeline_acl.c +++ b/app/test-pipeline/pipeline_acl.c @@ -39,7 +39,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, { @@ -47,7 +47,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, { @@ -55,7 +55,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, { @@ -63,14 +63,14 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr), + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index c20147234..3e4a0a1bb 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -441,14 +441,14 @@ app_main_loop_rx_metadata(void) { if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip_hdr = (struct ipv4_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { ipv6_hdr = (struct ipv6_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; memcpy(key, ipv6_dst, 16); diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 2ab03c111..032807378 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6031,7 +6031,7 @@ struct cmd_set_bond_mac_addr_result { cmdline_fixed_string_t bonding; cmdline_fixed_string_t mac_addr; uint16_t port_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_set_bond_mac_addr_parsed(void *parsed_result, @@ -7804,7 +7804,7 @@ struct cmd_mac_addr_result { cmdline_fixed_string_t mac_addr_cmd; cmdline_fixed_string_t what; uint16_t port_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_mac_addr_parsed(void *parsed_result, @@ -8003,7 +8003,7 @@ struct cmd_set_uc_hash_table { cmdline_fixed_string_t port; portid_t port_id; cmdline_fixed_string_t what; - struct ether_addr address; + struct rte_ether_addr address; cmdline_fixed_string_t mode; }; @@ -8127,7 +8127,7 @@ struct cmd_set_vf_macvlan_filter { portid_t port_id; cmdline_fixed_string_t vf; uint8_t vf_id; - struct ether_addr address; + struct rte_ether_addr address; cmdline_fixed_string_t filter_type; cmdline_fixed_string_t mode; }; @@ -8386,7 +8386,7 @@ struct cmd_vf_mac_addr_result { uint16_t port_num; cmdline_fixed_string_t vf; uint8_t vf_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_vf_mac_addr_parsed(void *parsed_result, @@ -8699,8 +8699,8 @@ struct cmd_tunnel_filter_result { cmdline_fixed_string_t cmd; cmdline_fixed_string_t what; portid_t port_id; - struct ether_addr outer_mac; - struct ether_addr inner_mac; + struct rte_ether_addr outer_mac; + struct rte_ether_addr inner_mac; cmdline_ipaddr_t ip_value; uint16_t inner_vlan; cmdline_fixed_string_t tunnel_type; @@ -10490,7 +10490,7 @@ struct cmd_ethertype_filter_result { portid_t port_id; cmdline_fixed_string_t ops; cmdline_fixed_string_t mac; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; cmdline_fixed_string_t ethertype; uint16_t ethertype_value; cmdline_fixed_string_t drop; @@ -10550,7 +10550,7 @@ cmd_ethertype_filter_parsed(void *parsed_result, if (!strcmp(res->mac, "mac_addr")) { filter.flags |= RTE_ETHTYPE_FLAGS_MAC; rte_memcpy(&filter.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } if (!strcmp(res->drop, "drop")) filter.flags |= RTE_ETHTYPE_FLAGS_DROP; @@ -10629,7 +10629,7 @@ struct cmd_flow_director_result { cmdline_fixed_string_t fd_id; uint32_t fd_id_value; cmdline_fixed_string_t mac; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; cmdline_fixed_string_t tunnel; cmdline_fixed_string_t tunnel_type; cmdline_fixed_string_t tunnel_id; @@ -10932,12 +10932,12 @@ cmd_flow_director_filter_parsed(void *parsed_result, if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) { rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); entry.input.flow.tunnel_flow.tunnel_type = str2fdir_tunneltype(res->tunnel_type); entry.input.flow.tunnel_flow.tunnel_id = @@ -12370,7 +12370,7 @@ struct cmd_mcast_addr_result { cmdline_fixed_string_t mcast_addr_cmd; cmdline_fixed_string_t what; uint16_t port_num; - struct ether_addr mc_addr; + struct rte_ether_addr mc_addr; }; static void cmd_mcast_addr_parsed(void *parsed_result, @@ -13789,7 +13789,7 @@ struct cmd_set_vf_mac_addr_result { cmdline_fixed_string_t addr; portid_t port_id; uint16_t vf_id; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; @@ -14094,7 +14094,7 @@ struct cmd_macsec_sc_result { cmdline_fixed_string_t sc; cmdline_fixed_string_t tx_rx; portid_t port_id; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t pi; }; @@ -15095,8 +15095,8 @@ struct cmd_set_vxlan_result { uint16_t tci; uint8_t tos; uint8_t ttl; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_vxlan_set = @@ -15318,8 +15318,8 @@ struct cmd_set_nvgre_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_nvgre_set = @@ -15464,8 +15464,8 @@ struct cmd_set_l2_encap_result { cmdline_fixed_string_t ip_version; uint32_t vlan_present:1; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_l2_encap_set = @@ -15621,8 +15621,8 @@ struct cmd_set_mplsogre_encap_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_mplsogre_encap_set = @@ -15845,8 +15845,8 @@ struct cmd_set_mplsoudp_encap_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_mplsoudp_encap_set = diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 1c83bc9bc..1b7fbd02c 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -4488,7 +4488,7 @@ parse_mac_addr(struct context *ctx, const struct token *token, void *buf, unsigned int size) { const struct arg *arg = pop_args(ctx); - struct ether_addr tmp; + struct rte_ether_addr tmp; int ret; (void)token; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index f9cb12964..83b9df103 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -108,7 +108,7 @@ const struct rss_type_info rss_type_table[] = { }; static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -391,7 +391,7 @@ void port_infos_display(portid_t port_id) { struct rte_port *port; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link link; struct rte_eth_dev_info dev_info; int vlan_offload; @@ -538,7 +538,7 @@ port_summary_header_display(void) void port_summary_display(portid_t port_id) { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link link; struct rte_eth_dev_info dev_info; char name[RTE_ETH_NAME_MAX_LEN]; @@ -2519,7 +2519,7 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) * Check that each segment length is greater or equal than * the mbuf data sise. * Check also that the total packet length is greater or equal than the - * size of an empty UDP/IP packet (sizeof(struct ether_hdr) + 20 + 8). + * size of an empty UDP/IP packet (sizeof(struct rte_ether_hdr) + 20 + 8). */ tx_pkt_len = 0; for (i = 0; i < nb_segs; i++) { @@ -2530,10 +2530,10 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) } tx_pkt_len = (uint16_t)(tx_pkt_len + seg_lengths[i]); } - if (tx_pkt_len < (sizeof(struct ether_hdr) + 20 + 8)) { + if (tx_pkt_len < (sizeof(struct rte_ether_hdr) + 20 + 8)) { printf("total packet length=%u < %d - give up\n", (unsigned) tx_pkt_len, - (int)(sizeof(struct ether_hdr) + 20 + 8)); + (int)(sizeof(struct rte_ether_hdr) + 20 + 8)); return; } @@ -3453,7 +3453,7 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) static int mcast_addr_pool_extend(struct rte_port *port) { - struct ether_addr *mc_pool; + struct rte_ether_addr *mc_pool; size_t mc_pool_size; /* @@ -3470,9 +3470,9 @@ mcast_addr_pool_extend(struct rte_port *port) * The previous test guarantees that port->mc_addr_nb is a multiple * of MCAST_POOL_INC. */ - mc_pool_size = sizeof(struct ether_addr) * (port->mc_addr_nb + + mc_pool_size = sizeof(struct rte_ether_addr) * (port->mc_addr_nb + MCAST_POOL_INC); - mc_pool = (struct ether_addr *) realloc(port->mc_addr_pool, + mc_pool = (struct rte_ether_addr *) realloc(port->mc_addr_pool, mc_pool_size); if (mc_pool == NULL) { printf("allocation of pool of %u multicast addresses failed\n", @@ -3501,7 +3501,7 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx) } memmove(&port->mc_addr_pool[addr_idx], &port->mc_addr_pool[addr_idx + 1], - sizeof(struct ether_addr) * (port->mc_addr_nb - addr_idx)); + sizeof(struct rte_ether_addr) * (port->mc_addr_nb - addr_idx)); } static void @@ -3520,7 +3520,7 @@ eth_port_multicast_addr_list_set(portid_t port_id) } void -mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr) +mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) { struct rte_port *port; uint32_t i; @@ -3548,7 +3548,7 @@ mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr) } void -mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr) +mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr) { struct rte_port *port; uint32_t i; diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index f4f2a7b29..1a7db7f0e 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -142,18 +142,18 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) * header. The l4_len argument is only set in case of TCP (useful for TSO). */ static void -parse_ethernet(struct ether_hdr *eth_hdr, struct testpmd_offload_info *info) +parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - info->l2_len = sizeof(struct ether_hdr); + info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; if (info->ethertype == _htons(ETHER_TYPE_VLAN)) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - info->l2_len += sizeof(struct vlan_hdr); + info->l2_len += sizeof(struct rte_vlan_hdr); info->ethertype = vlan_hdr->eth_proto; } @@ -180,7 +180,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info, uint32_t pkt_type) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; /* check udp destination port, 4789 is the default vxlan port * (rfc7348) or that the rx offload flag is set (i40e only @@ -195,9 +195,9 @@ parse_vxlan(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)udp_hdr + + eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr) + - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); info->l2_len += ETHER_VXLAN_HLEN; /* add udp + vxlan */ @@ -208,17 +208,17 @@ static void parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - struct vxlan_gpe_hdr *vxlan_gpe_hdr; + struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); /* Check udp destination port. */ if (udp_hdr->dst_port != _htons(vxlan_gpe_udp_port)) return; - vxlan_gpe_hdr = (struct vxlan_gpe_hdr *)((char *)udp_hdr + + vxlan_gpe_hdr = (struct rte_vxlan_gpe_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == @@ -257,7 +257,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)vxlan_gpe_hdr + + eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ethernet(eth_hdr, info); @@ -271,7 +271,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; @@ -318,7 +318,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)gre_hdr + gre_len); + eth_hdr = (struct rte_ether_hdr *)((char *)gre_hdr + gre_len); parse_ethernet(eth_hdr, info); } else @@ -691,7 +691,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) struct rte_mbuf **tx_pkts_burst; struct rte_port *txp; struct rte_mbuf *m, *p; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; void *l3_hdr = NULL, *outer_l3_hdr = NULL; /* can be IPv4 or IPv6 */ void **gro_ctx; uint16_t gro_pkts_num; @@ -765,7 +765,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* step 1: dissect packet, parsing optional vlan, ip4/ip6, vxlan * and inner headers */ - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 3214e3c95..7c6ad4b3c 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -76,9 +76,9 @@ static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; -static struct ether_addr cfg_ether_src = +static struct rte_ether_addr cfg_ether_src = {{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x00 }}; -static struct ether_addr cfg_ether_dst = +static struct rte_ether_addr cfg_ether_dst = {{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x01 }}; #define IP_DEFTTL 64 /* from RFC 1340. */ @@ -119,7 +119,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mempool *mbp; struct rte_mbuf *pkt; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; @@ -170,7 +170,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->next = NULL; /* Initialize Ethernet header. */ - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); @@ -205,7 +205,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; - pkt->l2_len = sizeof(struct ether_hdr); + pkt->l2_len = sizeof(struct rte_ether_hdr); pkt->l3_len = sizeof(struct ipv4_hdr); pkts_burst[nb_pkt] = pkt; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 062e3ea43..49720ad41 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -221,7 +221,7 @@ ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf) } static void -ether_addr_dump(const char *what, const struct ether_addr *ea) +ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { char buf[ETHER_ADDR_FMT_SIZE]; @@ -275,12 +275,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *pkt; - struct ether_hdr *eth_h; - struct vlan_hdr *vlan_h; + struct rte_ether_hdr *eth_h; + struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; struct icmp_hdr *icmp_h; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; uint16_t nb_rx; @@ -321,9 +321,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); pkt = pkts_burst[i]; - eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_h->ether_type); - l2_len = sizeof(struct ether_hdr); + l2_len = sizeof(struct rte_ether_hdr); if (verbose_level > 0) { printf("\nPort %d pkt-len=%u nb-segs=%u\n", fs->rx_port, pkt->pkt_len, pkt->nb_segs); @@ -331,9 +331,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_dump(" dst=", ð_h->d_addr); } if (eth_type == ETHER_TYPE_VLAN) { - vlan_h = (struct vlan_hdr *) - ((char *)eth_h + sizeof(struct ether_hdr)); - l2_len += sizeof(struct vlan_hdr); + vlan_h = (struct rte_vlan_hdr *) + ((char *)eth_h + sizeof(struct rte_ether_hdr)); + l2_len += sizeof(struct rte_vlan_hdr); eth_type = rte_be_to_cpu_16(vlan_h->eth_proto); if (verbose_level > 0) { vlan_id = rte_be_to_cpu_16(vlan_h->vlan_tci) diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index 6ae802c86..c6aa3c618 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -93,8 +93,8 @@ static void ieee1588_packet_fwd(struct fwd_stream *fs) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; - struct ether_addr addr; + struct rte_ether_hdr *eth_hdr; + struct rte_ether_addr addr; struct ptpv2_msg *ptp_hdr; uint16_t eth_type; uint32_t timesync_index; @@ -111,7 +111,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * Check that the received packet is a PTP packet that was detected * by the hardware. */ - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) { @@ -141,7 +141,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * PTP_SYNC_MESSAGE. */ ptp_hdr = (struct ptpv2_msg *) (rte_pktmbuf_mtod(mb, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (ptp_hdr->version != 0x02) { printf("Port %u Received PTP V2 Ethernet frame with wrong PTP" " protocol version 0x%x (should be 0x02)\n", diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 7cac757a0..631f86f3e 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -49,7 +49,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_port *txp; struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t retry; uint16_t nb_rx; uint16_t nb_tx; @@ -91,14 +91,14 @@ pkt_burst_mac_forward(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); mb = pkts_burst[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; - mb->l2_len = sizeof(struct ether_hdr); + mb->l2_len = sizeof(struct rte_ether_hdr); mb->l3_len = sizeof(struct ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; diff --git a/app/test-pmd/macswap.h b/app/test-pmd/macswap.h index bfa9b0eda..d53e5d482 100644 --- a/app/test-pmd/macswap.h +++ b/app/test-pmd/macswap.h @@ -11,9 +11,9 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_mbuf *mb; - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t ol_flags; int i; @@ -26,7 +26,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb = pkts[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ ether_addr_copy(ð_hdr->d_addr, &addr); diff --git a/app/test-pmd/macswap_common.h b/app/test-pmd/macswap_common.h index 19754cdd1..56f86baad 100644 --- a/app/test-pmd/macswap_common.h +++ b/app/test-pmd/macswap_common.h @@ -39,7 +39,7 @@ mbuf_field_set(struct rte_mbuf *mb, uint64_t ol_flags) { mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; - mb->l2_len = sizeof(struct ether_hdr); + mb->l2_len = sizeof(struct rte_ether_hdr); mb->l3_len = sizeof(struct ipv4_hdr); } diff --git a/app/test-pmd/macswap_neon.h b/app/test-pmd/macswap_neon.h index bdf416aa2..df6c260cd 100644 --- a/app/test-pmd/macswap_neon.h +++ b/app/test-pmd/macswap_neon.h @@ -16,7 +16,7 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr[4]; + struct rte_ether_hdr *eth_hdr[4]; struct rte_mbuf *mb[4]; uint64_t ol_flags; int i; @@ -46,16 +46,16 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, } mb[0] = pkts[i++]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); mb[1] = pkts[i++]; - eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct rte_ether_hdr *); mb[2] = pkts[i++]; - eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct rte_ether_hdr *); mb[3] = pkts[i++]; - eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct rte_ether_hdr *); v0 = vld1q_u8((uint8_t const *)eth_hdr[0]); v1 = vld1q_u8((uint8_t const *)eth_hdr[1]); @@ -83,7 +83,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, if (i < nb - 1) rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb[0] = pkts[i]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ v0 = vld1q_u8((uint8_t const *)eth_hdr[0]); diff --git a/app/test-pmd/macswap_sse.h b/app/test-pmd/macswap_sse.h index 2b6e7324d..223f87a53 100644 --- a/app/test-pmd/macswap_sse.h +++ b/app/test-pmd/macswap_sse.h @@ -11,7 +11,7 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr[4]; + struct rte_ether_hdr *eth_hdr[4]; struct rte_mbuf *mb[4]; uint64_t ol_flags; int i; @@ -43,20 +43,20 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, } mb[0] = pkts[i++]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); addr0 = _mm_loadu_si128((__m128i *)eth_hdr[0]); mb[1] = pkts[i++]; - eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct rte_ether_hdr *); addr1 = _mm_loadu_si128((__m128i *)eth_hdr[1]); mb[2] = pkts[i++]; - eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct rte_ether_hdr *); addr2 = _mm_loadu_si128((__m128i *)eth_hdr[2]); mb[3] = pkts[i++]; - eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct rte_ether_hdr *); addr3 = _mm_loadu_si128((__m128i *)eth_hdr[3]); addr0 = _mm_shuffle_epi8(addr0, shfl_msk); @@ -80,7 +80,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, if (i < nb - 1) rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb[0] = pkts[i]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ addr0 = _mm_loadu_si128((__m128i *)eth_hdr[0]); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index aeaa74c98..831221c99 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -137,7 +137,7 @@ uint8_t txring_numa[RTE_MAX_ETHPORTS]; * Must be instantiated with the ethernet addresses of peer traffic generator * ports. */ -struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; +struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; portid_t nb_peer_eth_addrs = 0; /* @@ -1953,7 +1953,7 @@ start_port(portid_t pid) portid_t pi; queueid_t qi; struct rte_port *port; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; if (port_id_is_invalid(pid, ENABLED_WARN)) return 0; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index a45988ebc..2f1780216 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -162,7 +162,7 @@ struct softnic_port { struct rte_port { struct rte_eth_dev_info dev_info; /**< PCI info + driver name */ struct rte_eth_conf dev_conf; /**< Port configuration. */ - struct ether_addr eth_addr; /**< Port ethernet address */ + struct rte_ether_addr eth_addr; /**< Port ethernet address */ struct rte_eth_stats stats; /**< Last port statistics */ unsigned int socket_id; /**< For NUMA support */ uint16_t parse_tunnel:1; /**< Parse internal headers */ @@ -182,7 +182,7 @@ struct rte_port { uint16_t nb_tx_desc[MAX_QUEUE_ID+1]; /**< per queue tx desc number */ struct rte_eth_rxconf rx_conf[MAX_QUEUE_ID+1]; /**< per queue rx configuration */ struct rte_eth_txconf tx_conf[MAX_QUEUE_ID+1]; /**< per queue tx configuration */ - struct ether_addr *mc_addr_pool; /**< pool of multicast addrs */ + struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */ struct port_flow *flow_list; /**< Associated flows. */ @@ -452,7 +452,7 @@ extern struct fwd_stream **fwd_streams; extern uint16_t vxlan_gpe_udp_port; /**< UDP port of tunnel VXLAN-GPE. */ extern portid_t nb_peer_eth_addrs; /**< Number of peer ethernet addresses. */ -extern struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for mac-retry. */ extern uint32_t burst_tx_retry_num; /**< Burst tx retry number for mac-retry. */ @@ -811,8 +811,8 @@ void show_gro(portid_t port_id); void setup_gso(const char *mode, portid_t port_id); /* Functions to manage the set of filtered Multicast MAC addresses */ -void mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr); -void mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr); +void mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr); +void mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr); void port_dcb_info_display(portid_t port_id); uint8_t *open_file(const char *file_path, uint32_t *size); diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 66e63788a..c4e891a13 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -150,7 +150,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, static inline bool pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, - struct ether_hdr *eth_hdr, const uint16_t vlan_tci, + struct rte_ether_hdr *eth_hdr, const uint16_t vlan_tci, const uint16_t vlan_tci_outer, const uint64_t ol_flags) { struct rte_mbuf *pkt_segs[RTE_MAX_SEGS_PER_PKT]; @@ -174,7 +174,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; - pkt->l2_len = sizeof(struct ether_hdr); + pkt->l2_len = sizeof(struct rte_ether_hdr); pkt->l3_len = sizeof(struct ipv4_hdr); pkt_len = pkt->data_len; @@ -191,14 +191,14 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, */ copy_buf_to_pkt(eth_hdr, sizeof(eth_hdr), pkt, 0); copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (txonly_multi_flow) { struct ipv4_hdr *ip_hdr; uint32_t addr; ip_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* * Generate multiple flows by varying IP src addr. This * enables packets are well distributed by RSS in @@ -210,7 +210,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, ip_hdr->src_addr = rte_cpu_to_be_32(addr); } copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr)); /* * Complete first mbuf of packet and append it to the @@ -232,7 +232,7 @@ pkt_burst_transmit(struct fwd_stream *fs) struct rte_port *txp; struct rte_mbuf *pkt; struct rte_mempool *mbp; - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; uint16_t nb_tx; uint16_t nb_pkt; uint16_t vlan_tci, vlan_tci_outer; @@ -345,7 +345,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) { uint16_t pkt_data_len; - pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct ether_hdr) + + pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 6b0791daa..0544b8e53 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -14,7 +14,7 @@ #include "testpmd.h" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -26,7 +26,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, int is_rx) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; uint64_t ol_flags; uint16_t i, packet_type; @@ -46,7 +46,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], (unsigned int) nb_pkts); for (i = 0; i < nb_pkts; i++) { mb = pkts[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type); ol_flags = mb->ol_flags; packet_type = mb->packet_type; @@ -110,9 +110,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint8_t l3_len; uint8_t l4_len; uint8_t l4_proto; - struct vxlan_hdr *vxlan_hdr; + struct rte_vxlan_hdr *vxlan_hdr; - l2_len = sizeof(struct ether_hdr); + l2_len = sizeof(struct rte_ether_hdr); /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { @@ -134,7 +134,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], l2_len + l3_len); l4_len = sizeof(struct udp_hdr); vxlan_hdr = rte_pktmbuf_mtod_offset(mb, - struct vxlan_hdr *, + struct rte_vxlan_hdr *, l2_len + l3_len + l4_len); udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port); vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index ccc0bd591..51ab0db29 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -53,16 +53,16 @@ copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } void -initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t ether_type, +initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id) { ether_addr_copy(dst_mac, ð_hdr->d_addr); ether_addr_copy(src_mac, ð_hdr->s_addr); if (vlan_enabled) { - struct vlan_hdr *vhdr = (struct vlan_hdr *)((uint8_t *)eth_hdr + - sizeof(struct ether_hdr)); + 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); @@ -74,8 +74,8 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, } void -initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); @@ -256,7 +256,7 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { @@ -293,9 +293,9 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, * Copy headers in first packet segment(s). */ if (vlan_enabled) - eth_hdr_size = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr); else - eth_hdr_size = sizeof(struct ether_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr); copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); @@ -334,7 +334,7 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, int generate_packet_burst_proto(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, uint8_t proto, void *proto_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { @@ -371,10 +371,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, * Copy headers in first packet segment(s). */ if (vlan_enabled) - eth_hdr_size = sizeof(struct ether_hdr) + - sizeof(struct vlan_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr); else - eth_hdr_size = sizeof(struct ether_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr); copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index b6e013a11..8489212d0 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -24,13 +24,13 @@ extern "C" { #define PACKET_BURST_GEN_PKT_LEN_128 128 void -initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t ether_type, +initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id); void -initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); uint16_t @@ -59,14 +59,14 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); int generate_packet_burst_proto(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, uint8_t proto, void *proto_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); diff --git a/app/test/test_cmdline_etheraddr.c b/app/test/test_cmdline_etheraddr.c index 086108ab2..90943c2b4 100644 --- a/app/test/test_cmdline_etheraddr.c +++ b/app/test/test_cmdline_etheraddr.c @@ -82,7 +82,7 @@ const char * ether_addr_invalid_strs[] = { static int -is_addr_different(const struct ether_addr addr, uint64_t num) +is_addr_different(const struct rte_ether_addr addr, uint64_t num) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++, num >>= 8) @@ -97,7 +97,7 @@ int test_parse_etheraddr_invalid_param(void) { char buf[CMDLINE_TEST_BUFSIZE]; - struct ether_addr result; + struct rte_ether_addr result; int ret = 0; /* try all null */ @@ -148,12 +148,12 @@ test_parse_etheraddr_invalid_data(void) { int ret = 0; unsigned i; - struct ether_addr result; + struct rte_ether_addr result; /* test full strings */ for (i = 0; i < ETHERADDR_INVALID_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_invalid_strs[i], (void*)&result, sizeof(result)); @@ -173,12 +173,12 @@ test_parse_etheraddr_valid(void) { int ret = 0; unsigned i; - struct ether_addr result; + struct rte_ether_addr result; /* test full strings */ for (i = 0; i < ETHERADDR_VALID_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_valid_strs[i].str, (void*)&result, sizeof(result)); @@ -197,7 +197,7 @@ test_parse_etheraddr_valid(void) /* test garbage strings */ for (i = 0; i < ETHERADDR_GARBAGE_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_garbage_strs[i], (void*)&result, sizeof(result)); diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index 38f5c039f..953b82745 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -78,7 +78,7 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf, return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c index c26c5152c..208d20c53 100644 --- a/app/test/test_event_eth_tx_adapter.c +++ b/app/test/test_event_eth_tx_adapter.c @@ -84,7 +84,7 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf, return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 5f5beeee7..f81bbba3a 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -39,7 +39,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -49,7 +49,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -59,7 +59,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -72,7 +72,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -82,7 +82,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -489,7 +489,7 @@ static int init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); @@ -503,9 +503,9 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, printf("Set up IPv4 UDP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, src_addr, dst_addr, @@ -526,7 +526,7 @@ static int init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); @@ -540,9 +540,9 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, printf("Set up IPv4 TCP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, @@ -563,7 +563,7 @@ static int init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); @@ -577,9 +577,9 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, printf("Set up IPv4 SCTP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 2c20f44ea..25276715a 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -73,11 +73,11 @@ struct link_bonding_unittest_params { struct rte_mempool *mbuf_pool; - struct ether_addr *default_slave_mac; - struct ether_addr *default_bonded_mac; + struct rte_ether_addr *default_slave_mac; + struct rte_ether_addr *default_bonded_mac; /* Packet Headers */ - struct ether_hdr *pkt_eth_hdr; + struct rte_ether_hdr *pkt_eth_hdr; struct ipv4_hdr *pkt_ipv4_hdr; struct ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; @@ -99,8 +99,8 @@ static struct link_bonding_unittest_params default_params = { .mbuf_pool = NULL, - .default_slave_mac = (struct ether_addr *)slave_mac, - .default_bonded_mac = (struct ether_addr *)bonded_mac, + .default_slave_mac = (struct rte_ether_addr *)slave_mac, + .default_bonded_mac = (struct rte_ether_addr *)bonded_mac, .pkt_eth_hdr = NULL, .pkt_ipv4_hdr = &pkt_ipv4_hdr, @@ -210,12 +210,12 @@ static int test_setup(void) { int i, nb_mbuf_per_pool; - struct ether_addr *mac_addr = (struct ether_addr *)slave_mac; + struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)slave_mac; /* Allocate ethernet packet header with space for VLAN header */ if (test_params->pkt_eth_hdr == NULL) { - test_params->pkt_eth_hdr = malloc(sizeof(struct ether_hdr) + - sizeof(struct vlan_hdr)); + test_params->pkt_eth_hdr = malloc(sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr)); TEST_ASSERT_NOT_NULL(test_params->pkt_eth_hdr, "Ethernet header struct allocation failed!"); @@ -376,7 +376,7 @@ static int test_remove_slave_from_bonded_device(void) { int current_slave_count; - struct ether_addr read_mac_addr, *mac_addr; + struct rte_ether_addr read_mac_addr, *mac_addr; uint16_t slaves[RTE_MAX_ETHPORTS]; TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(test_params->bonded_port_id, @@ -394,7 +394,7 @@ test_remove_slave_from_bonded_device(void) current_slave_count, test_params->bonded_slave_count - 1); - mac_addr = (struct ether_addr *)slave_mac; + mac_addr = (struct rte_ether_addr *)slave_mac; mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = test_params->bonded_slave_count-1; @@ -699,8 +699,8 @@ static int test_set_primary_slave(void) { int i, j, retval; - struct ether_addr read_mac_addr; - struct ether_addr *expected_mac_addr; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr *expected_mac_addr; /* Add 4 slaves to bonded device */ for (i = test_params->bonded_slave_count; i < 4; i++) @@ -750,7 +750,7 @@ test_set_primary_slave(void) "Failed to start bonded port %d", test_params->bonded_port_id); - expected_mac_addr = (struct ether_addr *)&slave_mac; + expected_mac_addr = (struct rte_ether_addr *)&slave_mac; expected_mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; /* Check primary slave MAC */ @@ -801,12 +801,12 @@ static int test_set_explicit_bonded_mac(void) { int i; - struct ether_addr read_mac_addr; - struct ether_addr *mac_addr; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr *mac_addr; uint8_t explicit_bonded_mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x01 }; - mac_addr = (struct ether_addr *)explicit_bonded_mac; + mac_addr = (struct rte_ether_addr *)explicit_bonded_mac; /* Invalid port ID */ TEST_ASSERT_FAIL(rte_eth_bond_mac_address_set(INVALID_PORT_ID, mac_addr), @@ -878,11 +878,11 @@ test_set_bonded_port_initialization_mac_assignment(void) uint16_t slaves[RTE_MAX_ETHPORTS]; int slave_port_ids[BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT]; - struct ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; + struct rte_ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; /* Initialize default values for MAC addresses */ - memcpy(&slave_mac_addr, slave_mac, sizeof(struct ether_addr)); - memcpy(&bonded_mac_addr, slave_mac, sizeof(struct ether_addr)); + memcpy(&slave_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); + memcpy(&bonded_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); /* * 1. a - Create / configure bonded / slave ethdevs @@ -1268,11 +1268,11 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, if (toggle_dst_mac) initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_1, ether_type, vlan, vlan_id); else initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ether_type, vlan, vlan_id); @@ -1663,7 +1663,7 @@ test_roundrobin_rx_burst_on_multiple_slaves(void) static int test_roundrobin_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_2; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_2; int i; @@ -1722,7 +1722,7 @@ test_roundrobin_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "Failed to set MAC"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -1931,7 +1931,7 @@ int polling_test_slaves[TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT] = { -1, -1 }; static int test_roundrobin_verfiy_polling_slave_link_status_change(void) { - struct ether_addr *mac_addr = (struct ether_addr *)polling_slave_mac; + struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)polling_slave_mac; char slave_name[RTE_ETH_NAME_MAX_LEN]; int i; @@ -2030,7 +2030,7 @@ test_activebackup_tx_burst(void) "Failed to initialize bonded device with slaves"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -2237,7 +2237,7 @@ test_activebackup_verify_promiscuous_enable_disable(void) static int test_activebackup_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -2319,7 +2319,7 @@ test_activebackup_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -2564,7 +2564,7 @@ test_balance_l2_tx_burst(void) "Failed to set balance xmit policy."); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -2579,7 +2579,7 @@ test_balance_l2_tx_burst(void) "failed to generate packet burst"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_1, ETHER_TYPE_IPv4, 0, 0); /* Generate a burst 2 of packets to transmit */ @@ -3129,7 +3129,7 @@ test_balance_verify_promiscuous_enable_disable(void) static int test_balance_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -3211,7 +3211,7 @@ test_balance_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -3402,7 +3402,7 @@ test_broadcast_tx_burst(void) "Failed to initialise bonded device"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, @@ -3713,7 +3713,7 @@ test_broadcast_verify_promiscuous_enable_disable(void) static int test_broadcast_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; int i; @@ -3774,7 +3774,7 @@ test_broadcast_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "Failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -3985,12 +3985,12 @@ test_tlb_tx_burst(void) /*test two types of mac src own(bonding) and others */ if (i % 2 == 0) { initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); } else { initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)test_params->default_slave_mac, - (struct ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)test_params->default_slave_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); } pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -4201,7 +4201,7 @@ test_tlb_verify_promiscuous_enable_disable(void) static int test_tlb_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -4284,7 +4284,7 @@ test_tlb_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -4459,14 +4459,14 @@ test_alb_change_mac_in_reply_sent(void) struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; - struct ether_hdr *eth_pkt; + struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; int slave_idx, nb_pkts, pkt_idx; int retval = 0; - struct ether_addr bond_mac, client_mac; - struct ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr bond_mac, client_mac; + struct rte_ether_addr *slave_mac1, *slave_mac2; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4492,40 +4492,40 @@ test_alb_change_mac_in_reply_sent(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4545,8 +4545,8 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4570,7 +4570,7 @@ test_alb_change_mac_in_reply_sent(void) static int test_alb_reply_from_client(void) { - struct ether_hdr *eth_pkt; + struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; @@ -4579,8 +4579,8 @@ test_alb_reply_from_client(void) int slave_idx, nb_pkts, pkt_idx, nb_pkts_sum = 0; int retval = 0; - struct ether_addr bond_mac, client_mac; - struct ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr bond_mac, client_mac; + struct rte_ether_addr *slave_mac1, *slave_mac2; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4605,10 +4605,10 @@ test_alb_reply_from_client(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4616,10 +4616,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client2, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4627,10 +4627,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client3, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4638,10 +4638,10 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client4, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + 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, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4666,8 +4666,8 @@ test_alb_reply_from_client(void) nb_pkts_sum += nb_pkts; for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4697,8 +4697,8 @@ test_alb_reply_from_client(void) static int test_alb_receive_vlan_reply(void) { - struct ether_hdr *eth_pkt; - struct vlan_hdr *vlan_pkt; + struct rte_ether_hdr *eth_pkt; + struct rte_vlan_hdr *vlan_pkt; struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; @@ -4707,7 +4707,7 @@ test_alb_receive_vlan_reply(void) int slave_idx, nb_pkts, pkt_idx; int retval = 0; - struct ether_addr bond_mac, client_mac; + struct rte_ether_addr bond_mac, client_mac; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4731,10 +4731,10 @@ test_alb_receive_vlan_reply(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_VLAN, 0, 0); - vlan_pkt = (struct vlan_hdr *)((char *)(eth_pkt + 1)); + 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 = vlan_pkt+1; @@ -4758,8 +4758,8 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - vlan_pkt = (struct vlan_hdr *)((char *)(eth_pkt + 1)); + eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct rte_ether_hdr *); + vlan_pkt = (struct rte_vlan_hdr *)((char *)(eth_pkt + 1)); if (vlan_pkt->vlan_tci != rte_cpu_to_be_16(1)) { retval = -1; goto test_end; diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index e539f078d..63fcafaea 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -54,19 +54,19 @@ #define INVALID_PORT_ID (0xFF) #define INVALID_BONDING_MODE (-1) -static const struct ether_addr slave_mac_default = { +static const struct rte_ether_addr slave_mac_default = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; -static const struct ether_addr parnter_mac_default = { +static const struct rte_ether_addr parnter_mac_default = { { 0x22, 0xBB, 0xFF, 0xBB, 0x00, 0x00 } }; -static const struct ether_addr parnter_system = { +static const struct rte_ether_addr parnter_system = { { 0x33, 0xFF, 0xBB, 0xFF, 0x00, 0x00 } }; -static const struct ether_addr slow_protocol_mac_addr = { +static const struct rte_ether_addr slow_protocol_mac_addr = { { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; @@ -80,8 +80,8 @@ struct slave_conf { }; struct ether_vlan_hdr { - struct ether_hdr pkt_eth_hdr; - struct vlan_hdr vlan_hdr; + struct rte_ether_hdr pkt_eth_hdr; + struct rte_vlan_hdr vlan_hdr; }; struct link_bonding_unittest_params { @@ -224,7 +224,7 @@ configure_ethdev(uint16_t port_id, uint8_t start) static int add_slave(struct slave_conf *slave, uint8_t start) { - struct ether_addr addr, addr_check; + struct rte_ether_addr addr, addr_check; /* Some sanity check */ RTE_VERIFY(test_params.slave_ports <= slave && @@ -293,12 +293,12 @@ remove_slave(struct slave_conf *slave) static void lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) { - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; RTE_VERIFY(lacp_pkt != NULL); - hdr = rte_pktmbuf_mtod(lacp_pkt, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(lacp_pkt, struct rte_ether_hdr *); RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_SLOW)); slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *); @@ -474,12 +474,12 @@ testsuite_teardown(void) static int make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) { - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; struct lacpdu *lacp; /* look for LACP */ - hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW)) return 1; @@ -718,8 +718,8 @@ test_mode4_agg_mode_selection(void) } static int -generate_packets(struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf) +generate_packets(struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf) { uint16_t pktlen = PACKET_BURST_GEN_PKT_LEN; uint8_t vlan_enable = 0; @@ -731,7 +731,7 @@ generate_packets(struct ether_addr *src_mac, uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { struct ipv4_hdr v4; @@ -765,8 +765,8 @@ generate_packets(struct ether_addr *src_mac, } static int -generate_and_put_packets(struct slave_conf *slave, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t count) +generate_and_put_packets(struct slave_conf *slave, struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t count) { struct rte_mbuf *pkts[MAX_PKT_BURST]; int retval; @@ -796,11 +796,11 @@ test_mode4_rx(void) int retval; unsigned delay; - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; - struct ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; - struct ether_addr dst_mac; - struct ether_addr bonded_mac; + struct rte_ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; + struct rte_ether_addr dst_mac; + struct rte_ether_addr bonded_mac; retval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, 0); @@ -844,7 +844,7 @@ test_mode4_rx(void) int cnt[2] = { 0, 0 }; for (i = 0; i < expected_pkts_cnt; i++) { - hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; } @@ -888,7 +888,7 @@ test_mode4_rx(void) int eq_cnt = 0; for (i = 0; i < expected_pkts_cnt; i++) { - hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac); } @@ -977,8 +977,8 @@ test_mode4_tx_burst(void) int retval; unsigned delay; - struct ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; - struct ether_addr bonded_mac; + struct rte_ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; + struct rte_ether_addr bonded_mac; retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -1351,7 +1351,7 @@ test_mode4_ext_ctrl(void) uint8_t i; struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; - struct ether_addr src_mac, dst_mac; + struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { .subtype = SLOW_SUBTYPE_LACP, @@ -1405,7 +1405,7 @@ test_mode4_ext_lacp(void) struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; struct rte_mbuf *buf[SLAVE_COUNT]; - struct ether_addr src_mac, dst_mac; + struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { .subtype = SLOW_SUBTYPE_LACP, diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c index d82de2cef..4392522ea 100644 --- a/app/test/test_link_bonding_rssconf.c +++ b/app/test/test_link_bonding_rssconf.c @@ -495,7 +495,7 @@ test_setup(void) int port_id; char name[256]; struct slave_conf *port; - struct ether_addr mac_addr = { .addr_bytes = {0} }; + struct rte_ether_addr mac_addr = { .addr_bytes = {0} }; if (test_params.mbuf_pool == NULL) { diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index ed8524a17..b85da914c 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -58,7 +58,7 @@ static struct rte_mempool *mbufpool[NB_SOCKETS]; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { @@ -171,7 +171,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -182,7 +182,7 @@ static int init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; @@ -191,8 +191,8 @@ init_traffic(struct rte_mempool *mp, initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, 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 40e411cab..c4554aa74 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -78,15 +78,15 @@ create_mempool(void) static void prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) { - struct ether_hdr *eth_hdr; - struct vlan_hdr *vlan1, *vlan2; + struct rte_ether_hdr *eth_hdr; + struct rte_vlan_hdr *vlan1, *vlan2; struct ipv4_hdr *ip_hdr; /* Simulate a classifier */ - eth_hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); - vlan1 = (struct vlan_hdr *)(ð_hdr->ether_type ); - vlan2 = (struct vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct vlan_hdr)); - eth_hdr = (struct ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct vlan_hdr)); + eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); + vlan1 = (struct rte_vlan_hdr *)(ð_hdr->ether_type ); + vlan2 = (struct rte_vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct rte_vlan_hdr)); + eth_hdr = (struct rte_ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct rte_vlan_hdr)); ip_hdr = (struct ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index f8ddc2db8..15ce64445 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -218,7 +218,7 @@ virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused) static int virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct ether_addr *addr) + __rte_unused struct rte_ether_addr *addr) { return 0; } @@ -496,7 +496,7 @@ virtual_ethdev_get_mbufs_from_tx_queue(uint16_t port_id, int -virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, +virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support) { struct rte_pci_device *pci_dev = NULL; diff --git a/app/test/virtual_pmd.h b/app/test/virtual_pmd.h index 5ca02bb50..120b58b27 100644 --- a/app/test/virtual_pmd.h +++ b/app/test/virtual_pmd.h @@ -15,7 +15,7 @@ int virtual_ethdev_init(void); int -virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, +virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support); void diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst index 9de14443e..fc9003a8b 100644 --- a/doc/guides/prog_guide/bbdev.rst +++ b/doc/guides/prog_guide/bbdev.rst @@ -752,12 +752,12 @@ buffers using (**sw_trubo**) bbdev PMD. for (j = 0; j < op_num; j++) { /* Append the size of the ethernet header */ rte_pktmbuf_append(input_pkts_burst[j], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* set op */ ops_burst[j]->turbo_enc.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); ops_burst[j]->turbo_enc->input.length = rte_pktmbuf_pkt_len(bbdev_pkts[j]); @@ -766,7 +766,7 @@ buffers using (**sw_trubo**) bbdev PMD. input_pkts_burst[j]; ops_burst[j]->turbo_enc->output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); ops_burst[j]->turbo_enc->output.data = output_pkts_burst[j]; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index a6383b3c7..9582b9376 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -91,7 +91,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -101,7 +101,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -111,7 +111,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -124,7 +124,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -134,7 +134,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -275,7 +275,7 @@ Forwarding application is shown below: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst index be3d63f90..02fc67550 100644 --- a/doc/guides/sample_app_ug/flow_filtering.rst +++ b/doc/guides/sample_app_ug/flow_filtering.rst @@ -304,7 +304,7 @@ looks like the following: main_loop(void) { struct rte_mbuf *mbufs[32]; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t nb_rx; uint16_t i; uint16_t j; @@ -318,7 +318,7 @@ looks like the following: struct rte_mbuf *m = mbufs[j]; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", @@ -348,7 +348,7 @@ queues and printing for each packet the destination queue: if (nb_rx) { for (j = 0; j < nb_rx; j++) { struct rte_mbuf *m = mbufs[j]; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", ð_hdr->d_addr); printf(" - queue=0x%x", (unsigned int)i); diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index f6efa7f6f..1fe6bf113 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct ether_hdr)); + iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -216,14 +216,14 @@ The actual packet transmission is done in the mcast_send_pkt() function: .. code-block:: c - static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) + static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t) sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t) sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index dfc1ed9ca..02c1367f5 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -451,13 +451,13 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index e5b28e425..54e5b8022 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -367,13 +367,13 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index ddd0f9a86..58c4aae92 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -270,10 +270,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index 571cd2d60..3fd043e82 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -311,11 +311,11 @@ The processing is very simple: processes the TX port from the RX port and then r static void lsi_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port = lsi_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/ptpclient.rst b/doc/guides/sample_app_ug/ptpclient.rst index 9d7446d5f..12b4f13d5 100644 --- a/doc/guides/sample_app_ug/ptpclient.rst +++ b/doc/guides/sample_app_ug/ptpclient.rst @@ -212,17 +212,17 @@ PTP IEEE1588 L2 functionality. void parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { struct ptp_header *ptp_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == PTP_PROTOCOL) { ptp_data.m = m; ptp_data.portid = portid; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); switch (ptp_hdr->msgtype) { case SYNC: diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst index 81463d28d..1ca959c55 100644 --- a/doc/guides/sample_app_ug/rxtx_callbacks.rst +++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst @@ -79,7 +79,7 @@ comments: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index adf258c0d..f7dab9e98 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -197,7 +197,7 @@ which tells the node where the packet has to be distributed. for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } @@ -357,7 +357,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst index 11ee521b3..715f5e91a 100644 --- a/doc/guides/sample_app_ug/skeleton.rst +++ b/doc/guides/sample_app_ug/skeleton.rst @@ -115,7 +115,7 @@ Forwarding application is shown below: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst b/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst index 707afe91a..8e1774d9e 100644 --- a/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst +++ b/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst @@ -165,7 +165,7 @@ the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02. }; /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ - static struct ether_addr pool_addr_template = { + static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; @@ -225,7 +225,7 @@ the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02. /* Set mac for each pool.*/ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; mac.addr_bytes[5] = q; diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 15bf73a40..d6eebc877 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -314,7 +314,7 @@ struct fman_if { /* The index of this MAC (within the Fman it belongs to) */ uint8_t mac_idx; /* The MAC address */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; /* The Qman channel to schedule Tx FQs to */ u16 tx_channel_id; /* The hard-coded FQIDs for this interface. Note: this doesn't cover diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h index 7818de68b..bf7bfae8c 100644 --- a/drivers/bus/dpaa/include/netcfg.h +++ b/drivers/bus/dpaa/include/netcfg.h @@ -30,8 +30,8 @@ struct netcfg_info { struct interface_info { char *name; - struct ether_addr mac_addr; - struct ether_addr peer_mac; + struct rte_ether_addr mac_addr; + struct rte_ether_addr peer_mac; int mac_present; int fman_enabled_mac_interface; }; diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 99e13fe48..b5c4befce 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -73,7 +73,7 @@ struct pmd_internals { int if_index; char *if_name; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct tpacket_req req; diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 007a1c6b4..4bd0392ef 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -109,7 +109,7 @@ struct pmd_internals { int if_index; char if_name[IFNAMSIZ]; uint16_t queue_idx; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct xsk_umem_info *umem; struct rte_mempool *mb_pool_share; @@ -778,7 +778,7 @@ parse_parameters(struct rte_kvargs *kvlist, static int get_iface_info(const char *if_name, - struct ether_addr *eth_addr, + struct rte_ether_addr *eth_addr, int *if_index) { struct ifreq ifr; diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 4f52e2bd1..b2b1fd78a 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -41,9 +41,9 @@ static int eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); static void eth_ark_dev_stats_reset(struct rte_eth_dev *dev); static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int eth_ark_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, @@ -220,14 +220,14 @@ check_for_ext(struct ark_adapter *ark) (void (*)(struct rte_eth_dev *, void *)) dlsym(ark->d_handle, "stats_reset"); ark->user_ext.mac_addr_add = - (void (*)(struct rte_eth_dev *, struct ether_addr *, uint32_t, + (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, uint32_t, uint32_t, void *)) dlsym(ark->d_handle, "mac_addr_add"); ark->user_ext.mac_addr_remove = (void (*)(struct rte_eth_dev *, uint32_t, void *)) dlsym(ark->d_handle, "mac_addr_remove"); ark->user_ext.mac_addr_set = - (void (*)(struct rte_eth_dev *, struct ether_addr *, + (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, void *)) dlsym(ark->d_handle, "mac_addr_set"); ark->user_ext.set_mtu = @@ -833,7 +833,7 @@ eth_ark_dev_stats_reset(struct rte_eth_dev *dev) static int eth_ark_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { @@ -864,7 +864,7 @@ eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private; diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h index f5af21538..5a987e4d6 100644 --- a/drivers/net/ark/ark_ext.h +++ b/drivers/net/ark/ark_ext.h @@ -70,7 +70,7 @@ void stats_reset(struct rte_eth_dev *dev, void *user_data); void mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *macadr, + struct rte_ether_addr *macadr, uint32_t index, uint32_t pool, void *user_data); @@ -80,7 +80,7 @@ void mac_addr_remove(struct rte_eth_dev *dev, void *user_data); void mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, void *user_data); int set_mtu(struct rte_eth_dev *dev, diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h index f820091d7..f6609054d 100644 --- a/drivers/net/ark/ark_global.h +++ b/drivers/net/ark/ark_global.h @@ -71,12 +71,12 @@ struct ark_user_ext { int (*stats_get)(struct rte_eth_dev *, struct rte_eth_stats *, void *); void (*stats_reset)(struct rte_eth_dev *, void *); void (*mac_addr_add)(struct rte_eth_dev *, - struct ether_addr *, + struct rte_ether_addr *, uint32_t, uint32_t, void *); void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *); - void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *); + void (*mac_addr_set)(struct rte_eth_dev *, struct rte_ether_addr *, void *); int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *); }; diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 8327863cd..78039f882 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -92,14 +92,14 @@ static void atl_dev_interrupt_handler(void *param); static int atl_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); static int atl_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* RSS */ @@ -1235,7 +1235,7 @@ atl_update_mac_addr(struct rte_eth_dev *dev, uint32_t index, } static int -atl_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index __rte_unused, uint32_t pool __rte_unused) { if (is_zero_ether_addr(mac_addr)) { @@ -1253,7 +1253,7 @@ atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } static int -atl_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +atl_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { atl_remove_mac_addr(dev, 0); atl_add_mac_addr(dev, addr, 0, 0); @@ -1420,7 +1420,7 @@ atl_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue_id, int on) static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c index 4299b7016..e4a1da0be 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c @@ -656,8 +656,8 @@ static int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self, mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct ether_addr *)mac_addr, - (struct ether_addr *)mac); + ether_addr_copy((struct rte_ether_addr *)mac_addr, + (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { /* chip revision */ @@ -867,8 +867,8 @@ static int aq_fw1x_set_wol(struct aq_hw_s *self, bool wol_enabled, u8 *mac) prpc->msg_wol.pattern_id = 1U; prpc->msg_wol.wol_packet_type = 2U; /* Magic Packet */ - ether_addr_copy((struct ether_addr *)mac, - (struct ether_addr *)&prpc->msg_wol.wol_pattern); + ether_addr_copy((struct rte_ether_addr *)mac, + (struct rte_ether_addr *)&prpc->msg_wol.wol_pattern); } else { rpc_size = sizeof(prpc->msg_id) + sizeof(prpc->msg_del_id); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c index f215ceb70..9111be9f4 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -222,8 +222,8 @@ int aq_fw2x_get_mac_permanent(struct aq_hw_s *self, u8 *mac) mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct ether_addr *)mac_addr, - (struct ether_addr *)mac); + ether_addr_copy((struct rte_ether_addr *)mac_addr, + (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { unsigned int rnd = (uint32_t)rte_rand(); diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 09388d05f..69a70d2cc 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -159,7 +159,7 @@ static const struct eth_dev_ops avp_eth_dev_ops = { struct avp_dev { uint32_t magic; /**< Memory validation marker */ uint64_t device_id; /**< Unique system identifier */ - struct ether_addr ethaddr; /**< Host specified MAC address */ + struct rte_ether_addr ethaddr; /**< Host specified MAC address */ struct rte_eth_dev_data *dev_data; /**< Back pointer to ethernet device data */ volatile uint32_t flags; /**< Device operational flags */ @@ -1199,7 +1199,7 @@ avp_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, } static inline int -_avp_cmp_ether_addr(struct ether_addr *a, struct ether_addr *b) +_avp_cmp_ether_addr(struct rte_ether_addr *a, struct rte_ether_addr *b) { uint16_t *_a = (uint16_t *)&a->addr_bytes[0]; uint16_t *_b = (uint16_t *)&b->addr_bytes[0]; @@ -1209,7 +1209,7 @@ _avp_cmp_ether_addr(struct ether_addr *a, struct ether_addr *b) static inline int _avp_mac_filter(struct avp_dev *avp, struct rte_mbuf *m) { - struct ether_hdr *eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (likely(_avp_cmp_ether_addr(&avp->ethaddr, ð->d_addr) == 0)) { /* allow all packets destined to our address */ diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index b1cd2980b..810ac4a74 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -539,7 +539,7 @@ struct axgbe_port { /* Hardware features of the device */ struct axgbe_hw_features hw_feat; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; /* Software Tx/Rx structure pointers*/ void **rx_queues; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index ab092e23f..77a0f56b2 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2177,8 +2177,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(pkt_prod); else { - struct ether_hdr *eh = - rte_pktmbuf_mtod(m0, struct ether_hdr *); + struct rte_ether_hdr *eh = + rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type)); @@ -2188,8 +2188,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) bd_prod = NEXT_TX_BD(bd_prod); if (IS_VF(sc)) { struct eth_tx_parse_bd_e2 *tx_parse_bd; - const struct ether_hdr *eh = - rte_pktmbuf_mtod(m0, struct ether_hdr *); + const struct rte_ether_hdr *eh = + rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); uint8_t mac_type = UNICAST_ADDRESS; tx_parse_bd = diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 1f2eb92b7..5b3eff905 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -497,7 +497,7 @@ bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) } static int -bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct bnx2x_softc *sc = dev->data->dev_private; @@ -650,7 +650,7 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) } } - eth_dev->data->mac_addrs = (struct ether_addr *)sc->link_params.mac_addr; + eth_dev->data->mac_addrs = (struct rte_ether_addr *)sc->link_params.mac_addr; if (IS_VF(sc)) { rte_spinlock_init(&sc->vf2pf_lock); diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h index 45958db9a..160bdc194 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.h +++ b/drivers/net/bnx2x/bnx2x_ethdev.h @@ -75,7 +75,7 @@ typedef int bool; /* MAC address operations */ struct bnx2x_mac_ops { - void (*mac_addr_add)(struct rte_eth_dev *dev, struct ether_addr *addr, + void (*mac_addr_add)(struct rte_eth_dev *dev, struct rte_ether_addr *addr, uint16_t index, uint32_t pool); /* not implemented yet */ void (*mac_addr_remove)(struct rte_eth_dev *dev, uint16_t index); /* not implemented yet */ }; diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index 048bf126f..a044e6eac 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -302,7 +302,7 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ if (is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) ether_addr_copy(&sc_resp.resc.current_mac_addr, - (struct ether_addr *)sc->link_params.mac_addr); + (struct rte_ether_addr *)sc->link_params.mac_addr); else eth_random_addr(sc->link_params.mac_addr); diff --git a/drivers/net/bnx2x/bnx2x_vfpf.h b/drivers/net/bnx2x/bnx2x_vfpf.h index cc6fef956..6964c9d98 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.h +++ b/drivers/net/bnx2x/bnx2x_vfpf.h @@ -115,7 +115,7 @@ struct vf_resc { uint8_t num_vlan_filters; uint8_t num_mc_filters; uint8_t permanent_mac_addr[ETH_ALEN]; - struct ether_addr current_mac_addr; + struct rte_ether_addr current_mac_addr; uint16_t pf_link_speed; uint32_t pf_link_supported; }; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 78ab07d0c..0cad7a144 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -760,7 +760,7 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, } static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; @@ -1451,7 +1451,7 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) } static int -bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) +bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct bnxt *bp = (struct bnxt *)dev->data->dev_private; /* Default Filter is tied to VNIC 0 */ @@ -1489,7 +1489,7 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) static int bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index eb5c41ebb..59e75b0be 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2578,7 +2578,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, struct hwrm_func_cfg_input *cfg_req, int vf) { - struct ether_addr mac; + struct rte_ether_addr mac; if (bnxt_hwrm_func_qcfg_vf_default_mac(bp, vf, &mac)) return; @@ -3112,7 +3112,7 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id, } int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac) + struct rte_ether_addr *mac) { struct hwrm_func_qcfg_input req = {0}; struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index ec9b3e007..53d79f046 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -130,7 +130,7 @@ int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf, uint16_t max_bw, uint16_t enables); int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf); int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac); + struct rte_ether_addr *mac); int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf); int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port, uint8_t tunnel_type); diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index c298de83c..5e3d1bfb1 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.c +++ b/drivers/net/bnxt/rte_pmd_bnxt.c @@ -132,7 +132,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on) } int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; @@ -647,7 +647,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, count); } -int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr, +int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, uint32_t vf_id) { struct rte_eth_dev *dev; @@ -655,7 +655,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr, struct bnxt *bp; struct bnxt_filter_info *filter; struct bnxt_vnic_info vnic; - struct ether_addr dflt_mac; + struct rte_ether_addr dflt_mac; int rc; dev = &rte_eth_devices[port]; diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h index 68fbe34d6..2e893cc7b 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.h +++ b/drivers/net/bnxt/rte_pmd_bnxt.h @@ -67,7 +67,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on); * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable vf vlan strip for all queues in a pool @@ -303,7 +303,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, * - (-ENOTSUP) Ethernet device is not a PF * - (-ENOMEM) on an allocation failure */ -int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *mac_addr, +int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *mac_addr, uint32_t vf_id); /** diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h index b668ff9ad..874aa91a5 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -225,7 +225,7 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], */ int rte_eth_bond_mac_address_set(uint16_t bonded_port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Reset bonded device to use MAC from primary slave on bonded device and it's diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 1e6a3fc7c..51bf3f52e 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -126,7 +126,7 @@ bond_print_lacp(struct lacpdu *l) #define MODE4_DEBUG(fmt, ...) do { } while (0) #endif -static const struct ether_addr lacp_mac_addr = { +static const struct rte_ether_addr lacp_mac_addr = { .addr_bytes = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; @@ -810,7 +810,7 @@ bond_mode_8023ad_periodic_cb(void *arg) struct bond_dev_private *internals = bond_dev->data->dev_private; struct port *port; struct rte_eth_link link_info; - struct ether_addr slave_addr; + struct rte_ether_addr slave_addr; struct rte_mbuf *lacp_pkt = NULL; uint16_t slave_id; uint16_t i; @@ -1044,7 +1044,7 @@ void bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) { struct bond_dev_private *internals = bond_dev->data->dev_private; - struct ether_addr slave_addr; + struct rte_ether_addr slave_addr; struct port *slave, *agg_slave; uint16_t slave_id, i, j; diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h index d8b5dbc21..cbad59aa7 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h @@ -58,14 +58,14 @@ struct slow_protocol { /** Generic slow protocol frame type structure */ struct slow_protocol_frame { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct slow_protocol slow_protocol; } __attribute__((__packed__)); struct port_params { uint16_t system_priority; /**< System priority (unused in current implementation) */ - struct ether_addr system; + struct rte_ether_addr system; /**< System ID - Slave MAC address, same as bonding MAC address */ uint16_t key; /**< Speed information (implementation dependednt) and duplex. */ @@ -103,7 +103,7 @@ struct lacpdu { /** LACPDU frame: Contains ethernet header and LACPDU. */ struct lacpdu_header { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct lacpdu lacpdu; } __attribute__((__packed__)); @@ -114,7 +114,7 @@ struct marker { uint8_t tlv_type_marker; uint8_t info_length; uint16_t requester_port; - struct ether_addr requester_system; + struct rte_ether_addr requester_system; uint32_t requester_transaction_id; uint8_t reserved_2[2]; @@ -124,7 +124,7 @@ struct marker { } __attribute__((__packed__)); struct marker_header { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct marker marker; } __attribute__((__packed__)); diff --git a/drivers/net/bonding/rte_eth_bond_8023ad_private.h b/drivers/net/bonding/rte_eth_bond_8023ad_private.h index f91902ebd..d905de425 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad_private.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad_private.h @@ -150,7 +150,7 @@ struct mode8023ad_private { uint64_t update_timeout_us; rte_eth_bond_8023ad_ext_slowrx_fn slowrx_cb; uint8_t external_sm; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link slave_link; /***< slave link properties */ diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 3df28965c..d47046142 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -72,7 +72,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) return -ENOMEM; } -void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, +void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { struct rte_arp_hdr *arp; @@ -102,7 +102,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, client_info->app_ip != arp->arp_data.arp_tip || client_info->cli_ip != arp->arp_data.arp_sip || !is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || - client_info->vlan_count != offset / sizeof(struct vlan_hdr) || + client_info->vlan_count != offset / sizeof(struct rte_vlan_hdr) || memcmp(client_info->vlan, eth_h + 1, offset) != 0 ) { client_info->in_use = 1; @@ -113,14 +113,14 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); } internals->mode6.ntt = 1; rte_spinlock_unlock(&internals->mode6.lock); } uint16_t -bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { struct rte_arp_hdr *arp; @@ -130,7 +130,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, uint8_t hash_index; - struct ether_addr bonding_mac; + struct rte_ether_addr bonding_mac; arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); @@ -163,7 +163,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); return client_info->slave_idx; } @@ -179,7 +179,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); return client_info->slave_idx; } @@ -195,12 +195,12 @@ uint16_t bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals) { - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; struct rte_arp_hdr *arp_h; uint16_t slave_idx; rte_spinlock_lock(&internals->mode6.lock); - eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ether_addr_copy(&client_info->app_mac, ð_h->s_addr); ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); @@ -209,11 +209,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, else eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) - + client_info->vlan_count * sizeof(struct vlan_hdr)); + arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct rte_ether_hdr) + + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); memcpy(eth_h + 1, client_info->vlan, - client_info->vlan_count * sizeof(struct vlan_hdr)); + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); arp_h->arp_data.arp_sip = client_info->app_ip; diff --git a/drivers/net/bonding/rte_eth_bond_alb.h b/drivers/net/bonding/rte_eth_bond_alb.h index 4640fd24e..386e70c59 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.h +++ b/drivers/net/bonding/rte_eth_bond_alb.h @@ -13,11 +13,11 @@ struct client_data { /** ARP data of single client */ - struct ether_addr app_mac; + struct rte_ether_addr app_mac; /**< MAC address of application running DPDK */ uint32_t app_ip; /**< IP address of application running DPDK */ - struct ether_addr cli_mac; + struct rte_ether_addr cli_mac; /**< Client MAC address */ uint32_t cli_ip; /**< Client IP address */ @@ -29,7 +29,7 @@ struct client_data { uint8_t ntt; /**< Flag indicating if we need to send update to this client on next tx */ - struct vlan_hdr vlan[2]; + struct rte_vlan_hdr vlan[2]; /**< Content of vlan headers */ uint8_t vlan_count; /**< Number of nested vlan headers */ @@ -68,7 +68,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev); * @param internals Bonding data. */ void -bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** @@ -85,7 +85,7 @@ bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, * Index of slave on which packet should be sent. */ uint16_t -bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index a23988dc7..0fc4c5eda 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -840,7 +840,7 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], int rte_eth_bond_mac_address_set(uint16_t bonded_port_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index b60fde6a8..01bbb06c1 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -282,7 +282,7 @@ bond_ethdev_parse_bond_mac_addr_kvarg(const char *key __rte_unused, /* Parse MAC */ return cmdline_parse_etheraddr(NULL, value, extra_args, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } int diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 63df3568d..67a78603f 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -33,21 +33,21 @@ static uint64_t tlb_last_obytets[RTE_MAX_ETHPORTS]; static inline size_t -get_vlan_offset(struct ether_hdr *eth_hdr, uint16_t *proto) +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) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - vlan_offset = sizeof(struct vlan_hdr); + vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; - vlan_offset += sizeof(struct vlan_hdr); + vlan_offset += sizeof(struct rte_vlan_hdr); } } return vlan_offset; @@ -394,8 +394,8 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, struct bond_dev_private *internals = bd_rx_q->dev_private; struct rte_eth_dev *bonded_eth_dev = &rte_eth_devices[internals->port_id]; - struct ether_addr *bond_mac = bonded_eth_dev->data->mac_addrs; - struct ether_hdr *hdr; + 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); uint16_t num_rx_total = 0; /* Total number of received packets */ @@ -444,7 +444,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, if (j + 3 < num_rx_total) rte_prefetch0(rte_pktmbuf_mtod(bufs[j + 3], void *)); - hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); subtype = ((struct slow_protocol_frame *)hdr)->slow_protocol.subtype; /* Remove packet from array if it is slow packet or slave is not @@ -584,7 +584,7 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) #endif static void -mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, +mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_h, uint16_t port, uint32_t __attribute__((unused)) *burstnumber) { struct ipv4_hdr *ipv4_h; @@ -630,7 +630,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; uint16_t ether_type, offset; uint16_t nb_recv_pkts; int i; @@ -638,7 +638,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) nb_recv_pkts = bond_ethdev_rx_burst(queue, bufs, nb_pkts); for (i = 0; i < nb_recv_pkts; i++) { - eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(bufs[i], struct rte_ether_hdr *); ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); @@ -738,7 +738,7 @@ bond_ethdev_tx_burst_active_backup(void *queue, } static inline uint16_t -ether_hash(struct ether_hdr *eth_hdr) +ether_hash(struct rte_ether_hdr *eth_hdr) { unaligned_uint16_t *word_src_addr = (unaligned_uint16_t *)eth_hdr->s_addr.addr_bytes; @@ -775,12 +775,12 @@ void burst_xmit_l2_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t hash; int i; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); hash = ether_hash(eth_hdr); @@ -793,13 +793,13 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { uint16_t i; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t proto; size_t vlan_offset; uint32_t hash, l3hash; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); l3hash = 0; proto = eth_hdr->ether_type; @@ -830,7 +830,7 @@ void burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t proto; size_t vlan_offset; int i; @@ -840,7 +840,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); proto = eth_hdr->ether_type; vlan_offset = get_vlan_offset(eth_hdr, &proto); l3hash = 0; @@ -1003,9 +1003,9 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) uint16_t num_of_slaves = internals->active_slave_count; uint16_t slaves[RTE_MAX_ETHPORTS]; - struct ether_hdr *ether_hdr; - struct ether_addr primary_slave_addr; - struct ether_addr active_slave_addr; + struct rte_ether_hdr *ether_hdr; + struct rte_ether_addr primary_slave_addr; + struct rte_ether_addr active_slave_addr; if (num_of_slaves < 1) return num_tx_total; @@ -1027,7 +1027,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (j + 3 < nb_pkts) rte_prefetch0(rte_pktmbuf_mtod(bufs[j+3], void*)); - ether_hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *); + ether_hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); if (is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) @@ -1063,7 +1063,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; uint16_t ether_type, offset; struct client_data *client_info; @@ -1093,7 +1093,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) /* Search tx buffer for ARP packets and forward them to alb */ for (i = 0; i < nb_pkts; i++) { - eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(bufs[i], struct rte_ether_hdr *); ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); @@ -1127,8 +1127,8 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) "Failed to allocate ARP packet from pool"); continue; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr) - + client_info->vlan_count * sizeof(struct vlan_hdr); + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr) + + client_info->vlan_count * sizeof(struct rte_vlan_hdr); upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; @@ -1159,7 +1159,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) /* Print TX stats including update packets */ for (j = 0; j < slave_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct rte_ether_hdr *); mode6_debug("TX ARP:", eth_h, i, &burstnumberTX); } #endif @@ -1176,7 +1176,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) for (j = 0; j < update_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct rte_ether_hdr *); mode6_debug("TX ARPupd:", eth_h, i, &burstnumberTX); } #endif @@ -1494,9 +1494,9 @@ link_properties_valid(struct rte_eth_dev *ethdev, } int -mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) +mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr) { - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); @@ -1515,9 +1515,9 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) } int -mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) +mac_address_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *new_mac_addr) { - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); @@ -1538,7 +1538,7 @@ mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) return 0; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; /* * Add additional MAC addresses to the slave @@ -1548,7 +1548,7 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, uint16_t slave_port_id) { int i, ret; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; @@ -1576,7 +1576,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, uint16_t slave_port_id) { int i, rc, ret; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; rc = 0; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { @@ -1999,7 +1999,7 @@ slave_add(struct bond_dev_private *internals, slave_details->link_status_wait_to_complete = 0; /* clean tlb_last_obytes when adding port for bonding device */ memcpy(&(slave_details->persisted_mac_addr), slave_eth_dev->data->mac_addrs, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } void @@ -2045,7 +2045,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) } if (internals->user_defined_mac == 0) { - struct ether_addr *new_mac_addr = NULL; + struct rte_ether_addr *new_mac_addr = NULL; for (i = 0; i < internals->slave_count; i++) if (internals->slaves[i].port_id == internals->primary_port) @@ -2931,7 +2931,7 @@ bond_ethdev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } static int -bond_ethdev_mac_address_set(struct rte_eth_dev *dev, struct ether_addr *addr) +bond_ethdev_mac_address_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { if (mac_address_set(dev, addr)) { RTE_BOND_LOG(ERR, "Failed to update MAC address"); @@ -2953,7 +2953,7 @@ bond_filter_ctrl(struct rte_eth_dev *dev __rte_unused, } static int -bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t vmdq) { struct rte_eth_dev *slave_eth_dev; @@ -3004,7 +3004,7 @@ bond_ethdev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) goto end; } - struct ether_addr *mac_addr = &dev->data->mac_addrs[index]; + struct rte_ether_addr *mac_addr = &dev->data->mac_addrs[index]; for (i = 0; i < internals->slave_count; i++) rte_eth_dev_mac_addr_remove(internals->slaves[i].port_id, @@ -3382,7 +3382,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) /* Parse MAC address for bonded device */ arg_count = rte_kvargs_count(kvlist, PMD_BOND_MAC_ADDR_KVARG); if (arg_count == 1) { - struct ether_addr bond_mac; + struct rte_ether_addr bond_mac; if (rte_kvargs_process(kvlist, PMD_BOND_MAC_ADDR_KVARG, &bond_ethdev_parse_bond_mac_addr_kvarg, &bond_mac) < 0) { diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 8afef39ba..107a9ea1a 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -85,7 +85,7 @@ struct bond_slave_details { uint8_t link_status_wait_to_complete; uint8_t last_link_status; /**< Port Id of slave eth_dev */ - struct ether_addr persisted_mac_addr; + struct rte_ether_addr persisted_mac_addr; uint16_t reta_size; }; @@ -223,10 +223,10 @@ void activate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id); int -mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr); +mac_address_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *new_mac_addr); int -mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr); +mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr); int mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev); diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index fb8af5250..b54f75ebc 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -671,7 +671,7 @@ static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx, { struct port_info *pi = adap2pinfo(adapter, port_idx); - ether_addr_copy((struct ether_addr *)hw_addr, + ether_addr_copy((struct rte_ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0]); } diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 833dd1f5f..bdda51894 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1055,7 +1055,7 @@ static int cxgbe_get_regs(struct rte_eth_dev *eth_dev, return 0; } -int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct port_info *pi = (struct port_info *)(dev->data->dev_private); int ret; diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 8d0a105aa..03145cea6 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -16,7 +16,7 @@ void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev); -int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr); +int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr); int cxgbe_dev_configure(struct rte_eth_dev *eth_dev); int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 2e043feb2..0e1dc1ae8 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -934,7 +934,7 @@ dpaa_flow_ctrl_get(struct rte_eth_dev *dev, static int dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, __rte_unused uint32_t pool) { @@ -964,7 +964,7 @@ dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev, static int dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { int ret; struct dpaa_if *dpaa_intf = dev->data->dev_private; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index a4085f47e..dd8fd8fd5 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -198,7 +198,7 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) static inline void dpaa_checksum(struct rte_mbuf *mbuf) { - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 89d20d0bf..bfb9f9dad 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1124,7 +1124,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int dpaa2_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -1155,7 +1155,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev, struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; PMD_INIT_FUNC_TRACE(); @@ -1175,7 +1175,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev, static int dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { int ret; struct dpaa2_dev_priv *priv = dev->data->dev_private; @@ -1992,13 +1992,13 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { */ static int populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, - struct ether_addr *mac_entry) + struct rte_ether_addr *mac_entry) { int ret; - struct ether_addr phy_mac, prime_mac; + struct rte_ether_addr phy_mac, prime_mac; - memset(&phy_mac, 0, sizeof(struct ether_addr)); - memset(&prime_mac, 0, sizeof(struct ether_addr)); + memset(&phy_mac, 0, sizeof(struct rte_ether_addr)); + memset(&prime_mac, 0, sizeof(struct rte_ether_addr)); /* Get the physical device MAC address */ ret = dpni_get_port_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, @@ -2032,7 +2032,7 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, ret); goto cleanup; } - memcpy(&prime_mac, &phy_mac, sizeof(struct ether_addr)); + memcpy(&prime_mac, &phy_mac, sizeof(struct rte_ether_addr)); } } else if (is_zero_ether_addr(&prime_mac)) { /* In case phys and prime, both are zero, create random MAC */ @@ -2047,7 +2047,7 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, } /* prime_mac the final MAC address */ - memcpy(mac_entry, &prime_mac, sizeof(struct ether_addr)); + memcpy(mac_entry, &prime_mac, sizeof(struct rte_ether_addr)); return 0; cleanup: diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index c94c7ef6b..2b4b15e7e 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -215,27 +215,27 @@ dpaa2_configure_flow_eth(struct rte_flow *flow, /* Key rule */ key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_ETH; memcpy((void *)key_iova, (const void *)(spec->src.addr_bytes), - sizeof(struct ether_addr)); - key_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + key_iova += sizeof(struct rte_ether_addr); memcpy((void *)key_iova, (const void *)(spec->dst.addr_bytes), - sizeof(struct ether_addr)); - key_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + key_iova += sizeof(struct rte_ether_addr); memcpy((void *)key_iova, (const void *)(&spec->type), sizeof(rte_be16_t)); /* Key mask */ mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_ETH; memcpy((void *)mask_iova, (const void *)(mask->src.addr_bytes), - sizeof(struct ether_addr)); - mask_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + mask_iova += sizeof(struct rte_ether_addr); memcpy((void *)mask_iova, (const void *)(mask->dst.addr_bytes), - sizeof(struct ether_addr)); - mask_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + mask_iova += sizeof(struct rte_ether_addr); memcpy((void *)mask_iova, (const void *)(&mask->type), sizeof(rte_be16_t)); flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_ETH + - ((2 * sizeof(struct ether_addr)) + + ((2 * sizeof(struct rte_ether_addr)) + sizeof(rte_be16_t))); return device_configured; } diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 8230824e7..ae69a64ea 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -89,14 +89,14 @@ static int eth_em_led_on(struct rte_eth_dev *dev); static int eth_em_led_off(struct rte_eth_dev *dev); static int em_get_rx_buffer_size(struct e1000_hw *hw); -static int eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +static int eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index); static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); #define EM_FC_PAUSE_TIME 0x0680 @@ -293,7 +293,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, eth_dev->data->mac_addrs); /* initialize the vfta */ @@ -1735,7 +1735,7 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) } static int -eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, __rte_unused uint32_t pool) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1756,7 +1756,7 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { eth_em_rar_clear(dev, 0); @@ -1806,7 +1806,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct e1000_hw *hw; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index d3a8f5bf4..df1419f27 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -145,11 +145,11 @@ static int eth_igb_led_off(struct rte_eth_dev *dev); static void igb_intr_disable(struct rte_eth_dev *dev); static int igb_get_rx_buffer_size(struct e1000_hw *hw); static int eth_igb_rar_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index); static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static void igbvf_intr_disable(struct e1000_hw *hw); static int igbvf_dev_configure(struct rte_eth_dev *dev); @@ -174,7 +174,7 @@ static int igbvf_vlan_filter_set(struct rte_eth_dev *dev, static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on); static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on); static int igbvf_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static int igbvf_get_reg_length(struct rte_eth_dev *dev); static int igbvf_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs); @@ -231,7 +231,7 @@ static int eth_igb_get_module_info(struct rte_eth_dev *dev, static int eth_igb_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); static int igb_timesync_enable(struct rte_eth_dev *dev); static int igb_timesync_disable(struct rte_eth_dev *dev); @@ -840,7 +840,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* initialize the vfta */ memset(shadow_vfta, 0, sizeof(*shadow_vfta)); @@ -983,7 +983,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); int diag; - struct ether_addr *perm_addr = (struct ether_addr *)hw->mac.perm_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; PMD_INIT_FUNC_TRACE(); @@ -1057,7 +1057,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) return diag; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x " @@ -3119,7 +3119,7 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) #define E1000_RAH_POOLSEL_SHIFT (18) static int -eth_igb_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -3145,7 +3145,7 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { eth_igb_rar_clear(dev, 0); eth_igb_rar_set(dev, (void *)addr, 0, 0); @@ -3358,7 +3358,7 @@ igbvf_dev_close(struct rte_eth_dev *dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct e1000_adapter *adapter = E1000_DEV_PRIVATE(dev->data->dev_private); - struct ether_addr addr; + struct rte_ether_addr addr; PMD_INIT_FUNC_TRACE(); @@ -3503,7 +3503,7 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) } static int -igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4905,7 +4905,7 @@ eth_igb_filter_ctrl(struct rte_eth_dev *dev, static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct e1000_hw *hw; diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index b9f2e5391..9f1521350 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -306,8 +306,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); int rah; - if (is_unicast_ether_addr((struct ether_addr *)new_mac)) { - if (!is_zero_ether_addr((struct ether_addr *)new_mac)) + if (is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { + if (!is_zero_ether_addr((struct rte_ether_addr *)new_mac)) rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index a55b4a719..14846be94 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1813,9 +1813,9 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK) != 0; /* Copy MAC address and point DPDK to it */ - eth_dev->data->mac_addrs = (struct ether_addr *)adapter->mac_addr; - ether_addr_copy((struct ether_addr *)get_feat_ctx.dev_attr.mac_addr, - (struct ether_addr *)adapter->mac_addr); + eth_dev->data->mac_addrs = (struct rte_ether_addr *)adapter->mac_addr; + ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, + (struct rte_ether_addr *)adapter->mac_addr); /* * Pass the information to the rte_eth_dev_close() that it should also @@ -2151,7 +2151,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, * length of the ethernet header. */ if (unlikely(m->l2_len == 0)) - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 023fe7517..49fbf4e88 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -98,7 +98,7 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x", diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 9193fb038..20080af6f 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -197,7 +197,7 @@ struct enic { /* Multicast MAC addresses added to the NIC */ uint32_t mc_count; - struct ether_addr mc_addrs[ENIC_MULTICAST_PERFECT_FILTERS]; + struct rte_ether_addr mc_addrs[ENIC_MULTICAST_PERFECT_FILTERS]; }; /* Compute ethdev's max packet size from MTU */ diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 8d14d8ac7..71e1b9c7d 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -604,7 +604,7 @@ static void enicpmd_dev_allmulticast_disable(struct rte_eth_dev *eth_dev) } static int enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct enic *enic = pmd_priv(eth_dev); @@ -629,7 +629,7 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index) } static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct enic *enic = pmd_priv(eth_dev); int ret; @@ -644,7 +644,7 @@ static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, return enic_set_mac_address(enic, addr->addr_bytes); } -static void debug_log_add_del_addr(struct ether_addr *addr, bool add) +static void debug_log_add_del_addr(struct rte_ether_addr *addr, bool add) { char mac_str[ETHER_ADDR_FMT_SIZE]; @@ -654,12 +654,12 @@ static void debug_log_add_del_addr(struct ether_addr *addr, bool add) } static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct enic *enic = pmd_priv(eth_dev); char mac_str[ETHER_ADDR_FMT_SIZE]; - struct ether_addr *addr; + struct rte_ether_addr *addr; uint32_t i, j; int ret; @@ -730,7 +730,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, } /* Keep a copy so we can flush/apply later on.. */ memcpy(enic->mc_addrs, mc_addr_set, - nb_mc_addr * sizeof(struct ether_addr)); + nb_mc_addr * sizeof(struct rte_ether_addr)); enic->mc_count = nb_mc_addr; return 0; } diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 5924a01e3..94c443a98 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -571,9 +571,9 @@ enic_copy_item_inner_eth_v2(struct copy_item_args *arg) FLOW_TRACE(); if (!mask) mask = &rte_flow_item_eth_mask; - arg->l2_proto_off = *off + offsetof(struct ether_hdr, ether_type); + arg->l2_proto_off = *off + offsetof(struct rte_ether_hdr, ether_type); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ether_hdr), + arg->item->spec, mask, sizeof(struct rte_ether_hdr), 0 /* no previous protocol */, 0, 0); } @@ -589,9 +589,9 @@ enic_copy_item_inner_vlan_v2(struct copy_item_args *arg) mask = &rte_flow_item_vlan_mask; /* Append vlan header to L5 and set ether type = TPID */ eth_type_off = arg->l2_proto_off; - arg->l2_proto_off = *off + offsetof(struct vlan_hdr, eth_proto); + 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 vlan_hdr), + arg->item->spec, mask, sizeof(struct rte_vlan_hdr), eth_type_off, rte_cpu_to_be_16(ETHER_TYPE_VLAN), 2); } @@ -662,8 +662,8 @@ enic_copy_item_eth_v2(struct copy_item_args *arg) { const struct rte_flow_item *item = arg->item; struct filter_v2 *enic_filter = arg->filter; - struct ether_hdr enic_spec; - struct ether_hdr enic_mask; + struct rte_ether_hdr enic_spec; + struct rte_ether_hdr enic_mask; const struct rte_flow_item_eth *spec = item->spec; const struct rte_flow_item_eth *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; @@ -691,9 +691,9 @@ enic_copy_item_eth_v2(struct copy_item_args *arg) /* outer header */ memcpy(gp->layer[FILTER_GENERIC_1_L2].mask, &enic_mask, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L2].val, &enic_spec, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); return 0; } @@ -705,8 +705,8 @@ enic_copy_item_vlan_v2(struct copy_item_args *arg) const struct rte_flow_item_vlan *spec = item->spec; const struct rte_flow_item_vlan *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; - struct ether_hdr *eth_mask; - struct ether_hdr *eth_val; + struct rte_ether_hdr *eth_mask; + struct rte_ether_hdr *eth_val; FLOW_TRACE(); @@ -932,11 +932,11 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) mask = &rte_flow_item_vxlan_mask; memcpy(gp->layer[FILTER_GENERIC_1_L5].mask, mask, - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L5].val, spec, - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); - *inner_ofst = sizeof(struct vxlan_hdr); + *inner_ofst = sizeof(struct rte_vxlan_hdr); return 0; } @@ -1035,7 +1035,7 @@ fixup_l5_layer(struct enic *enic, struct filter_generic_1 *gp, if (!(inner_ofst > 0 && enic->vxlan)) return; FLOW_TRACE(); - vxlan = sizeof(struct vxlan_hdr); + vxlan = sizeof(struct rte_vxlan_hdr); memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), gp->layer[FILTER_GENERIC_1_L5].mask, vxlan); memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index ea9eb2edf..6e8c5cf91 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1667,13 +1667,13 @@ static int enic_dev_init(struct enic *enic) enic_fdir_info(enic); eth_dev->data->mac_addrs = rte_zmalloc("enic_mac_addr", - sizeof(struct ether_addr) * + sizeof(struct rte_ether_addr) * ENIC_UNICAST_PERFECT_FILTERS, 0); if (!eth_dev->data->mac_addrs) { dev_err(enic, "mac addr storage alloc failed, aborting.\n"); return -1; } - ether_addr_copy((struct ether_addr *) enic->mac_addr, + ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, eth_dev->data->mac_addrs); vnic_dev_set_reset_flag(enic->vdev, 0); diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 42dfaca30..8f7d91169 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -166,7 +166,7 @@ static int fs_eth_dev_create(struct rte_vdev_device *vdev) { struct rte_eth_dev *dev; - struct ether_addr *mac; + struct rte_ether_addr *mac; struct fs_priv *priv; struct sub_device *sdev; const char *params; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 3351c5bca..5fc6be403 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -367,7 +367,7 @@ static int fs_get_mac_addr_arg(const char *key __rte_unused, const char *value, void *out) { - struct ether_addr *ea = out; + struct rte_ether_addr *ea = out; int ret; if ((value == NULL) || (out == NULL)) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 7ac23d49a..549ee6bb8 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -166,7 +166,7 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, DEBUG("Configure additional MAC address%s", (PRIV(dev)->nb_mac_addr > 2 ? "es" : "")); for (i = 1; i < PRIV(dev)->nb_mac_addr; i++) { - struct ether_addr *ea; + struct rte_ether_addr *ea; ea = &dev->data->mac_addrs[i]; ret = rte_eth_dev_mac_addr_add(PORT_ID(sdev), ea, diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 65957a2e5..ec40bbe86 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -1082,7 +1082,7 @@ fs_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) static int fs_mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { @@ -1111,7 +1111,7 @@ fs_mac_addr_add(struct rte_eth_dev *dev, } static int -fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +fs_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct sub_device *sdev; uint8_t i; @@ -1135,7 +1135,7 @@ fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) static int fs_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct sub_device *sdev; uint8_t i; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 4f58a5c91..231b89edd 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -152,10 +152,10 @@ struct fs_priv { TAILQ_HEAD(sub_flows, rte_flow) flow_list; /* current number of mac_addr slots allocated. */ uint32_t nb_mac_addr; - struct ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; + struct rte_ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; uint32_t mac_addr_pool[FAILSAFE_MAX_ETHADDR]; uint32_t nb_mcast_addr; - struct ether_addr *mcast_addrs; + struct rte_ether_addr *mcast_addrs; /* current capabilities */ struct rte_eth_dev_info infos; struct rte_eth_dev_owner my_owner; /* Unique owner. */ diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index caf4d1bc0..ac00828dd 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -614,7 +614,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); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); macvlan->nb_queue_pools = nb_queue_pools; @@ -1664,7 +1664,7 @@ static void fm10k_MAC_filter_set(struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int fm10k_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { @@ -3080,7 +3080,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_read_mac_addr(hw); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); if (diag != FM10K_SUCCESS || @@ -3089,7 +3089,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /* Generate a random addr */ eth_random_addr(hw->mac.addr); memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 5b01dc1f0..331519ff4 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -266,7 +266,7 @@ static int i40e_flow_ctrl_set(struct rte_eth_dev *dev, static int i40e_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf); static int i40e_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); @@ -380,7 +380,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); @@ -1467,8 +1467,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) goto err_get_mac_addr; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.addr, - (struct ether_addr *) hw->mac.perm_addr); + ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + (struct rte_ether_addr *) hw->mac.perm_addr); /* Disable flow control */ hw->fc.requested_mode = I40E_FC_NONE; @@ -1519,7 +1519,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) "Failed to allocated memory for storing mac address"); goto err_mac_alloc; } - ether_addr_copy((struct ether_addr *)hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, &dev->data->mac_addrs[0]); /* Init dcb to sw mode by default */ @@ -4001,7 +4001,7 @@ i40e_priority_flow_ctrl_set(__rte_unused struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int i40e_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t pool) { @@ -4052,7 +4052,7 @@ i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_vsi *vsi; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; int ret; uint32_t i; uint64_t pool_sel; @@ -4093,8 +4093,8 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, { struct i40e_hw *hw; struct i40e_mac_filter_info mac_filter; - struct ether_addr old_mac; - struct ether_addr *new_mac; + struct rte_ether_addr old_mac; + struct rte_ether_addr *new_mac; struct i40e_pf_vf *vf = NULL; uint16_t vf_id; int ret; @@ -4155,7 +4155,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, /* Clear device address as it has been removed */ if (is_same_ether_addr(&(pf->dev_addr), new_mac)) - memset(&pf->dev_addr, 0, sizeof(struct ether_addr)); + memset(&pf->dev_addr, 0, sizeof(struct rte_ether_addr)); } return 0; @@ -5332,7 +5332,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) ret = i40e_aq_remove_macvlan(hw, vsi->seid, &def_filter, 1, NULL); if (ret != I40E_SUCCESS) { struct i40e_mac_filter *f; - struct ether_addr *mac; + struct rte_ether_addr *mac; PMD_DRV_LOG(DEBUG, "Cannot remove the default macvlan filter"); @@ -5352,7 +5352,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) return ret; } rte_memcpy(&filter.mac_addr, - (struct ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); + (struct rte_ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; return i40e_vsi_add_mac(vsi, &filter); } @@ -5470,7 +5470,7 @@ i40e_vsi_setup(struct i40e_pf *pf, struct i40e_mac_filter_info filter; int ret; struct i40e_vsi_context ctxt; - struct ether_addr broadcast = + struct rte_ether_addr broadcast = {.addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; if (type != I40E_VSI_MAIN && type != I40E_VSI_SRIOV && @@ -6897,7 +6897,7 @@ i40e_remove_macvlan_filters(struct i40e_vsi *vsi, /* Find out specific MAC filter */ static struct i40e_mac_filter * i40e_find_mac_filter(struct i40e_vsi *vsi, - struct ether_addr *macaddr) + struct rte_ether_addr *macaddr) { struct i40e_mac_filter *f; @@ -6981,7 +6981,7 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, - int num, struct ether_addr *addr) + int num, struct rte_ether_addr *addr) { int i; uint32_t j, k; @@ -7275,7 +7275,7 @@ i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *mac_filter) } int -i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr) +i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr) { struct i40e_mac_filter *f; struct i40e_macvlan_filter *mv_f; @@ -7575,10 +7575,10 @@ i40e_tunnel_filter_convert( struct i40e_aqc_cloud_filters_element_bb *cld_filter, struct i40e_tunnel_filter *tunnel_filter) { - ether_addr_copy((struct ether_addr *)&cld_filter->element.outer_mac, - (struct ether_addr *)&tunnel_filter->input.outer_mac); - ether_addr_copy((struct ether_addr *)&cld_filter->element.inner_mac, - (struct ether_addr *)&tunnel_filter->input.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, + (struct rte_ether_addr *)&tunnel_filter->input.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, + (struct rte_ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->element.inner_vlan; if ((rte_le_to_cpu_16(cld_filter->element.flags) & I40E_AQC_ADD_CLOUD_FLAGS_IPV6) == @@ -7687,9 +7687,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, pfilter = cld_filter; ether_addr_copy(&tunnel_filter->outer_mac, - (struct ether_addr *)&pfilter->element.outer_mac); + (struct rte_ether_addr *)&pfilter->element.outer_mac); ether_addr_copy(&tunnel_filter->inner_mac, - (struct ether_addr *)&pfilter->element.inner_mac); + (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); @@ -8134,9 +8134,9 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, pfilter = cld_filter; ether_addr_copy(&tunnel_filter->outer_mac, - (struct ether_addr *)&pfilter->element.outer_mac); + (struct rte_ether_addr *)&pfilter->element.outer_mac); ether_addr_copy(&tunnel_filter->inner_mac, - (struct ether_addr *)&pfilter->element.inner_mac); + (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); @@ -11939,7 +11939,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, } static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -12072,10 +12072,10 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) vsi = vf->vsi; } memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct ether_addr *)&f->input.outer_mac, - (struct ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct ether_addr *)&f->input.inner_mac, - (struct ether_addr *)&cld_filter.element.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, + (struct rte_ether_addr *)&cld_filter.element.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, + (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = f->input.inner_vlan; cld_filter.element.flags = f->input.flags; cld_filter.element.tenant_id = f->input.tenant_id; diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 930eb9aba..0b8cb780d 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -278,7 +278,7 @@ struct i40e_adapter; */ struct i40e_mac_filter_info { enum rte_mac_filter_type filter_type; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; TAILQ_HEAD(i40e_mac_filter_list, i40e_mac_filter); @@ -331,7 +331,7 @@ struct i40e_veb { /* i40e MACVLAN filter structure */ struct i40e_macvlan_filter { - struct ether_addr macaddr; + struct rte_ether_addr macaddr; enum rte_mac_filter_type filter_type; uint16_t vlan_id; }; @@ -422,7 +422,7 @@ struct i40e_pf_vf { uint16_t vf_idx; /* VF index in pf->vfs */ uint16_t lan_nb_qps; /* Actual queues allocated */ uint16_t reset_cnt; /* Total vf reset times */ - struct ether_addr mac_addr; /* Default MAC address */ + struct rte_ether_addr mac_addr; /* Default MAC address */ /* version of the virtchnl from VF */ struct virtchnl_version_info version; uint32_t request_caps; /* offload caps requested from VF */ @@ -642,7 +642,7 @@ struct i40e_fdir_info { /* Ethertype filter struct */ struct i40e_ethertype_filter_input { - struct ether_addr mac_addr; /* Mac address to match */ + struct rte_ether_addr mac_addr; /* Mac address to match */ uint16_t ether_type; /* Ether type to match */ }; @@ -760,8 +760,8 @@ enum i40e_tunnel_type { * Tunneling Packet filter configuration. */ struct i40e_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ uint32_t outer_vlan; /**< Outer VLAN to match */ enum i40e_tunnel_iptype ip_type; /**< IP address type. */ @@ -920,7 +920,7 @@ struct i40e_pf { bool offset_loaded; struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ - struct ether_addr dev_addr; /* PF device mac address */ + struct rte_ether_addr dev_addr; /* PF device mac address */ uint64_t flags; /* PF feature flags */ /* All kinds of queue pair setting for different VSIs */ struct i40e_pf_vf *vfs; @@ -1024,7 +1024,7 @@ struct i40e_vf { uint16_t promisc_flags; /* Promiscuous setting */ uint32_t vlan[I40E_VFTA_SIZE]; /* VLAN bit map */ - struct ether_addr mc_addrs[I40E_NUM_MACADDR_MAX]; /* Multicast addrs */ + struct rte_ether_addr mc_addrs[I40E_NUM_MACADDR_MAX]; /* Multicast addrs */ uint16_t mc_addrs_num; /* Multicast mac addresses number */ /* Event from pf */ @@ -1132,7 +1132,7 @@ int i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on); int i40e_vsi_add_vlan(struct i40e_vsi *vsi, uint16_t vlan); int i40e_vsi_delete_vlan(struct i40e_vsi *vsi, uint16_t vlan); int i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *filter); -int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr); +int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr); void i40e_update_vsi_stats(struct i40e_vsi *vsi); void i40e_pf_disable_irq0(struct i40e_hw *hw); void i40e_pf_enable_irq0(struct i40e_hw *hw); @@ -1207,7 +1207,7 @@ int i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, int i40e_fdir_flush(struct rte_eth_dev *dev); int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, - int num, struct ether_addr *addr); + int num, struct rte_ether_addr *addr); int i40e_remove_macvlan_filters(struct i40e_vsi *vsi, struct i40e_macvlan_filter *filter, int total); diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index add7b2223..6fe062d16 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -106,7 +106,7 @@ static int i40evf_dev_tx_queue_start(struct rte_eth_dev *dev, static int i40evf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); static int i40evf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, uint32_t pool); static void i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index); @@ -123,7 +123,7 @@ static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int @@ -134,10 +134,10 @@ static void i40evf_handle_pf_event(struct rte_eth_dev *dev, static int i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr, bool add); static int -i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, +i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* Default hash key buffer for RSS */ @@ -776,7 +776,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev) static int i40evf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -818,7 +818,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev, static void i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct virtchnl_ether_addr_list *list; struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); @@ -859,7 +859,7 @@ static void i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) { struct rte_eth_dev_data *data = dev->data; - struct ether_addr *addr; + struct rte_ether_addr *addr; addr = &data->mac_addrs[index]; @@ -1273,7 +1273,7 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - if (is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; else eth_random_addr(hw->mac.addr); /* Generate a random one */ @@ -1511,7 +1511,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); return 0; @@ -1930,7 +1930,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) int next_begin = 0; int begin = 0; uint32_t len; - struct ether_addr *addr; + struct rte_ether_addr *addr; struct vf_cmd_info args; do { @@ -2702,7 +2702,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2715,18 +2715,18 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, if (vf->flags & I40E_FLAG_VF_MAC_BY_PF) return -EPERM; - i40evf_del_mac_addr_by_addr(dev, (struct ether_addr *)hw->mac.addr); + i40evf_del_mac_addr_by_addr(dev, (struct rte_ether_addr *)hw->mac.addr); if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0) return -EIO; - ether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } static int i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addrs, + struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num, bool add) { struct virtchnl_ether_addr_list *list; @@ -2780,7 +2780,7 @@ i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, } static int -i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addrs, +i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4b32fee1e..dd940cecb 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -685,7 +685,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, { static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; - uint8_t len = 2 * sizeof(struct ether_addr); + uint8_t len = 2 * sizeof(struct rte_ether_addr); struct ipv4_hdr *ip; struct ipv6_hdr *ip6; static const uint8_t next_proto[] = { @@ -701,7 +701,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, [RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), @@ -959,7 +959,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, struct i40e_customized_pctype *cus_pctype = NULL; static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; - uint8_t len = 2 * sizeof(struct ether_addr); + uint8_t len = 2 * sizeof(struct rte_ether_addr); struct ipv4_hdr *ip; struct ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; @@ -977,7 +977,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 3694df255..ae88ccd48 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -4803,10 +4803,10 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, int ret = 0; memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct ether_addr *)&filter->input.outer_mac, - (struct ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct ether_addr *)&filter->input.inner_mac, - (struct ether_addr *)&cld_filter.element.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, + (struct rte_ether_addr *)&cld_filter.element.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, + (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = filter->input.inner_vlan; cld_filter.element.flags = filter->input.flags; cld_filter.element.tenant_id = filter->input.tenant_id; diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 91be45027..4d7001df5 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -349,7 +349,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; ether_addr_copy(&vf->mac_addr, - (struct ether_addr *)vf_res->vsi_res[0].default_mac_addr); + (struct rte_ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_VF_RESOURCES, @@ -823,7 +823,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, (struct virtchnl_ether_addr_list *)msg; struct i40e_mac_filter_info filter; int i; - struct ether_addr *mac; + struct rte_ether_addr *mac; if (!b_op) { i40e_pf_host_send_msg_to_vf( @@ -842,7 +842,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 ether_addr *)(addr_list->list[i].addr); + mac = (struct rte_ether_addr *)(addr_list->list[i].addr); rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; if (is_zero_ether_addr(mac) || @@ -869,7 +869,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf, struct virtchnl_ether_addr_list *addr_list = (struct virtchnl_ether_addr_list *)msg; int i; - struct ether_addr *mac; + struct rte_ether_addr *mac; if (!b_op) { i40e_pf_host_send_msg_to_vf( @@ -886,7 +886,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf, } for (i = 0; i < addr_list->num_elements; i++) { - mac = (struct ether_addr *)(addr_list->list[i].addr); + mac = (struct rte_ether_addr *)(addr_list->list[i].addr); if(is_zero_ether_addr(mac) || i40e_vsi_delete_mac(vf->vsi, mac)) { ret = I40E_ERR_INVALID_MAC_ADDR; diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index 45a15d3ab..633dca6c3 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -324,7 +324,7 @@ i40e_vf_representor_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index) static int i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_vf_representor *representor = ethdev->data->dev_private; diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index 7ae78e426..e6f18ab28 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -529,7 +529,7 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on) int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_mac_filter *f; struct rte_eth_dev *dev; @@ -571,11 +571,11 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, return 0; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct i40e_pf_vf *vf; @@ -724,7 +724,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, struct i40e_vsi *vsi; struct i40e_hw *hw; struct i40e_mac_filter_info filter; - struct ether_addr broadcast = { + struct rte_ether_addr broadcast = { .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; int ret; @@ -2355,7 +2355,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct i40e_pf_vf *vf; @@ -2492,10 +2492,10 @@ rte_pmd_i40e_flow_type_mapping_update( } int -rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct ether_addr *vf_mac) +rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct rte_ether_addr *vf_mac) { struct rte_eth_dev *dev; - struct ether_addr *mac; + struct rte_ether_addr *mac; struct i40e_pf *pf; int vf_id; struct i40e_pf_vf *vf; diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h index be4a6024a..55e7fa9f9 100644 --- a/drivers/net/i40e/rte_pmd_i40e.h +++ b/drivers/net/i40e/rte_pmd_i40e.h @@ -453,7 +453,7 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Remove the VF MAC address. @@ -471,7 +471,7 @@ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, */ int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable vf vlan strip for all queues in a pool @@ -854,7 +854,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); #define RTE_PMD_I40E_PCTYPE_MAX 64 #define RTE_PMD_I40E_FLOW_TYPE_MAX 64 @@ -924,7 +924,7 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port); * -ENOTSUP: i40e not supported for this port. */ int rte_pmd_i40e_query_vfid_by_mac(uint16_t port, - const struct ether_addr *vf_mac); + const struct rte_ether_addr *vf_mac); /** * Do RSS queue region configuration for that port as diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index e6e3e8d30..e8f453bd8 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -211,6 +211,6 @@ int iavf_query_stats(struct iavf_adapter *adapter, int iavf_config_promisc(struct iavf_adapter *adapter, bool enable_unicast, bool enable_multicast); int iavf_add_del_eth_addr(struct iavf_adapter *adapter, - struct ether_addr *addr, bool add); + struct rte_ether_addr *addr, bool add); int iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add); #endif /* _IAVF_ETHDEV_H_ */ diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 846e604a6..7ecd86804 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -47,7 +47,7 @@ static void iavf_dev_promiscuous_disable(struct rte_eth_dev *dev); static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev); static void iavf_dev_allmulticast_disable(struct rte_eth_dev *dev); static int iavf_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, uint32_t pool); static void iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index); @@ -66,7 +66,7 @@ static int iavf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, @@ -687,7 +687,7 @@ iavf_dev_allmulticast_disable(struct rte_eth_dev *dev) } static int -iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr, +iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -718,7 +718,7 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct ether_addr *addr; + struct rte_ether_addr *addr; int err; addr = &dev->data->mac_addrs[index]; @@ -930,16 +930,16 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter); - struct ether_addr *perm_addr, *old_addr; + struct rte_ether_addr *perm_addr, *old_addr; int ret; - old_addr = (struct ether_addr *)hw->mac.addr; - perm_addr = (struct ether_addr *)hw->mac.perm_addr; + old_addr = (struct rte_ether_addr *)hw->mac.addr; + perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; if (is_same_ether_addr(mac_addr, old_addr)) return 0; @@ -973,7 +973,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, if (ret) return -EIO; - ether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } @@ -1244,9 +1244,9 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) /* If the MAC address is not configured by host, * generate a random one. */ - if (!is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) + if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) eth_random_addr(hw->mac.addr); - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* register callback func to eal lib */ diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 6381fb63c..0303e7809 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -636,7 +636,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) { struct virtchnl_ether_addr_list *list; struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct ether_addr *addr; + struct rte_ether_addr *addr; struct iavf_cmd_info args; int len, err, i, j; int next_begin = 0; @@ -753,7 +753,7 @@ iavf_config_promisc(struct iavf_adapter *adapter, } int -iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct ether_addr *addr, +iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr, bool add) { struct virtchnl_ether_addr_list *list; diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 9d0101870..092051a9c 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -54,9 +54,9 @@ static int ice_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int ice_macaddr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int ice_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t pool); static void ice_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); @@ -480,29 +480,29 @@ ice_init_mac_address(struct rte_eth_dev *dev) struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (!is_unicast_ether_addr - ((struct ether_addr *)hw->port_info[0].mac.lan_addr)) { + ((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr)) { PMD_INIT_LOG(ERR, "Invalid MAC address"); return -EINVAL; } - ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.lan_addr, - (struct ether_addr *)hw->port_info[0].mac.perm_addr); + ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, + (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); - dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct ether_addr), 0); + dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0); if (!dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to allocate memory to store mac address"); return -ENOMEM; } /* store it to dev data */ - ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, &dev->data->mac_addrs[0]); return 0; } /* Find out specific MAC filter */ static struct ice_mac_filter * -ice_find_mac_filter(struct ice_vsi *vsi, struct ether_addr *macaddr) +ice_find_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *macaddr) { struct ice_mac_filter *f; @@ -515,7 +515,7 @@ ice_find_mac_filter(struct ice_vsi *vsi, struct ether_addr *macaddr) } static int -ice_add_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) +ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) { struct ice_fltr_list_entry *m_list_itr = NULL; struct ice_mac_filter *f; @@ -574,7 +574,7 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) } static int -ice_remove_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) +ice_remove_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) { struct ice_fltr_list_entry *m_list_itr = NULL; struct ice_mac_filter *f; @@ -1123,9 +1123,9 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) struct ice_vsi *vsi = NULL; struct ice_vsi_ctx vsi_ctx; int ret; - struct ether_addr broadcast = { + struct rte_ether_addr broadcast = { .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; uint8_t tc_bitmap = 0x1; @@ -2234,7 +2234,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } static int ice_macaddr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -2281,7 +2281,7 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int ice_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -2305,7 +2305,7 @@ ice_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_vsi *vsi = pf->main_vsi; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; int ret; macaddr = &data->mac_addrs[index]; diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 9c29f225e..6fea15aa1 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -123,7 +123,7 @@ struct ice_adapter; * MAC filter structure */ struct ice_mac_filter_info { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; TAILQ_HEAD(ice_mac_filter_list, ice_mac_filter); @@ -240,7 +240,7 @@ struct ice_pf { struct ice_res_pool_info qp_pool; /*Queue pair pool */ struct ice_res_pool_info msix_pool; /* MSIX interrupt pool */ struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ - struct ether_addr dev_addr; /* PF device mac address */ + struct rte_ether_addr dev_addr; /* PF device mac address */ uint64_t flags; /* PF feature flags */ uint16_t hash_lut_size; /* The size of hash lookup table */ uint16_t lan_nb_qp_max; diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 975fa474c..a3b045e71 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -223,11 +223,11 @@ static void ixgbe_dev_interrupt_handler(void *param); static void ixgbe_dev_interrupt_delayed_handler(void *param); static void ixgbe_dev_setup_link_alarm_handler(void *param); -static int ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +static int ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index); static int ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config); static bool is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv); @@ -268,7 +268,7 @@ static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev); /* For Eth VMDQ APIs support */ static int ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct - ether_addr * mac_addr, uint8_t on); + rte_ether_addr * mac_addr, uint8_t on); static int ixgbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on); static int ixgbe_mirror_rule_set(struct rte_eth_dev *dev, struct rte_eth_mirror_conf *mirror_conf, @@ -284,11 +284,11 @@ static void ixgbe_set_ivar_map(struct ixgbe_hw *hw, int8_t direction, static void ixgbe_configure_msix(struct rte_eth_dev *dev); static int ixgbevf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); static int ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int ixgbe_syn_filter_get(struct rte_eth_dev *dev, struct rte_eth_syn_filter *filter); static int ixgbe_syn_filter_handle(struct rte_eth_dev *dev, @@ -315,7 +315,7 @@ static int ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu); static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); static int ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info); @@ -1222,7 +1222,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ @@ -1530,7 +1530,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw) } static void -generate_random_mac_addr(struct ether_addr *mac_addr) +generate_random_mac_addr(struct rte_ether_addr *mac_addr) { uint64_t random; @@ -1561,7 +1561,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) IXGBE_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private); struct ixgbe_hwstrip *hwstrip = IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private); - struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *) hw->mac.perm_addr; PMD_INIT_FUNC_TRACE(); @@ -4898,7 +4898,7 @@ ixgbe_dev_rss_reta_query(struct rte_eth_dev *dev, } static int -ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4917,7 +4917,7 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) } static int -ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -5367,7 +5367,7 @@ ixgbe_vt_check(struct ixgbe_hw *hw) } static uint32_t -ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr) +ixgbe_uta_vector(struct ixgbe_hw *hw, struct rte_ether_addr *uc_addr) { uint32_t vector = 0; @@ -5398,7 +5398,7 @@ ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr) } static int -ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint8_t on) { uint32_t vector; @@ -6030,7 +6030,7 @@ ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev, } static int -ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __attribute__((unused)) uint32_t index, __attribute__((unused)) uint32_t pool) { @@ -6042,7 +6042,7 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * operation. Trap this case to avoid exhausting the [very limited] * set of PF resources used to store VF MAC addresses. */ - if (memcmp(hw->mac.perm_addr, mac_addr, sizeof(struct ether_addr)) == 0) + if (memcmp(hw->mac.perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) return -1; diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes); if (diag != 0) @@ -6062,8 +6062,8 @@ static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr; - struct ether_addr *mac_addr; + struct rte_ether_addr *perm_addr = (struct rte_ether_addr *) hw->mac.perm_addr; + struct rte_ether_addr *mac_addr; uint32_t i; int diag; @@ -6088,7 +6088,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) if (is_zero_ether_addr(mac_addr)) continue; /* Skip the permanent MAC address */ - if (memcmp(perm_addr, mac_addr, sizeof(struct ether_addr)) == 0) + if (memcmp(perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) continue; diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes); if (diag != 0) @@ -6107,7 +6107,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } static int -ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -6836,13 +6836,13 @@ ixgbe_dev_addr_list_itr(__attribute__((unused)) struct ixgbe_hw *hw, *vmdq = 0; mc_addr = *mc_addr_ptr; - *mc_addr_ptr = (mc_addr + sizeof(struct ether_addr)); + *mc_addr_ptr = (mc_addr + sizeof(struct rte_ether_addr)); return mc_addr; } static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct ixgbe_hw *hw; diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index fafff6b03..6180c9473 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -463,7 +463,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) { + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c index 5d2e3e023..2c01f6e33 100644 --- a/drivers/net/ixgbe/ixgbe_vf_representor.c +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c @@ -25,7 +25,7 @@ ixgbe_vf_representor_link_update(struct rte_eth_dev *ethdev, static int ixgbe_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ixgbe_vf_representor *representor = ethdev->data->dev_private; @@ -211,7 +211,7 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) vf_data = *IXGBE_DEV_PRIVATE_TO_P_VFDATA( representor->pf_ethdev->data->dev_private); - ethdev->data->mac_addrs = (struct ether_addr *) + ethdev->data->mac_addrs = (struct rte_ether_addr *) vf_data[representor->vf_id].vf_mac_addresses; /* Link state. Inherited from PF */ diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 3a874f9a9..3defba175 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -11,7 +11,7 @@ int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ixgbe_hw *hw; struct ixgbe_vf_info *vfinfo; @@ -35,7 +35,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); rar_entry = hw->mac.num_rar_entries - (vf + 1); - if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) { + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, ETHER_ADDR_LEN); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h index 72a941f9d..84c688472 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h @@ -42,7 +42,7 @@ int rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf); * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable VF VLAN anti spoofing. diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 89f44737c..a88469223 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -54,7 +54,7 @@ struct pmd_internals { int stop_thread; int no_request_thread; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct pmd_queue rx_queues[KNI_MAX_QUEUE_PER_PORT]; struct pmd_queue tx_queues[KNI_MAX_QUEUE_PER_PORT]; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index c9cabd65a..925581a78 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1835,7 +1835,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) 2 + i)); /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)mac, ð_dev->data->mac_addrs[0]); + ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); /* enable firmware checksum support for tunnel packets */ lio_enable_hw_tunnel_rx_checksum(eth_dev); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 252658fc6..01678df2d 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -972,7 +972,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) struct ibv_pd *pd = NULL; struct mlx4_priv *priv = NULL; struct rte_eth_dev *eth_dev = NULL; - struct ether_addr mac; + struct rte_ether_addr mac; char name[RTE_ETH_NAME_MAX_LEN]; /* If port is not enabled, skip. */ diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index 1db23d6cc..13e1b31e2 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -189,7 +189,7 @@ struct mlx4_priv { } mr; LIST_HEAD(, mlx4_rss) rss; /**< Shared targets for Rx flow rules. */ LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */ - struct ether_addr mac[MLX4_MAX_MAC_ADDRESSES]; + struct rte_ether_addr mac[MLX4_MAX_MAC_ADDRESSES]; /**< Configured MAC addresses. Unused entries are zeroed. */ struct mlx4_verbs_alloc_ctx verbs_alloc_ctx; /**< Context for Verbs allocator. */ @@ -211,9 +211,9 @@ void mlx4_promiscuous_disable(struct rte_eth_dev *dev); void mlx4_allmulticast_enable(struct rte_eth_dev *dev); void mlx4_allmulticast_disable(struct rte_eth_dev *dev); void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); -int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); -int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); +int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); void mlx4_stats_reset(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 4dae67a1b..20715390e 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -463,7 +463,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { struct mlx4_priv *priv = dev->data->dev_private; @@ -541,7 +541,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { return mlx4_mac_addr_add(dev, mac_addr, 0, 0); } diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 038dc71d3..ea2709b29 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -1355,7 +1355,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) .type = RTE_FLOW_ACTION_TYPE_END, }, }; - struct ether_addr *rule_mac = ð_spec.dst; + struct rte_ether_addr *rule_mac = ð_spec.dst; rte_be16_t *rule_vlan = (ETH_DEV(priv)->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_VLAN_FILTER) && @@ -1392,7 +1392,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) } } for (i = 0; i != RTE_DIM(priv->mac) + 1; ++i) { - const struct ether_addr *mac; + const struct rte_ether_addr *mac; /* Broadcasts are handled by an extra iteration. */ if (i < RTE_DIM(priv->mac)) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index f571ba2e9..194c87aae 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1143,7 +1143,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, unsigned int mprq_max_stride_size_n = 0; unsigned int mprq_min_stride_num_n = 0; unsigned int mprq_max_stride_num_n = 0; - struct ether_addr mac; + struct rte_ether_addr mac; char name[RTE_ETH_NAME_MAX_LEN]; int own_domain_id = 0; uint16_t port_id; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index ef05d9f97..d9d3179df 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -289,7 +289,7 @@ struct mlx5_priv { struct rte_eth_dev_data *dev_data; /* Pointer to device data. */ struct mlx5_ibv_shared *sh; /* Shared IB device context. */ uint32_t ibv_port; /* IB device port number. */ - struct ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */ + struct rte_ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */ BITFIELD_DECLARE(mac_own, uint64_t, MLX5_MAX_MAC_ADDRESSES); /* Bit-field of MAC addresses owned by the PMD. */ uint16_t vlan_filter[MLX5_MAX_VLAN_IDS]; /* VLAN filters table. */ @@ -403,11 +403,11 @@ bool mlx5_translate_port_name(const char *port_name_in, int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[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 ether_addr *mac, +int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq); -int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); +int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr); + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* mlx5_rss.c */ @@ -510,9 +510,9 @@ void mlx5_mp_uninit_secondary(void); /* mlx5_nl.c */ int mlx5_nl_init(int protocol); -int mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +int mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); -int mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +int mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev); void mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 52be8b32c..fbcb2880b 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1050,13 +1050,13 @@ static int flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, size_t *size, struct rte_flow_error *error) { - struct ether_hdr *eth = NULL; - struct vlan_hdr *vlan = NULL; + struct rte_ether_hdr *eth = NULL; + struct rte_vlan_hdr *vlan = NULL; struct ipv4_hdr *ipv4 = NULL; struct ipv6_hdr *ipv6 = NULL; struct udp_hdr *udp = NULL; - struct vxlan_hdr *vxlan = NULL; - struct vxlan_gpe_hdr *vxlan_gpe = NULL; + struct rte_vxlan_hdr *vxlan = NULL; + struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; struct gre_hdr *gre = NULL; size_t len; size_t temp_size = 0; @@ -1076,10 +1076,10 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, rte_memcpy((void *)&buf[temp_size], items->spec, len); switch (items->type) { case RTE_FLOW_ITEM_TYPE_ETH: - eth = (struct ether_hdr *)&buf[temp_size]; + eth = (struct rte_ether_hdr *)&buf[temp_size]; break; case RTE_FLOW_ITEM_TYPE_VLAN: - vlan = (struct vlan_hdr *)&buf[temp_size]; + vlan = (struct rte_vlan_hdr *)&buf[temp_size]; if (!eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1137,7 +1137,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv6->proto = IPPROTO_UDP; break; case RTE_FLOW_ITEM_TYPE_VXLAN: - vxlan = (struct vxlan_hdr *)&buf[temp_size]; + vxlan = (struct rte_vxlan_hdr *)&buf[temp_size]; if (!udp) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1150,7 +1150,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, RTE_BE32(MLX5_ENCAP_VXLAN_FLAGS); break; case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: - vxlan_gpe = (struct vxlan_gpe_hdr *)&buf[temp_size]; + vxlan_gpe = (struct rte_vxlan_gpe_hdr *)&buf[temp_size]; if (!udp) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 3006f8386..90f586675 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -402,7 +402,7 @@ struct mlx5_flow_tcf_context { struct tcf_neigh_rule { LIST_ENTRY(tcf_neigh_rule) next; uint32_t refcnt; - struct ether_addr eth; + struct rte_ether_addr eth; uint16_t mask; union { struct { @@ -475,8 +475,8 @@ struct flow_tcf_vxlan_encap { uint8_t ip_tos; uint8_t ip_ttl_hop; struct { - struct ether_addr dst; - struct ether_addr src; + struct rte_ether_addr dst; + struct rte_ether_addr src; } eth; union { struct { @@ -689,8 +689,8 @@ flow_tcf_pedit_key_set_mac(const struct rte_flow_action *actions, { int idx = p_parser->sel.nkeys; uint32_t off = actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_SRC ? - offsetof(struct ether_hdr, s_addr) : - offsetof(struct ether_hdr, d_addr); + offsetof(struct rte_ether_hdr, s_addr) : + offsetof(struct rte_ether_hdr, d_addr); const struct rte_flow_action_set_mac *conf = (const struct rte_flow_action_set_mac *)actions->conf; diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index bce026f98..9f6b89a82 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -76,7 +76,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], index); - memset(&dev->data->mac_addrs[index], 0, sizeof(struct ether_addr)); + memset(&dev->data->mac_addrs[index], 0, sizeof(struct rte_ether_addr)); } /** @@ -93,7 +93,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -166,7 +166,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq __rte_unused) { int ret; @@ -195,7 +195,7 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { DRV_LOG(DEBUG, "port %u setting primary MAC address", dev->data->port_id); @@ -209,7 +209,7 @@ mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) */ int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { uint32_t i; int ret; diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index fd9226bdd..e0de54489 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -80,7 +80,7 @@ /* Add/remove MAC address through Netlink */ struct mlx5_nl_mac_addr { - struct ether_addr (*mac)[]; + struct rte_ether_addr (*mac)[]; /**< MAC address handled by the device. */ int mac_n; /**< Number of addresses in the array. */ }; @@ -365,7 +365,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], +mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr (*mac)[], int *mac_n) { struct mlx5_priv *priv = dev->data->dev_private; @@ -424,7 +424,7 @@ mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, int add) { struct mlx5_priv *priv = dev->data->dev_private; @@ -496,7 +496,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -524,7 +524,7 @@ mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -542,7 +542,7 @@ mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) { - struct ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; + struct rte_ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; int macs_n = 0; int i; int ret; @@ -583,7 +583,7 @@ mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev) int i; for (i = MLX5_MAX_MAC_ADDRESSES - 1; i >= 0; --i) { - struct ether_addr *m = &dev->data->mac_addrs[i]; + struct rte_ether_addr *m = &dev->data->mac_addrs[i]; if (BITFIELD_ISSET(priv->mac_own, i)) mlx5_nl_mac_addr_remove(dev, m, i); diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index ced994588..9aadacafc 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -780,7 +780,7 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, * in if any of SWP offsets is set. Therefore, all of the L3 offsets * should be set regardless of HW offload. */ - off = buf->outer_l2_len + (vlan ? sizeof(struct vlan_hdr) : 0); + off = buf->outer_l2_len + (vlan ? sizeof(struct rte_vlan_hdr) : 0); offsets[1] = off >> 1; /* Outer L3 offset. */ off += buf->outer_l3_len; if (tunnel == PKT_TX_TUNNEL_UDP) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index 5b73f0ff0..d8a6b50b0 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -274,7 +274,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", }; const unsigned int vlan_filter_n = priv->vlan_filter_n; - const struct ether_addr cmp = { + const struct rte_ether_addr cmp = { .addr_bytes = "\x00\x00\x00\x00\x00\x00", }; unsigned int i; @@ -337,7 +337,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) } /* Add MAC address flows. */ for (i = 0; i != MLX5_MAX_MAC_ADDRESSES; ++i) { - struct ether_addr *mac = &dev->data->mac_addrs[i]; + struct rte_ether_addr *mac = &dev->data->mac_addrs[i]; if (!memcmp(mac, &cmp, sizeof(*mac))) continue; diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 8923a1634..d539ba6a1 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -617,7 +617,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative error value otherwise. */ static int -mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +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; @@ -650,7 +650,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * MAC address to register. */ static int -mvneta_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mvneta_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct mvneta_priv *priv = dev->data->dev_private; int ret; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index ce52f0901..8647c9b0d 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1102,7 +1102,7 @@ mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative error value otherwise. */ static int -mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +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; @@ -1154,7 +1154,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * 0 on success, negative error value otherwise. */ static int -mrvl_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mrvl_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct mrvl_priv *priv = dev->data->dev_private; int ret; diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index ffd1dab9b..738986575 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -989,7 +989,7 @@ mrvl_parse_eth(const struct rte_flow_item *item, struct rte_flow *flow, struct rte_flow_error *error) { const struct rte_flow_item_eth *spec = NULL, *mask = NULL; - struct ether_addr zero; + struct rte_ether_addr zero; int ret; ret = mrvl_parse_init(item, (const void **)&spec, (const void **)&mask, diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 407ee4849..dadff166e 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -289,7 +289,7 @@ hn_dev_allmulticast_disable(struct rte_eth_dev *dev) static int hn_dev_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { /* No filtering on the synthetic path, but can do it on VF */ diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index c67e9ae25..cfb502523 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -108,7 +108,7 @@ static void hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) { uint32_t s = m->pkt_len; - const struct ether_addr *ea; + const struct rte_ether_addr *ea; if (s == 64) { stats->size_bins[1]++; @@ -127,7 +127,7 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) stats->size_bins[7]++; } - ea = rte_pktmbuf_mtod(m, const struct ether_addr *); + ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) stats->broadcast++; diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index 8383f3246..6d0a4eeb8 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -131,7 +131,7 @@ struct hn_data { rte_atomic32_t rndis_req_id; uint8_t rndis_resp[256]; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_dev_owner owner; struct rte_intr_handle vf_intr; @@ -212,7 +212,7 @@ void hn_vf_allmulticast_disable(struct rte_eth_dev *dev); void hn_vf_promiscuous_enable(struct rte_eth_dev *dev); void hn_vf_promiscuous_disable(struct rte_eth_dev *dev); int hn_vf_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); int hn_vf_link_update(struct rte_eth_dev *dev, diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index 883272ff4..6a851a8ff 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -32,12 +32,12 @@ /* Search for VF with matching MAC address, return port id */ static int hn_vf_match(const struct rte_eth_dev *dev) { - const struct ether_addr *mac = dev->data->mac_addrs; + const struct rte_ether_addr *mac = dev->data->mac_addrs; int i; RTE_ETH_FOREACH_DEV(i) { const struct rte_eth_dev *vf_dev = &rte_eth_devices[i]; - const struct ether_addr *vf_mac = vf_dev->data->mac_addrs; + const struct rte_ether_addr *vf_mac = vf_dev->data->mac_addrs; if (vf_dev == dev) continue; @@ -391,7 +391,7 @@ void hn_vf_promiscuous_disable(struct rte_eth_dev *dev) } int hn_vf_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct hn_data *hv = dev->data->dev_private; diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 3e6178c7b..c1b42e504 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -119,7 +119,7 @@ static int nfp_net_rss_reta_write(struct rte_eth_dev *dev, static int nfp_net_rss_hash_write(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int nfp_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE(_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) @@ -553,7 +553,7 @@ nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) } int -nfp_set_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct nfp_net_hw *hw; uint32_t update, ctrl; @@ -2962,7 +2962,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_vf_read_mac(hw); } - if (!is_valid_assigned_ether_addr((struct ether_addr *)&hw->mac_addr)) { + if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { PMD_INIT_LOG(INFO, "Using random mac address for port %d", port); /* Using random mac addresses for VFs */ @@ -2971,7 +2971,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) } /* Copying mac address to DPDK eth_dev struct */ - ether_addr_copy((struct ether_addr *)hw->mac_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 159c1c1fd..7683511cf 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -73,7 +73,7 @@ struct pmd_internals { struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT]; struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT]; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; /** Bit mask of RSS offloads, the bit offset also means flow type */ uint64_t flow_type_rss_offloads; @@ -467,7 +467,7 @@ eth_rss_hash_conf_get(struct rte_eth_dev *dev, static int eth_mac_address_set(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct ether_addr *addr) + __rte_unused struct rte_ether_addr *addr) { return 0; } diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 046e12986..643479254 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -555,7 +555,7 @@ octeontx_dev_stats_reset(struct rte_eth_dev *dev) static int octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct octeontx_nic *nic = octeontx_pmd_priv(dev); int ret; diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 353538f16..7655b3a7a 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -78,7 +78,7 @@ struct pmd_internals { struct pcap_rx_queue rx_queue[RTE_PMD_PCAP_MAX_QUEUES]; struct pcap_tx_queue tx_queue[RTE_PMD_PCAP_MAX_QUEUES]; char devargs[ETH_PCAP_ARG_MAXLEN]; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; int if_index; int single_iface; int phy_mac; @@ -953,7 +953,7 @@ pmd_init_internals(struct rte_vdev_device *vdev, * derived from: 'locally administered':'p':'c':'a':'p':'iface_idx' * where the middle 4 characters are converted to hex. */ - (*internals)->eth_addr = (struct ether_addr) { + (*internals)->eth_addr = (struct rte_ether_addr) { .addr_bytes = { 0x02, 0x70, 0x63, 0x61, 0x70, iface_idx++ } }; (*internals)->phy_mac = 0; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index b2fd2fd90..205740016 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -559,9 +559,9 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); struct qede_ucast_entry *tmp = NULL; struct qede_ucast_entry *u; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; - mac_addr = (struct ether_addr *)ucast->mac; + mac_addr = (struct rte_ether_addr *)ucast->mac; if (add) { SLIST_FOREACH(tmp, &qdev->uc_list_head, list) { if ((memcmp(mac_addr, &tmp->mac, @@ -605,7 +605,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } static int -qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, +qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); @@ -629,7 +629,7 @@ qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, mcast.num_mc_addrs = mc_addrs_num; mcast.opcode = ECORE_FILTER_ADD; for (i = 0; i < mc_addrs_num; i++) - ether_addr_copy(&mc_addrs[i], (struct ether_addr *) + ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) &mcast.mac[i]); rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { @@ -654,7 +654,7 @@ static int qede_del_mcast_filters(struct rte_eth_dev *eth_dev) mcast.opcode = ECORE_FILTER_REMOVE; j = 0; SLIST_FOREACH(tmp, &qdev->mc_list_head, list) { - ether_addr_copy(&tmp->mac, (struct ether_addr *)&mcast.mac[j]); + ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); j++; } rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); @@ -701,7 +701,7 @@ qede_mac_int_ops(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } static int -qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, +qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct ecore_filter_ucast ucast; @@ -713,7 +713,7 @@ qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, qede_set_ucast_cmn_params(&ucast); ucast.opcode = ECORE_FILTER_ADD; ucast.type = ECORE_FILTER_MAC; - ether_addr_copy(mac_addr, (struct ether_addr *)&ucast.mac); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); re = (int)qede_mac_int_ops(eth_dev, &ucast, 1); return re; } @@ -742,13 +742,13 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) /* Use the index maintained by rte */ ether_addr_copy(ð_dev->data->mac_addrs[index], - (struct ether_addr *)&ucast.mac); + (struct rte_ether_addr *)&ucast.mac); qede_mac_int_ops(eth_dev, &ucast, false); } static int -qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr) +qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); @@ -1757,7 +1757,7 @@ static void qede_allmulticast_disable(struct rte_eth_dev *eth_dev) } static int -qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, +qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); @@ -2549,7 +2549,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) } if (!is_vf) { - ether_addr_copy((struct ether_addr *)edev->hwfns[0]. + ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. hw_info.hw_mac_addr, ð_dev->data->mac_addrs[0]); ether_addr_copy(ð_dev->data->mac_addrs[0], @@ -2565,7 +2565,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) &is_mac_forced); if (is_mac_exist) { DP_INFO(edev, "VF macaddr received from PF\n"); - ether_addr_copy((struct ether_addr *)&vf_mac, + ether_addr_copy((struct rte_ether_addr *)&vf_mac, ð_dev->data->mac_addrs[0]); ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index c06274d94..d0e7c70be 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -140,12 +140,12 @@ struct qede_vlan_entry { }; struct qede_mcast_entry { - struct ether_addr mac; + struct rte_ether_addr mac; SLIST_ENTRY(qede_mcast_entry) list; }; struct qede_ucast_entry { - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t vlan; uint16_t vni; SLIST_ENTRY(qede_ucast_entry) list; @@ -228,7 +228,7 @@ struct qede_dev { SLIST_HEAD(vlan_list_head, qede_vlan_entry)vlan_list_head; uint16_t configured_vlans; bool accept_any_vlan; - struct ether_addr primary_mac; + struct rte_ether_addr primary_mac; SLIST_HEAD(mc_list_head, qede_mcast_entry) mc_list_head; uint16_t num_mc_addr; SLIST_HEAD(uc_list_head, qede_ucast_entry) uc_list_head; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 5e6571ca6..27fbe538a 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -465,8 +465,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; - len = 2 * sizeof(struct ether_addr); - raw_pkt += 2 * sizeof(struct ether_addr); + len = 2 * sizeof(struct rte_ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); ether_type = (uint16_t *)raw_pkt; raw_pkt += sizeof(uint16_t); len += sizeof(uint16_t); diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h index ee5e54c19..b840c743c 100644 --- a/drivers/net/qede/qede_if.h +++ b/drivers/net/qede/qede_if.h @@ -59,7 +59,7 @@ struct qed_dev_eth_info { uint8_t num_queues; uint8_t num_tc; - struct ether_addr port_mac; + struct rte_ether_addr port_mac; uint16_t num_vlan_filters; uint32_t num_mac_filters; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 27bac0995..0e8a3675b 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -950,23 +950,23 @@ static inline uint8_t qede_check_notunn_csum_l4(uint16_t flag) static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - struct vlan_hdr *vlan_hdr; + struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; uint16_t len; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); - len = sizeof(struct ether_hdr); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); + len = sizeof(struct rte_ether_hdr); ethertype = rte_cpu_to_be_16(eth_hdr->ether_type); /* Note: Valid only if VLAN stripping is disabled */ if (ethertype == ETHER_TYPE_VLAN) { vlan_tagged = 1; - vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - len += sizeof(struct vlan_hdr); + 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); } @@ -1153,7 +1153,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; calc_csum = rte_ipv4_cksum(ip); diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 115a882b5..49419b26b 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -51,7 +51,7 @@ struct pmd_internals { struct ring_queue rx_ring_queues[RTE_PMD_RING_MAX_RX_RINGS]; struct ring_queue tx_ring_queues[RTE_PMD_RING_MAX_TX_RINGS]; - struct ether_addr address; + struct rte_ether_addr address; enum dev_action action; }; @@ -215,7 +215,7 @@ eth_mac_addr_remove(struct rte_eth_dev *dev __rte_unused, static int eth_mac_addr_add(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mac_addr __rte_unused, + struct rte_ether_addr *mac_addr __rte_unused, uint32_t index __rte_unused, uint32_t vmdq __rte_unused) { diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index ecd20e546..dde25c553 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -134,7 +134,7 @@ struct sfc_port { boolean_t promisc; boolean_t allmulti; - struct ether_addr default_mac_addr; + struct rte_ether_addr default_mac_addr; unsigned int max_mcast_addrs; unsigned int nb_mcast_addrs; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 6c33601e7..2a5fb22e3 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -931,12 +931,12 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) return -rc; } static int -sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); struct sfc_port *port = &sa->port; - struct ether_addr *old_addr = &dev->data->mac_addrs[0]; + struct rte_ether_addr *old_addr = &dev->data->mac_addrs[0]; int rc = 0; sfc_adapter_lock(sa); @@ -1015,7 +1015,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) static int -sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, +sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); @@ -2015,7 +2015,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) struct sfc_adapter *sa; int rc; const efx_nic_cfg_t *encp; - const struct ether_addr *from; + const struct rte_ether_addr *from; sfc_register_dp(); @@ -2087,7 +2087,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) * The arguments are really reverse order in comparison to * Linux kernel. Copy from NIC config to Ethernet device data. */ - from = (const struct ether_addr *)(encp->enc_mac_addr); + from = (const struct rte_ether_addr *)(encp->enc_mac_addr); ether_addr_copy(from, &dev->data->mac_addrs[0]); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 1709dba4e..8de5f0c60 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -227,7 +227,7 @@ sfc_port_start(struct sfc_adapter *sa) goto fail_mac_pdu_set; if (!sfc_sa2shared(sa)->isolated) { - struct ether_addr *addr = &port->default_mac_addr; + struct rte_ether_addr *addr = &port->default_mac_addr; sfc_log_init(sa, "set MAC address"); rc = efx_mac_addr_set(sa->nic, addr->addr_bytes); @@ -386,7 +386,7 @@ sfc_port_attach(struct sfc_adapter *sa) { struct sfc_port *port = &sa->port; const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); - const struct ether_addr *from; + const struct rte_ether_addr *from; uint32_t mac_nstats; size_t mac_stats_size; long kvarg_stats_update_period_ms; @@ -401,7 +401,7 @@ sfc_port_attach(struct sfc_adapter *sa) port->flow_ctrl_autoneg = B_TRUE; RTE_BUILD_BUG_ON(sizeof(encp->enc_mac_addr) != sizeof(*from)); - from = (const struct ether_addr *)(encp->enc_mac_addr); + from = (const struct rte_ether_addr *)(encp->enc_mac_addr); ether_addr_copy(from, &port->default_mac_addr); port->max_mcast_addrs = EFX_MAC_MULTICAST_LIST_MAX; diff --git a/drivers/net/softnic/parser.c b/drivers/net/softnic/parser.c index a8688a21e..7ea6eb4fa 100644 --- a/drivers/net/softnic/parser.c +++ b/drivers/net/softnic/parser.c @@ -528,13 +528,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -568,7 +568,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -596,15 +596,15 @@ softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -softnic_parse_mac_addr(const char *token, struct ether_addr *addr) +softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; } diff --git a/drivers/net/softnic/parser.h b/drivers/net/softnic/parser.h index 1ee3f82a7..6f408b248 100644 --- a/drivers/net/softnic/parser.h +++ b/drivers/net/softnic/parser.h @@ -49,7 +49,7 @@ int softnic_parse_hex_string(char *src, uint8_t *dst, uint32_t *size); int softnic_parse_ipv4_addr(const char *token, struct in_addr *ipv4); int softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6); -int softnic_parse_mac_addr(const char *token, struct ether_addr *addr); +int softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr); int softnic_parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 32b001fd3..4bda2f2b0 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -339,7 +339,7 @@ pmd_free(struct pmd_internals *p) rte_free(p); } -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = {0}, }; diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 88448eff6..43a66432a 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -105,7 +105,7 @@ struct szedata2_tx_queue { int szedata2_logtype_init; int szedata2_logtype_driver; -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 } }; @@ -1332,7 +1332,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, static int eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mac_addr __rte_unused) + struct rte_ether_addr *mac_addr __rte_unused) { return 0; } @@ -1514,7 +1514,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi) eth_link_update(dev, 0); /* Allocate space for one mac address */ - data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr), + data->mac_addrs = rte_zmalloc(data->name, sizeof(struct rte_ether_addr), RTE_CACHE_LINE_SIZE); if (data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Could not alloc space for MAC address!"); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index e9fda8cf6..3206c533f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -261,7 +261,7 @@ tap_verify_csum(struct rte_mbuf *mbuf) uint32_t l2 = mbuf->packet_type & RTE_PTYPE_L2_MASK; uint32_t l3 = mbuf->packet_type & RTE_PTYPE_L3_MASK; uint32_t l4 = mbuf->packet_type & RTE_PTYPE_L4_MASK; - unsigned int l2_len = sizeof(struct ether_hdr); + unsigned int l2_len = sizeof(struct rte_ether_hdr); unsigned int l3_len; uint16_t cksum = 0; void *l3_hdr; @@ -1150,7 +1150,7 @@ tap_allmulti_disable(struct rte_eth_dev *dev) } static int -tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct pmd_internals *pmd = dev->data->dev_private; enum ioctl_mode mode = LOCAL_ONLY; @@ -1172,14 +1172,14 @@ tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY); if (ret < 0) return ret; - if (is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) return 0; /* Check the current MAC address on the remote */ ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY); if (ret < 0) return ret; - if (!is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (!is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; @@ -1458,7 +1458,7 @@ tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int tap_set_mc_addr_list(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mc_addr_set __rte_unused, + struct rte_ether_addr *mc_addr_set __rte_unused, uint32_t nb_mc_addr __rte_unused) { /* @@ -1682,7 +1682,7 @@ static const char *tuntap_types[ETH_TUNTAP_TYPE_MAX] = { static int eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, - char *remote_iface, struct ether_addr *mac_addr, + char *remote_iface, struct rte_ether_addr *mac_addr, enum rte_tuntap_type type) { int numa_node = rte_socket_id(); @@ -1957,7 +1957,7 @@ set_remote_iface(const char *key __rte_unused, return 0; } -static int parse_user_mac(struct ether_addr *user_mac, +static int parse_user_mac(struct rte_ether_addr *user_mac, const char *value) { unsigned int index = 0; @@ -1985,7 +1985,7 @@ set_mac_type(const char *key __rte_unused, const char *value, void *extra_args) { - struct ether_addr *user_mac = extra_args; + struct rte_ether_addr *user_mac = extra_args; if (!value) return 0; @@ -2188,7 +2188,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) int speed; char tap_name[RTE_ETH_NAME_MAX_LEN]; char remote_iface[RTE_ETH_NAME_MAX_LEN]; - struct ether_addr user_mac = { .addr_bytes = {0} }; + struct rte_ether_addr user_mac = { .addr_bytes = {0} }; struct rte_eth_dev *eth_dev; int tap_devices_count_increased = 0; diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h index dc3579ac0..529b0aeca 100644 --- a/drivers/net/tap/rte_eth_tap.h +++ b/drivers/net/tap/rte_eth_tap.h @@ -70,7 +70,7 @@ struct pmd_internals { char remote_iface[RTE_ETH_NAME_MAX_LEN]; /* Remote netdevice name */ char name[RTE_ETH_NAME_MAX_LEN]; /* Internal Tap device name */ int type; /* Type field - TUN|TAP */ - struct ether_addr eth_addr; /* Mac address of the device port */ + struct rte_ether_addr eth_addr; /* Mac address of the device port */ struct ifreq remote_initial_flags; /* Remote netdevice flags on init */ int remote_if_index; /* remote netdevice IF_INDEX */ int if_index; /* IF_INDEX for the port */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index 532e8838f..2b1dba15b 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -37,7 +37,7 @@ #define KEY_IDX 0 #define BPF_MAP_ID_KEY 1 -struct vlan_hdr { +struct rte_vlan_hdr { __be16 proto; __be16 tci; }; @@ -141,12 +141,12 @@ rss_l3_l4(struct __sk_buff *skb) /* Get correct proto for 802.1ad */ if (skb->vlan_present && skb->vlan_proto == htons(ETH_P_8021AD)) { - if (data + ETH_ALEN * 2 + sizeof(struct vlan_hdr) + + if (data + ETH_ALEN * 2 + sizeof(struct rte_vlan_hdr) + sizeof(proto) > data_end) return TC_ACT_OK; proto = *(__u16 *)(data + ETH_ALEN * 2 + - sizeof(struct vlan_hdr)); - off += sizeof(struct vlan_hdr); + sizeof(struct rte_vlan_hdr)); + off += sizeof(struct rte_vlan_hdr); } if (proto == htons(ETH_P_IP)) { diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c index 8f83d41dd..2a793a4b1 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.c +++ b/drivers/net/thunderx/base/nicvf_mbox.c @@ -135,8 +135,8 @@ nicvf_handle_mbx_intr(struct nicvf *nic) nic->node = mbx.nic_cfg.node_id; nic->sqs_mode = mbx.nic_cfg.sqs_mode; nic->loopback_supported = mbx.nic_cfg.loopback_supported; - ether_addr_copy((struct ether_addr *)mbx.nic_cfg.mac_addr, - (struct ether_addr *)nic->mac_addr); + ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, + (struct rte_ether_addr *)nic->mac_addr); nic->pf_acked = true; break; case NIC_MBOX_MSG_ACK: diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 879d88998..ec2087924 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2179,10 +2179,10 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) ret = -ENOMEM; goto alarm_fail; } - if (is_zero_ether_addr((struct ether_addr *)nic->mac_addr)) + if (is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) eth_random_addr(&nic->mac_addr[0]); - ether_addr_copy((struct ether_addr *)nic->mac_addr, + ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, ð_dev->data->mac_addrs[0]); ret = nicvf_mbox_set_mac_addr(nic, nic->mac_addr); diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index 801f54c96..ef02fdcdd 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -68,7 +68,7 @@ struct vdev_netvsc_ctx { char devargs[256]; /**< Fail-safe device arguments. */ char if_name[IF_NAMESIZE]; /**< NetVSC netdevice name. */ unsigned int if_index; /**< NetVSC netdevice index. */ - struct ether_addr if_addr; /**< NetVSC MAC address. */ + struct rte_ether_addr if_addr; /**< NetVSC MAC address. */ int pipe[2]; /**< Fail-safe communication pipe. */ char yield[256]; /**< PCI sub-device arguments. */ }; @@ -157,7 +157,7 @@ vdev_netvsc_iface_is_netvsc(const struct if_nameindex *iface) */ static int vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap), int is_netvsc, ...) { struct if_nameindex *iface = if_nameindex(); @@ -178,7 +178,7 @@ vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface, for (i = 0; iface[i].if_name; ++i) { int is_netvsc_ret; struct ifreq req; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; va_list ap; is_netvsc_ret = vdev_netvsc_iface_is_netvsc(&iface[i]) ? 1 : 0; @@ -368,7 +368,7 @@ vdev_netvsc_sysfs_readlink(char *buf, size_t size, const char *if_name, */ static int vdev_netvsc_device_probe(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap) { struct vdev_netvsc_ctx *ctx = va_arg(ap, struct vdev_netvsc_ctx *); @@ -507,7 +507,7 @@ vdev_netvsc_alarm(__rte_unused void *arg) */ static int vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap) { const char *name = va_arg(ap, const char *); @@ -527,7 +527,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, if (!strcmp(pair->value, iface->if_name)) break; } else if (!strcmp(pair->key, VDEV_NETVSC_ARG_MAC)) { - struct ether_addr tmp; + struct rte_ether_addr tmp; if (sscanf(pair->value, "%" SCNx8 ":%" SCNx8 ":%" SCNx8 ":" diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index b2cda0483..6705e90db 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -43,7 +43,7 @@ static const char *valid_arguments[] = { NULL }; -static struct ether_addr base_eth_addr = { +static struct rte_ether_addr base_eth_addr = { .addr_bytes = { 0x56 /* V */, 0x48 /* H */, @@ -325,10 +325,10 @@ static inline void vhost_count_multicast_broadcast(struct vhost_queue *vq, struct rte_mbuf *mbuf) { - struct ether_addr *ea = NULL; + struct rte_ether_addr *ea = NULL; struct vhost_stats *pstats = &vq->stats; - ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *); + ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) pstats->xstats[VHOST_BROADCAST_PKT]++; @@ -1206,7 +1206,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name, struct rte_eth_dev_data *data; struct pmd_internal *internal = NULL; struct rte_eth_dev *eth_dev = NULL; - struct ether_addr *eth_addr = NULL; + struct rte_ether_addr *eth_addr = NULL; struct rte_vhost_vring_state *vring_state = NULL; struct internal_list *list = NULL; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 2272bb2e5..d34d94482 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -65,11 +65,11 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev); static int virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int virtio_mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); static int virtio_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int virtio_intr_disable(struct rte_eth_dev *dev); @@ -1142,11 +1142,11 @@ virtio_mac_table_set(struct virtio_hw *hw, } static int -virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq __rte_unused) { struct virtio_hw *hw = dev->data->dev_private; - const struct ether_addr *addrs = dev->data->mac_addrs; + const struct rte_ether_addr *addrs = dev->data->mac_addrs; unsigned int i; struct virtio_net_ctrl_mac *uc, *mc; @@ -1161,7 +1161,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, mc->entries = 0; for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { - const struct ether_addr *addr + const struct rte_ether_addr *addr = (i == index) ? mac_addr : addrs + i; struct virtio_net_ctrl_mac *tbl = is_multicast_ether_addr(addr) ? mc : uc; @@ -1176,7 +1176,7 @@ static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct virtio_hw *hw = dev->data->dev_private; - struct ether_addr *addrs = dev->data->mac_addrs; + struct rte_ether_addr *addrs = dev->data->mac_addrs; struct virtio_net_ctrl_mac *uc, *mc; unsigned int i; @@ -1204,7 +1204,7 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) } static int -virtio_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct virtio_hw *hw = dev->data->dev_private; @@ -1395,7 +1395,7 @@ virtio_notify_peers(struct rte_eth_dev *dev) return; rarp_mbuf = rte_net_make_rarp_packet(rxvq->mpool, - (struct ether_addr *)hw->mac_addr); + (struct rte_ether_addr *)hw->mac_addr); if (rarp_mbuf == NULL) { PMD_DRV_LOG(ERR, "failed to make RARP packet."); return; @@ -1662,7 +1662,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Copy the permanent MAC address to: virtio_hw */ virtio_get_hwaddr(hw); - ether_addr_copy((struct ether_addr *) hw->mac_addr, + ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index e6f3706d6..d6f46586e 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1092,7 +1092,7 @@ static inline void virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) { uint32_t s = mbuf->pkt_len; - struct ether_addr *ea; + struct rte_ether_addr *ea; stats->bytes += s; @@ -1113,7 +1113,7 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) stats->size_bins[7]++; } - ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *); + ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) stats->broadcast++; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 93e5de9a7..2c42f2677 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -91,7 +91,7 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on); static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); static int vmxnet3_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static void vmxnet3_interrupt_handler(void *param); int vmxnet3_logtype_init; @@ -311,7 +311,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->perm_addr, + ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -1185,11 +1185,11 @@ vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev) } static int -vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct vmxnet3_hw *hw = dev->data->dev_private; - ether_addr_copy(mac_addr, (struct ether_addr *)(hw->perm_addr)); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); vmxnet3_write_mac(hw, mac_addr->addr_bytes); return 0; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index d30914a8a..a2c047ec6 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -676,7 +676,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, ptr = rte_pktmbuf_mtod(rxm, char *); slen = rte_pktmbuf_data_len(rxm); - hlen = sizeof(struct ether_hdr); + hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) @@ -703,7 +703,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) return hw->mtu - hlen - sizeof(struct tcp_hdr) + - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); tcp_hdr = (struct tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; @@ -712,7 +712,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, return (rte_pktmbuf_pkt_len(rxm) - hlen + rxm->udata64 - 1) / rxm->udata64; else - return hw->mtu - hlen + sizeof(struct ether_hdr); + return hw->mtu - hlen + sizeof(struct rte_ether_hdr); } /* Receive side checksum and other offloads */ diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index d68c06aef..9fa492978 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -273,7 +273,7 @@ signal_handler(int signum) } static void -print_mac(unsigned int portid, struct ether_addr *bbdev_ports_eth_address) +print_mac(unsigned int portid, struct rte_ether_addr *bbdev_ports_eth_address) { printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", (unsigned int) portid, @@ -341,14 +341,14 @@ check_port_link_status(uint16_t port_id) static inline void add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst) { - struct ether_hdr *eth_from; - struct ether_hdr *eth_to; + struct rte_ether_hdr *eth_from; + struct rte_ether_hdr *eth_to; - eth_from = rte_pktmbuf_mtod(pkt_src, struct ether_hdr *); - eth_to = rte_pktmbuf_mtod(pkt_dst, struct ether_hdr *); + eth_from = rte_pktmbuf_mtod(pkt_src, struct rte_ether_hdr *); + eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *); /* copy header */ - rte_memcpy(eth_to, eth_from, sizeof(struct ether_hdr)); + rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); } static inline void @@ -377,7 +377,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, for (i = 0; i < num_pkts; ++i) { uint16_t pkt_data_len = rte_pktmbuf_data_len(mbufs[i]) - - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* Resize the packet if needed */ if (pkt_data_len < ncb) { @@ -395,7 +395,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, for (l = start_bit_idx; l < start_bit_idx + d; ++l) { uint8_t *data = rte_pktmbuf_mtod_offset( mbufs[i], uint8_t *, - sizeof(struct ether_hdr) + (l >> 3)); + sizeof(struct rte_ether_hdr) + (l >> 3)); if (*data & (0x80 >> (l & 7))) temp_buf[out_idx] = LLR_1_BIT; else @@ -410,7 +410,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, } rte_memcpy(rte_pktmbuf_mtod_offset(mbufs[i], uint8_t *, - sizeof(struct ether_hdr)), temp_buf, ncb); + sizeof(struct rte_ether_hdr)), temp_buf, ncb); } } @@ -423,9 +423,9 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts) struct rte_mbuf *in = out->userdata; if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *, - sizeof(struct ether_hdr)), + sizeof(struct rte_ether_hdr)), rte_pktmbuf_mtod_offset(out, uint8_t *, - sizeof(struct ether_hdr)), + sizeof(struct rte_ether_hdr)), K / 8 - CRC_24B_LEN)) printf("Input and output buffers are not equal!\n"); } @@ -439,7 +439,7 @@ initialize_ports(struct app_config_params *app_params, uint16_t port_id = app_params->port_id; uint16_t q; /* ethernet addresses of ports */ - struct ether_addr bbdev_port_eth_addr; + struct rte_ether_addr bbdev_port_eth_addr; /* initialize ports */ printf("\nInitializing port %u...\n", app_params->port_id); @@ -707,14 +707,14 @@ run_encoding(struct lcore_conf *lcore_conf) char *data; const uint16_t pkt_data_len = rte_pktmbuf_data_len(rx_pkts_burst[i]) - - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* save input mbuf pointer for later comparison */ enc_out_pkts[i]->userdata = rx_pkts_burst[i]; /* copy ethernet header */ rte_pktmbuf_reset(enc_out_pkts[i]); data = rte_pktmbuf_append(enc_out_pkts[i], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (data == NULL) { printf( "Not enough space for ethernet header in encoder output mbuf\n"); @@ -728,7 +728,7 @@ run_encoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_enc.input.data = rx_pkts_burst[i]; bbdev_ops_burst[i]->turbo_enc.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* Encoder will attach the CRC24B, adjust the length */ bbdev_ops_burst[i]->turbo_enc.input.length = in_data_len; @@ -746,7 +746,7 @@ run_encoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_enc.output.data = enc_out_pkts[i]; bbdev_ops_burst[i]->turbo_enc.output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); } /* Enqueue packets on BBDevice */ @@ -834,15 +834,15 @@ run_decoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_dec.input.data = recv_pkts_burst[i]; bbdev_ops_burst[i]->turbo_dec.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); bbdev_ops_burst[i]->turbo_dec.input.length = rte_pktmbuf_data_len(recv_pkts_burst[i]) - - sizeof(struct ether_hdr); + - sizeof(struct rte_ether_hdr); bbdev_ops_burst[i]->turbo_dec.hard_output.data = recv_pkts_burst[i]; bbdev_ops_burst[i]->turbo_dec.hard_output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); } /* Enqueue packets on BBDevice */ diff --git a/examples/bond/main.c b/examples/bond/main.c index cf7335ddf..8b510cab8 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -201,7 +201,7 @@ slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) "Start port %d failed (res=%d)", portid, retval); - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(portid, &addr); printf("Port %u MAC: ", portid); @@ -291,7 +291,7 @@ bond_port_init(struct rte_mempool *mbuf_pool) rte_eth_promiscuous_enable(BOND_PORT); - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(BOND_PORT, &addr); printf("Port %u MAC: ", (unsigned)BOND_PORT); @@ -300,21 +300,21 @@ bond_port_init(struct rte_mempool *mbuf_pool) } static inline size_t -get_vlan_offset(struct ether_hdr *eth_hdr, uint16_t *proto) +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) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - vlan_offset = sizeof(struct vlan_hdr); + vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; - vlan_offset += sizeof(struct vlan_hdr); + vlan_offset += sizeof(struct rte_vlan_hdr); } } return vlan_offset; @@ -336,9 +336,9 @@ struct global_flag_stru_t *global_flag_stru_p = &global_flag_stru; static int lcore_main(__attribute__((unused)) void *arg1) { struct rte_mbuf *pkts[MAX_PKT_BURST] __rte_cache_aligned; - struct ether_addr d_addr; + struct rte_ether_addr d_addr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; @@ -370,7 +370,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[0]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - eth_hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + 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)) printf("VLAN taged frame, offset:"); @@ -449,7 +449,7 @@ static void cmd_obj_send_parsed(void *parsed_result, char ip_str[INET6_ADDRSTRLEN]; struct rte_mbuf *created_pkt; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; @@ -469,16 +469,16 @@ static void cmd_obj_send_parsed(void *parsed_result, return; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr); + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; - eth_hdr = rte_pktmbuf_mtod(created_pkt, struct ether_hdr *); + 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); - arp_hdr = (struct rte_arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); + 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; @@ -698,7 +698,7 @@ static void cmd_show_parsed(__attribute__((unused)) void *parsed_result, { uint16_t slaves[16] = {0}; uint8_t len = 16; - struct ether_addr addr; + struct rte_ether_addr addr; uint16_t i = 0; while (i < slaves_count) { diff --git a/examples/distributor/main.c b/examples/distributor/main.c index b5499bb12..e4c8c3c18 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -179,7 +179,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return 0; } - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index a4e64b354..ce7f715f8 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -30,7 +30,7 @@ struct pcmd_intstr_params { struct pcmd_intmac_params { cmdline_fixed_string_t cmd; uint16_t port; - struct ether_addr mac; + struct rte_ether_addr mac; }; struct pcmd_str_params { cmdline_fixed_string_t cmd; @@ -475,7 +475,7 @@ pcmd_macaddr_callback(void *ptr_params, void *ptr_data) { struct pcmd_intmac_params *params = ptr_params; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; int stat; stat = 0; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index e23d3afd2..27c22cf90 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -32,7 +32,7 @@ struct txq_port { }; struct app_port { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct txq_port txq; rte_spinlock_t lock; int port_active; @@ -158,9 +158,9 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports) static void process_frame(struct app_port *ptr_port, struct rte_mbuf *ptr_frame) { - struct ether_hdr *ptr_mac_hdr; + struct rte_ether_hdr *ptr_mac_hdr; - ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct ether_hdr *); + ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *); ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); } diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index bf10139e7..299488c1c 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -303,7 +303,7 @@ rte_ethtool_net_stop(uint16_t port_id) } int -rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr) +rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); if (addr == NULL) @@ -314,7 +314,7 @@ rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr) } int -rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr) +rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { if (addr == NULL) return -EINVAL; @@ -323,7 +323,7 @@ rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr) int rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused, - struct ether_addr *addr) + struct rte_ether_addr *addr) { if (addr == NULL) return -EINVAL; diff --git a/examples/ethtool/lib/rte_ethtool.h b/examples/ethtool/lib/rte_ethtool.h index 31cd5ae4e..0ccceb1c3 100644 --- a/examples/ethtool/lib/rte_ethtool.h +++ b/examples/ethtool/lib/rte_ethtool.h @@ -260,7 +260,7 @@ int rte_ethtool_net_stop(uint16_t port_id); * - (0) if successful. * - (-ENODEV) if *port_id* invalid. */ -int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Setting the Ethernet device MAC address. @@ -276,7 +276,7 @@ int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr); * - (-EINVAL) if parameters invalid. * - others depends on the specific operations implementation. */ -int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Validate if the provided MAC address is valid unicast address @@ -292,7 +292,7 @@ int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr); * - (-EINVAL) if parameters invalid. * - others depends on the specific operations implementation. */ -int rte_ethtool_net_validate_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_validate_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Setting the Ethernet device maximum Tx unit. diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index 58f8904e0..63227f0d5 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -317,7 +317,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) } /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index a6cc912fb..ef23d963a 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -99,11 +99,11 @@ struct config_data cdata; static __rte_always_inline void exchange_mac(struct rte_mbuf *m) { - struct ether_hdr *eth; - struct ether_addr addr; + struct rte_ether_hdr *eth; + struct rte_ether_addr addr; /* change mac addresses on packet (to use mbuf data) */ - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_addr_copy(ð->d_addr, &addr); ether_addr_copy(&addr, ð->d_addr); } diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index 199612926..5ae81fab1 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -98,7 +98,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -108,7 +108,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -118,7 +118,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -131,7 +131,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -141,7 +141,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -192,7 +192,7 @@ static inline int port_init(uint8_t port, struct rte_mempool *mbuf_pool) { struct rte_eth_conf port_conf = port_conf_default; - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rx_rings = 1, tx_rings = 1; int retval; uint16_t q; diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index a582ac075..7b8e7c4fa 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -45,7 +45,7 @@ struct rte_flow *flow; #include "flow_blocks.c" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -56,7 +56,7 @@ static void main_loop(void) { struct rte_mbuf *mbufs[32]; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_flow_error error; uint16_t nb_rx; uint16_t i; @@ -71,7 +71,7 @@ main_loop(void) struct rte_mbuf *m = mbufs[j]; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index e90a61e35..175803078 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -60,7 +60,7 @@ * We have to consider the max possible overhead. */ #define MTU_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct vlan_hdr)) + (ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct rte_vlan_hdr)) /* * Default payload in bytes for the IPv6 packet. @@ -90,7 +90,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #ifndef IPv4_BYTES #define IPv4_BYTES_FMT "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 @@ -252,7 +252,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, port_out = port_in; /* Remove the Ethernet header and trailer from the input packet */ - rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); /* Build transmission burst */ len = qconf->tx_mbufs[port_out].len; @@ -340,13 +340,13 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, void *d_addr_bytes; m = qconf->tx_mbufs[port_out].m_table[i]; - struct ether_hdr *eth_hdr = (struct ether_hdr *) - rte_pktmbuf_prepend(m, (uint16_t)sizeof(struct ether_hdr)); + struct rte_ether_hdr *eth_hdr = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(m, (uint16_t)sizeof(struct rte_ether_hdr)); if (eth_hdr == NULL) { rte_panic("No headroom in mbuf.\n"); } - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); /* 02:00:00:00:00:xx */ d_addr_bytes = ð_hdr->d_addr.addr_bytes[0]; @@ -568,7 +568,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -669,11 +669,11 @@ check_ptype(int portid) static inline void parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index 74215857b..803537232 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -245,7 +245,7 @@ static void print_link_info(struct link *link, char *out, size_t out_size) { struct rte_eth_stats stats; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link eth_link; uint16_t mtu; @@ -4777,7 +4777,7 @@ cmd_pipeline_table_rule_delete_default(char **tokens, } static void -ether_addr_show(FILE *f, struct ether_addr *addr) +ether_addr_show(FILE *f, struct rte_ether_addr *addr) { fprintf(f, "%02x:%02x:%02x:%02x:%02x:%02x", (uint32_t)addr->addr_bytes[0], (uint32_t)addr->addr_bytes[1], diff --git a/examples/ip_pipeline/parser.c b/examples/ip_pipeline/parser.c index ffcdeb3a6..4777f9ffd 100644 --- a/examples/ip_pipeline/parser.c +++ b/examples/ip_pipeline/parser.c @@ -513,13 +513,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -553,7 +553,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -581,15 +581,15 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -parse_mac_addr(const char *token, struct ether_addr *addr) +parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; } diff --git a/examples/ip_pipeline/parser.h b/examples/ip_pipeline/parser.h index 261a8c858..4538f675d 100644 --- a/examples/ip_pipeline/parser.h +++ b/examples/ip_pipeline/parser.h @@ -47,7 +47,7 @@ int parse_hex_string(char *src, uint8_t *dst, uint32_t *size); int parse_ipv4_addr(const char *token, struct in_addr *ipv4); int parse_ipv6_addr(const char *token, struct in6_addr *ipv6); -int parse_mac_addr(const char *token, struct ether_addr *addr); +int parse_mac_addr(const char *token, struct rte_ether_addr *addr); int parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); struct cpu_core_params { diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 17b55d4c7..226153968 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -95,7 +95,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #ifndef IPv4_BYTES #define IPv4_BYTES_FMT "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 @@ -308,7 +308,7 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, struct lcore_queue_conf *qconf, uint64_t tms) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_ip_frag_tbl *tbl; struct rte_ip_frag_death_row *dr; struct rx_queue *rxq; @@ -318,7 +318,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, rxq = &qconf->rx_queue_list[queue]; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_port = portid; @@ -350,7 +350,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); } } @@ -388,7 +388,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); } } @@ -691,7 +691,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index ffbd00b08..10af1280a 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -233,9 +233,9 @@ static inline void prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) { uint8_t *nlp; - struct ether_hdr *eth; + struct rte_ether_hdr *eth; - eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + 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); nlp = RTE_PTR_ADD(nlp, offsetof(struct ip, ip_p)); @@ -325,11 +325,11 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, const struct lcore_conf *qconf) { struct ip *ip; - struct ether_hdr *ethhdr; + struct rte_ether_hdr *ethhdr; ip = rte_pktmbuf_mtod(pkt, struct ip *); - ethhdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); + ethhdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); if (ip->ip_v == IPVERSION) { pkt->ol_flags |= qconf->outbound.ipv4_offloads; @@ -352,9 +352,9 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, } memcpy(ðhdr->s_addr, ðaddr_tbl[port].src, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); memcpy(ðhdr->d_addr, ðaddr_tbl[port].dst, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } static inline void @@ -1426,7 +1426,7 @@ parse_args(int32_t argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -1437,7 +1437,7 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr) * Update destination ethaddr for the port. */ int -add_dst_ethaddr(uint16_t port, const struct ether_addr *addr) +add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr) { if (port >= RTE_DIM(ethaddr_tbl)) return -EINVAL; @@ -1833,7 +1833,7 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) uint16_t tx_queueid, rx_queueid, queue, lcore_id; int32_t ret, socket_id; struct lcore_conf *qconf; - struct ether_addr ethaddr; + struct rte_ether_addr ethaddr; struct rte_eth_conf local_port_conf = port_conf; rte_eth_dev_info_get(portid, &dev_info); diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 99f49d65f..ca4391849 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -300,7 +300,7 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, uint64_t *tx_offloads); int -add_dst_ethaddr(uint16_t port, const struct ether_addr *addr); +add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr); void enqueue_cop_burst(struct cdev_qp *cqp); diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c index b0a8ee23b..fc8c238fe 100644 --- a/examples/ipsec-secgw/parser.c +++ b/examples/ipsec-secgw/parser.c @@ -324,7 +324,7 @@ parse_uint8x16(const char *s, uint8_t *v, uint8_t ls) } static int -parse_mac(const char *str, struct ether_addr *addr) +parse_mac(const char *str, struct rte_ether_addr *addr) { uint32_t i; @@ -499,7 +499,7 @@ cfg_parse_neigh(void *parsed_result, __rte_unused struct cmdline *cl, int32_t rc; struct cfg_neigh_add_item *res; struct parse_status *st; - struct ether_addr mac; + struct rte_ether_addr mac; st = data; res = parsed_result; diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 1eef29159..a38aabe75 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -80,7 +80,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[MAX_PORTS]; +static struct rte_ether_addr ports_eth_addr[MAX_PORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -267,14 +267,14 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone) * and put it into the outgoing queue for the given port. */ static inline void -mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, +mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); ether_addr_copy(dest_addr, ðdr->d_addr); @@ -302,11 +302,11 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) uint16_t port; union { uint64_t as_int; - struct ether_addr as_addr; + struct rte_ether_addr as_addr; } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -535,7 +535,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/kni/main.c b/examples/kni/main.c index a58774a33..e4e27e87e 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -832,7 +832,7 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) } static void -print_ethaddr(const char *name, struct ether_addr *mac_addr) +print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); @@ -851,10 +851,10 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) } RTE_LOG(INFO, APP, "Configure mac address of %d\n", port_id); - print_ethaddr("Address:", (struct ether_addr *)mac_addr); + print_ethaddr("Address:", (struct rte_ether_addr *)mac_addr); ret = rte_eth_dev_default_mac_addr_set(port_id, - (struct ether_addr *)mac_addr); + (struct rte_ether_addr *)mac_addr); if (ret < 0) RTE_LOG(ERR, APP, "Failed to config mac_addr for port %d\n", port_id); @@ -912,7 +912,7 @@ kni_alloc(uint16_t port_id) } /* Get the interface default mac address */ rte_eth_macaddr_get(port_id, - (struct ether_addr *)&conf.mac_addr); + (struct rte_ether_addr *)&conf.mac_addr); rte_eth_dev_get_mtu(port_id, &conf.mtu); diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c index 0e6078aad..1a8af28e2 100644 --- a/examples/l2fwd-cat/l2fwd-cat.c +++ b/examples/l2fwd-cat/l2fwd-cat.c @@ -73,7 +73,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 06517b471..dd09855e7 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -79,7 +79,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint64_t l2fwd_enabled_port_mask; @@ -387,19 +387,19 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct rte_crypto_op *op, struct l2fwd_crypto_params *cparams) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; char *padding; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (eth_hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_IPv4)) return -1; - ipdata_offset = sizeof(struct ether_hdr); + ipdata_offset = sizeof(struct rte_ether_hdr); ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); @@ -593,10 +593,10 @@ l2fwd_send_packet(struct rte_mbuf *m, uint16_t port) static void l2fwd_mac_updating(struct rte_mbuf *m, uint16_t dest_portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index a4d28e178..033104d63 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -52,7 +52,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask; @@ -335,14 +335,14 @@ show_stats_cb(__rte_unused void *param) static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; int sent; unsigned dst_port; struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 0bf2b5336..21d19932d 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -58,7 +58,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask; @@ -165,14 +165,14 @@ print_stats(__attribute__((unused)) struct rte_timer *ptr_timer, static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; int sent; unsigned dst_port; struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 6c23215a5..c1d6797b0 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -59,7 +59,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask = 0; @@ -151,10 +151,10 @@ print_stats(void) static void l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index a322ce4f2..ed25f75d8 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -82,7 +82,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask; @@ -173,7 +173,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *c = (unsigned char)(ip >> 8 & 0xff);\ *d = (unsigned char)(ip & 0xff);\ } while (0) -#define OFF_ETHHEAD (sizeof(struct ether_hdr)) +#define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) #define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) #define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ @@ -544,7 +544,7 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) unsigned char a, b, c, d; struct ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); printf("Packet Src:%hhu.%hhu.%hhu.%hhu ", a, b, c, d); @@ -568,7 +568,7 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) uint32_t offset = sig & ~ACL_DENY_SIGNATURE; struct ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); printf("Packet Src"); for (i = 0; i < RTE_DIM(ipv6_hdr->src_addr); i += sizeof(uint16_t)) @@ -625,7 +625,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt_len) >= 0) { @@ -1754,7 +1754,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 3b448acc4..bcd584d3e 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -135,7 +135,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* ethernet addresses of ports */ static rte_spinlock_t locks[RTE_MAX_ETHPORTS]; @@ -618,11 +618,11 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, static inline void parse_ptype_one(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -661,18 +661,18 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -710,7 +710,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -1577,7 +1577,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 41137f978..2c0c89e21 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -112,7 +112,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -417,15 +417,15 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -788,7 +788,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index c962deac3..1893f8c3a 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -73,7 +73,7 @@ extern volatile bool force_quit; /* ethernet addresses of ports */ extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ extern uint32_t enabled_port_mask; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 5ec99f961..0c68aa01c 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,13 +68,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -121,10 +121,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, vector unsigned short dp1, static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; vector unsigned int te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index fa8f82be6..64e79b946 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -561,7 +561,7 @@ em_check_ptype(int portid) static inline void em_parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; void *l3; @@ -569,9 +569,9 @@ em_parse_ptype(struct rte_mbuf *m) struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - l3 = (uint8_t *)eth_hdr + sizeof(struct ether_hdr); + l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { ipv4_hdr = (struct ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 228164e26..5612ef378 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -9,20 +9,20 @@ static __rte_always_inline void l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); tcp_or_udp = m->packet_type & (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP); l3_ptypes = m->packet_type & RTE_PTYPE_L3_MASK; if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -55,7 +55,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 22c26dce3..5afe77591 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -92,7 +92,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); @@ -107,7 +107,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv6 headers.*/ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -142,7 +142,7 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, for (j = 0; j < EM_HASH_LOOKUP_COUNT && j < nb_rx; j++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (j = 0; j < n; j += EM_HASH_LOOKUP_COUNT) { @@ -160,7 +160,7 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, for (i = 0, pos = j + EM_HASH_LOOKUP_COUNT; i < EM_HASH_LOOKUP_COUNT && pos < nb_rx; i++, pos++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[pos], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } if (tcp_or_udp && (l3_type == RTE_PTYPE_L3_IPV4)) { diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 16c8b04ac..3ee2304b5 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -13,7 +13,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, union ipv4_5tuple_host *key) { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); @@ -25,17 +25,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 41e2be958..8156bbb90 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -13,7 +13,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); @@ -25,18 +25,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 35cf5eac0..6e7096c01 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -37,7 +37,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); @@ -52,7 +52,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv6 headers.*/ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -81,13 +81,13 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (nb_rx > 0) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[0], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (i = 1, j = 0; j < nb_rx; i++, j++) { if (i < nb_rx) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } dst_port[j] = em_get_dst_port(qconf, pkts_burst[j], portid); } diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index b1dc195ad..d7e1aef86 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -104,18 +104,18 @@ lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, { struct ipv6_hdr *ipv6_hdr; struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, @@ -136,7 +136,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, { uint32_t next_hop; struct ipv6_hdr *ipv6_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { return (uint16_t) ((rte_lpm_lookup(qconf->ipv4_lookup_struct, @@ -145,7 +145,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, @@ -372,11 +372,11 @@ lpm_check_ptype(int portid) static inline void lpm_parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index b68868f44..28635bf03 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -9,16 +9,16 @@ static __rte_always_inline void l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -51,7 +51,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index 4c9e2438b..b36e991ac 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -18,28 +18,28 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index 02ec0d802..a3e42cfa7 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -19,25 +19,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -98,14 +98,14 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (k) { for (i = 0; i < FWDSTEP; i++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (j = 0; j != k - FWDSTEP; j += FWDSTEP) { for (i = 0; i < FWDSTEP; i++) { rte_prefetch0(rte_pktmbuf_mtod( pkts_burst[j + i + FWDSTEP], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } processx4_step1(&pkts_burst[j], &dip, &ipv4_flag); @@ -125,17 +125,17 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, switch (m) { case 3: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 2: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 1: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; } diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 1d1615906..4603e0749 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -16,25 +16,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index 76ccdfa73..af2dc47ac 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -104,10 +104,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32x4_t te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = vld1q_u32((uint32_t *)eth_hdr); ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index ed5267c11..3349f2747 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -101,10 +101,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2) static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; __m128i te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index e4b99efe0..a91a0a16c 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -79,7 +79,7 @@ volatile bool force_quit; /* ethernet addresses of ports */ uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; xmm_t val_eth[RTE_MAX_ETHPORTS]; @@ -634,7 +634,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -889,14 +889,14 @@ main(int argc, char **argv) print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", - (const struct ether_addr *)&dest_eth_addr[portid]); + (const struct rte_ether_addr *)&dest_eth_addr[portid]); printf(", "); /* * prepare src MACs for each port. */ ether_addr_copy(&ports_eth_addr[portid], - (struct ether_addr *)(val_eth + portid) + 1); + (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ ret = init_mem(NB_MBUF); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index f3346d23b..9997c58f4 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -53,7 +53,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t lsi_enabled_port_mask = 0; @@ -163,13 +163,13 @@ print_stats(void) static void lsi_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port = lsi_dst_ports[portid]; int sent; struct rte_eth_dev_tx_buffer *buffer; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index 39a846a56..c4e6b4ac8 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -509,7 +509,7 @@ app_lcore_worker( pkt = lp->mbuf_in.array[j]; ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) { diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index 0ddc63e92..9a8e422d4 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -66,7 +66,7 @@ get_printable_mac_addr(uint16_t port) if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; if (unlikely(addresses[port][0]=='\0')){ - struct ether_addr mac; + struct rte_ether_addr mac; rte_eth_macaddr_get(port, &mac); snprintf(addresses[port], sizeof(addresses[port]), "%02x:%02x:%02x:%02x:%02x:%02x\n", diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index 149bfdd02..ca312029e 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -255,7 +255,7 @@ configure_tx_buffers(struct rte_eth_dev_tx_buffer *tx_buffer[]) static inline int configure_eth_port(uint16_t port_id) { - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rxRings = 1, txRings = 1; int ret; uint16_t q; diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 4f8747bc3..b29ed9e97 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -92,11 +92,11 @@ check_ptype(int portid) static inline void parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -186,7 +186,7 @@ static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ static uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static xmm_t val_eth[RTE_MAX_ETHPORTS]; @@ -884,39 +884,39 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { - struct ether_hdr *eth_hdr[8]; + struct rte_ether_hdr *eth_hdr[8]; struct ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; __m128i data[8]; - eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct ether_hdr *); - eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct ether_hdr *); - eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct ether_hdr *); - eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct ether_hdr *); - eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct ether_hdr *); - eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct ether_hdr *); - eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct ether_hdr *); - eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct rte_ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct rte_ether_hdr *); + eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct rte_ether_hdr *); + eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct rte_ether_hdr *); + eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct rte_ether_hdr *); + eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -967,28 +967,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) #endif /* End of #ifdef DO_RFC_1812_CHECKS */ data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); @@ -1094,13 +1094,13 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i mask1, union ipv6_5tuple_host *key) { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); @@ -1113,37 +1113,37 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { int32_t ret[8]; uint16_t dst_port[8]; - struct ether_hdr *eth_hdr[8]; + struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; - eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct ether_hdr *); - eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct ether_hdr *); - eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct ether_hdr *); - eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct ether_hdr *); - eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct ether_hdr *); - eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct ether_hdr *); - eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct ether_hdr *); - eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct rte_ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct rte_ether_hdr *); + eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct rte_ether_hdr *); + eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct rte_ether_hdr *); + eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct rte_ether_hdr *); + eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); get_ipv6_5tuple(m[1], mask1, mask2, &key[1]); @@ -1228,16 +1228,16 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -1270,7 +1270,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct); @@ -1346,7 +1346,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; struct ipv6_hdr *ipv6_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { return (uint16_t) ((rte_lpm_lookup( @@ -1355,7 +1355,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( @@ -1371,13 +1371,13 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; @@ -1403,25 +1403,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1503,13 +1503,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -3020,7 +3020,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; @@ -3576,14 +3576,14 @@ main(int argc, char **argv) print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", - (const struct ether_addr *)&dest_eth_addr[portid]); + (const struct rte_ether_addr *)&dest_eth_addr[portid]); printf(", "); /* * prepare src MACs for each port. */ ether_addr_copy(&ports_eth_addr[portid], - (struct ether_addr *)(val_eth + portid) + 1); + (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ ret = init_mem(NB_MBUF); diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 82ae71c19..7d28f59ce 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -53,7 +53,7 @@ static const struct rte_eth_conf port_conf_default = { }, }; -static const struct ether_addr ether_multicast = { +static const struct rte_ether_addr ether_multicast = { .addr_bytes = {0x01, 0x1b, 0x19, 0x0, 0x0, 0x0} }; @@ -334,7 +334,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) struct ptp_header *ptp_hdr; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(ptp_data->m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id); if (ptp_data->ptpset == 0) { @@ -361,20 +361,20 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) static void parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ptp_header *ptp_hdr; struct clock_id *client_clkid; struct ptp_message *ptp_msg; struct rte_mbuf *created_pkt; struct tstamp *origin_tstamp; - struct ether_addr eth_multicast = ether_multicast; + struct rte_ether_addr eth_multicast = ether_multicast; size_t pkt_size; int wait_us; struct rte_mbuf *m = ptp_data->m; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); if (memcmp(&ptp_data->master_clock_id, &ptp_hdr->source_port_id.clock_id, sizeof(struct clock_id)) != 0) @@ -382,7 +382,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) ptp_data->seqID_FOLLOWUP = rte_be_to_cpu_16(ptp_hdr->seq_id); ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(m, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); origin_tstamp = &ptp_msg->follow_up.precise_origin_tstamp; ptp_data->tstamp1.tv_nsec = ntohl(origin_tstamp->ns); @@ -393,11 +393,11 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) if (ptp_data->seqID_FOLLOWUP == ptp_data->seqID_SYNC) { created_pkt = rte_pktmbuf_alloc(mbuf_pool); - pkt_size = sizeof(struct ether_hdr) + + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct ptp_message); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; - eth_hdr = rte_pktmbuf_mtod(created_pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ @@ -406,7 +406,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) eth_hdr->ether_type = htons(PTP_PROTOCOL); ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(created_pkt, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ptp_msg->delay_req.hdr.seq_id = htons(ptp_data->seqID_SYNC); ptp_msg->delay_req.hdr.msg_type = DELAY_REQ; @@ -499,7 +499,7 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) uint16_t seq_id; ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(m, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); seq_id = rte_be_to_cpu_16(ptp_msg->delay_resp.hdr.seq_id); if (memcmp(&ptp_data->client_clock_id, &ptp_msg->delay_resp.req_port_id.clock_id, @@ -535,17 +535,17 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) static void parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { struct ptp_header *ptp_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == PTP_PROTOCOL) { ptp_data.m = m; ptp_data.portid = portid; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); switch (ptp_hdr->msg_type) { case SYNC: diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 9b0112449..9f3344bf1 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -145,7 +145,7 @@ app_pkt_handle(struct rte_mbuf *pkt, uint64_t time) { uint8_t input_color, output_color; uint8_t *pkt_data = rte_pktmbuf_mtod(pkt, uint8_t *); - uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct ether_hdr); + uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct rte_ether_hdr); uint8_t flow_id = (uint8_t)(pkt_data[APP_PKT_FLOW_POS] & (APP_FLOWS_MAX - 1)); input_color = pkt_data[APP_PKT_COLOR_POS]; enum policer_action action; diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index c55d38744..61e92a820 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -50,8 +50,8 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) { struct rte_mbuf *mbuf; struct ether_fc_frame *pause_frame; - struct ether_hdr *hdr; - struct ether_addr mac_addr; + struct rte_ether_hdr *hdr; + struct rte_ether_addr mac_addr; RTE_LOG_DP(DEBUG, USER1, "Sending PAUSE frame (duration=%d) on port %d\n", @@ -63,7 +63,7 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) return; /* Prepare a PAUSE frame */ - hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); pause_frame = (struct ether_fc_frame *) &hdr[1]; rte_eth_macaddr_get(port_id, &mac_addr); diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 2058be627..a277519f5 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -115,7 +115,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) if (retval < 0) return retval; - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 3b97fbd45..8bec351ec 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -275,7 +275,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index 404f1f165..a086c5a77 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -68,7 +68,7 @@ get_printable_mac_addr(uint16_t port) { static const char err_address[] = "00:00:00:00:00:00"; static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)]; - struct ether_addr mac; + struct rte_ether_addr mac; if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; @@ -253,7 +253,7 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index 4aba1dc38..7e3cd8715 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -82,7 +82,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c index e0fe7bd2f..9d8ab17dd 100644 --- a/examples/tep_termination/main.c +++ b/examples/tep_termination/main.c @@ -157,7 +157,7 @@ uint16_t ports[RTE_MAX_ETHPORTS]; static unsigned nb_ports; /**< The number of ports specified in command line */ /* ethernet addresses of ports */ -struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* heads for the main used and free linked lists for the data path. */ static struct virtio_net_data_ll *ll_root_used; diff --git a/examples/tep_termination/main.h b/examples/tep_termination/main.h index 966c63a51..7a70f7396 100644 --- a/examples/tep_termination/main.h +++ b/examples/tep_termination/main.h @@ -50,7 +50,7 @@ struct vhost_dev { /**< Memory region information for gpa to hpa translation. */ struct virtio_memory_regions_hpa *regions_hpa; /**< Device MAC address (Obtained on first TX packet). */ - struct ether_addr mac_address; + struct rte_ether_addr mac_address; /**< RX queue number. */ uint16_t rx_q; /**< Data core that the device is added to. */ diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 7732821d9..ed2a405d5 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -28,19 +28,19 @@ get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags) * header. */ static void -parse_ethernet(struct ether_hdr *eth_hdr, union tunnel_offload_info *info, +parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; uint16_t ethertype; - info->outer_l2_len = sizeof(struct ether_hdr); + info->outer_l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - info->outer_l2_len += sizeof(struct vlan_hdr); + 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); } @@ -68,7 +68,7 @@ parse_ethernet(struct ether_hdr *eth_hdr, union tunnel_offload_info *info, * Calculate the checksum of a packet in hardware */ static uint64_t -process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info) +process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info) { void *l3_hdr = NULL; uint8_t l4_proto; @@ -80,12 +80,12 @@ process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info) struct sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; - info->l2_len = sizeof(struct ether_hdr); + info->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - info->l2_len += sizeof(struct vlan_hdr); + 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); } @@ -141,7 +141,7 @@ decapsulation(struct rte_mbuf *pkt) uint16_t outer_header_len; struct udp_hdr *udp_hdr; union tunnel_offload_info info = { .data = 0 }; - struct ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); parse_ethernet(phdr, &info, &l4_proto); @@ -158,7 +158,7 @@ decapsulation(struct rte_mbuf *pkt) (pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0) return -1; outer_header_len = info.outer_l2_len + info.outer_l3_len - + sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr); + + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr); rte_pktmbuf_adj(pkt, outer_header_len); @@ -172,29 +172,29 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) uint64_t ol_flags = 0; uint32_t old_len = m->pkt_len, hash; union tunnel_offload_info tx_offload = { .data = 0 }; - struct ether_hdr *phdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ - struct ether_hdr *pneth = (struct ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) - + sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr)); + struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, + sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; - struct vxlan_hdr *vxlan = (struct vxlan_hdr *) &udp[1]; + struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; /* convert TX queue ID to vport ID */ vport_id = queue_id - 1; /* replace original Ethernet header with ours */ pneth = rte_memcpy(pneth, &app_l2_hdr[vport_id], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], sizeof(struct ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - - sizeof(struct ether_hdr)); + - sizeof(struct rte_ether_hdr)); /* outer IP checksum */ ol_flags |= PKT_TX_OUTER_IP_CKSUM; @@ -209,7 +209,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) m->l2_len += ETHER_VXLAN_HLEN; } - m->outer_l2_len = sizeof(struct ether_hdr); + m->outer_l2_len = sizeof(struct rte_ether_hdr); m->outer_l3_len = sizeof(struct ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; @@ -225,7 +225,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) udp->dgram_cksum = 0; udp->dgram_len = rte_cpu_to_be_16(old_len + sizeof(struct udp_hdr) - + sizeof(struct vxlan_hdr)); + + 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); diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index bff786a2a..780ae73cc 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -17,15 +17,15 @@ #define DEFAULT_VXLAN_PORT 4789 extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; -extern struct ether_hdr app_l2_hdr[VXLAN_N_PORTS]; +extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; struct vxlan_port { uint32_t vport_id; /**< VirtIO port id */ uint32_t peer_ip; /**< remote VTEP IP address */ - struct ether_addr peer_mac; /**< remote VTEP MAC address */ - struct ether_addr vport_mac; /**< VirtIO port MAC address */ + struct rte_ether_addr peer_mac; /**< remote VTEP MAC address */ + struct rte_ether_addr vport_mac; /**< VirtIO port MAC address */ } __rte_cache_aligned; struct vxlan_conf { diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index ad7fbe9c6..e4af7bc4d 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -49,7 +49,7 @@ struct vxlan_conf vxdev; struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; -struct ether_hdr app_l2_hdr[VXLAN_N_PORTS]; +struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ uint8_t vxlan_multicast_ips[2][4] = { {239, 1, 1, 1 }, {239, 1, 2, 1 } }; @@ -227,7 +227,7 @@ int vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) { int i, ret; - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; struct ipv4_hdr *ip; @@ -242,7 +242,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) } /* Learn MAC address of guest device from packet */ - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: This device is using an existing" diff --git a/examples/tep_termination/vxlan_setup.h b/examples/tep_termination/vxlan_setup.h index 2c20e2e39..4dc37d673 100644 --- a/examples/tep_termination/vxlan_setup.h +++ b/examples/tep_termination/vxlan_setup.h @@ -9,7 +9,7 @@ extern uint16_t nb_devices; extern uint16_t udp_port; extern uint8_t filter_idx; extern uint16_t ports[RTE_MAX_ETHPORTS]; -extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; extern uint32_t enable_stats; extern struct device_statistics dev_statistics[MAX_DEVICES]; extern uint8_t rx_decap; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 8f7b758c3..5a3614117 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -161,7 +161,7 @@ const uint16_t vlan_tags[] = { }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; static struct vhost_dev_tailq_list vhost_dev_list = TAILQ_HEAD_INITIALIZER(vhost_dev_list); @@ -660,7 +660,7 @@ static unsigned check_ports_num(unsigned nb_ports) } static __rte_always_inline struct vhost_dev * -find_vhost_dev(struct ether_addr *mac) +find_vhost_dev(struct rte_ether_addr *mac) { struct vhost_dev *vdev; @@ -680,11 +680,11 @@ find_vhost_dev(struct ether_addr *mac) static int link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m) { - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; int i, ret; /* Learn MAC address of guest device from packet */ - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (find_vhost_dev(&pkt_hdr->s_addr)) { RTE_LOG(ERR, VHOST_DATA, @@ -786,10 +786,10 @@ virtio_xmit(struct vhost_dev *dst_vdev, struct vhost_dev *src_vdev, static __rte_always_inline int virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m) { - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; struct vhost_dev *dst_vdev; - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_vdev = find_vhost_dev(&pkt_hdr->d_addr); if (!dst_vdev) @@ -824,7 +824,7 @@ find_local_dest(struct vhost_dev *vdev, struct rte_mbuf *m, uint32_t *offset, uint16_t *vlan_tag) { struct vhost_dev *dst_vdev; - struct ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_vdev = find_vhost_dev(&pkt_hdr->d_addr); if (!dst_vdev) @@ -866,7 +866,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) void *l3_hdr; struct ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); l3_hdr = (char *)eth_hdr + m->l2_len; @@ -910,10 +910,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) struct mbuf_table *tx_q; unsigned offset = 0; const uint16_t lcore_id = rte_lcore_id(); - struct ether_hdr *nh; + struct rte_ether_hdr *nh; - nh = rte_pktmbuf_mtod(m, struct ether_hdr *); + nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) { struct vhost_dev *vdev2; @@ -946,10 +946,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) /*Add packet to the port tx queue*/ tx_q = &lcore_tx_queue[lcore_id]; - nh = rte_pktmbuf_mtod(m, struct ether_hdr *); + nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (unlikely(nh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN))) { /* Guest has inserted the vlan tag. */ - struct vlan_hdr *vh = (struct vlan_hdr *) (nh + 1); + struct rte_vlan_hdr *vh = (struct rte_vlan_hdr *) (nh + 1); uint16_t vlan_tag_be = rte_cpu_to_be_16(vlan_tag); if ((vm2vm_mode == VM2VM_HARDWARE) && (vh->vlan_tci != vlan_tag_be)) diff --git a/examples/vhost/main.h b/examples/vhost/main.h index 764c33afe..7cba0edbf 100644 --- a/examples/vhost/main.h +++ b/examples/vhost/main.h @@ -35,7 +35,7 @@ struct vhost_dev { /**< Number of memory regions for gpa to hpa translation. */ uint32_t nregions_hpa; /**< Device MAC address (Obtained on first TX packet). */ - struct ether_addr mac_address; + struct rte_ether_addr mac_address; /**< RX VMDQ queue number. */ uint16_t vmdq_rx_q; /**< Vlan tag assigned to the pool */ diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 74df0fe20..a2bec6242 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -56,12 +56,12 @@ static struct policy policies[MAX_CLIENTS]; #ifdef USE_JANSSON union PFID { - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t pfid; }; static int -str_to_ether_addr(const char *a, struct ether_addr *ether_addr) +str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr) { int i; char *end; @@ -403,7 +403,7 @@ get_pfid(struct policy *pol) RTE_ETH_FOREACH_DEV(x) { ret = rte_pmd_i40e_query_vfid_by_mac(x, - (struct ether_addr *)&(pol->pkt.vfid[i])); + (struct rte_ether_addr *)&(pol->pkt.vfid[i])); if (ret != -EINVAL) { pol->port[i] = x; break; diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c index 2d9e7689a..78c3aa0a1 100644 --- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c @@ -34,7 +34,7 @@ struct cmd_quit_result { }; union PFID { - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t pfid; }; diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 893bf4cdd..f018e1509 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -99,7 +99,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", @@ -348,7 +348,7 @@ main(int argc, char **argv) /* Initialize ports. */ RTE_ETH_FOREACH_DEV(portid) { - struct ether_addr eth; + struct rte_ether_addr eth; int w, j; int ret; diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 627a5da48..5195a515a 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -106,12 +106,12 @@ const uint16_t num_vlans = RTE_DIM(vlan_tags); static uint16_t num_pf_queues, num_vmdq_queues; static uint16_t vmdq_pool_base, vmdq_queue_base; /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ -static struct ether_addr pool_addr_template = { +static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; #define MAX_QUEUE_NUM_10G 128 #define MAX_QUEUE_NUM_1G 8 @@ -281,7 +281,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) * Removes this after i40e fixes this issue. */ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; mac.addr_bytes[5] = q; @@ -407,10 +407,10 @@ vmdq_parse_args(int argc, char **argv) static void update_mac_address(struct rte_mbuf *m, unsigned dst_port) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 646368395..75cf31a10 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -121,12 +121,12 @@ const uint16_t vlan_tags[] = { const uint16_t num_vlans = RTE_DIM(vlan_tags); /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ -static struct ether_addr pool_addr_template = { +static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; /* Builds up the correct configuration for vmdq+dcb based on the vlan tags array * given above, and the number of traffic classes available for use. */ @@ -332,7 +332,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) /* Set mac for each pool.*/ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; @@ -494,10 +494,10 @@ vmdq_parse_args(int argc, char **argv) static void update_mac_address(struct rte_mbuf *m, unsigned dst_port) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/lib/librte_ethdev/rte_class_eth.c b/lib/librte_ethdev/rte_class_eth.c index cb99c92ec..e554668da 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/rte_class_eth.c @@ -44,7 +44,7 @@ eth_mac_cmp(const char *key __rte_unused, const char *value, void *opaque) { int ret; - struct ether_addr mac; + struct rte_ether_addr mac; const struct rte_eth_dev_data *data = opaque; struct rte_eth_dev_info dev_info; uint32_t index; diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h index b3416341b..dc4e5af3e 100644 --- a/lib/librte_ethdev/rte_eth_ctrl.h +++ b/lib/librte_ethdev/rte_eth_ctrl.h @@ -110,7 +110,7 @@ struct rte_eth_mac_filter { uint8_t is_vf; /**< 1 for VF, 0 for port dev */ uint16_t dst_id; /**< VF ID, available when is_vf is 1*/ enum rte_mac_filter_type filter_type; /**< MAC filter type */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; /** @@ -126,7 +126,7 @@ struct rte_eth_mac_filter { * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. */ struct rte_eth_ethertype_filter { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ uint16_t ether_type; /**< Ether type to match */ uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ uint16_t queue; /**< Queue assigned to when match*/ @@ -266,8 +266,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ /** Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP @@ -474,7 +474,7 @@ struct rte_eth_sctpv6_flow { * A structure used to define the input for MAC VLAN flow */ struct rte_eth_mac_vlan_flow { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** @@ -494,7 +494,7 @@ struct rte_eth_tunnel_flow { enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */ /** Tunnel ID to match. TNI, VNI... in big endian. */ uint32_t tunnel_id; - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 243beb4dd..e5fc7ffdf 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1343,7 +1343,7 @@ static void rte_eth_dev_mac_restore(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { - struct ether_addr *addr; + struct rte_ether_addr *addr; uint16_t i; uint32_t pool = 0; uint64_t pool_mask; @@ -2588,7 +2588,7 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask, } void -rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr) +rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; @@ -3075,7 +3075,7 @@ rte_eth_led_off(uint16_t port_id) * an empty spot. */ static int -get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) +get_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3091,10 +3091,10 @@ get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) return -1; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; int -rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr, +rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, uint32_t pool) { struct rte_eth_dev *dev; @@ -3147,7 +3147,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr, } int -rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr) +rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr) { struct rte_eth_dev *dev; int index; @@ -3178,7 +3178,7 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr) } int -rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) +rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) { struct rte_eth_dev *dev; int ret; @@ -3207,7 +3207,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) * an empty spot. */ static int -get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) +get_hash_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3226,7 +3226,7 @@ get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) } int -rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on) { int index; @@ -4063,7 +4063,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct rte_eth_dev *dev; diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 40a068fe8..fd8366043 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2264,7 +2264,7 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, * A pointer to a structure of type *ether_addr* to be filled with * the Ethernet address of the Ethernet device. */ -void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr); +void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Retrieve the contextual information of an Ethernet device. @@ -2977,7 +2977,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, * - (-ENOSPC) if no more MAC addresses can be added. * - (-EINVAL) if MAC address is invalid. */ -int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, +int rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool); /** @@ -2993,7 +2993,7 @@ int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, * - (-ENODEV) if *port* invalid. * - (-EADDRINUSE) if attempting to remove the default MAC address */ -int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); +int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Set the default MAC address. @@ -3009,7 +3009,7 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); * - (-EINVAL) if MAC address is invalid. */ int rte_eth_dev_default_mac_addr_set(uint16_t port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device. @@ -3071,7 +3071,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port_id, * - (-EIO) if device is removed. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on); /** @@ -3614,7 +3614,7 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id, * - (-ENOSPC) if *port_id* has not enough multicast filtering resources. */ int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /** diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 8f03f83f6..e0191cb09 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -250,17 +250,17 @@ typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); /**< @internal Remove MAC address from receive address register */ typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint8_t on); /**< @internal Set a Unicast Hash bitmap */ @@ -292,7 +292,7 @@ typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, /**< @internal Delete tunneling UDP port */ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /**< @internal set the list of multicast addresses on an Ethernet device */ @@ -597,13 +597,13 @@ struct rte_eth_dev_data { /**< Common RX buffer size handled by all queues. */ uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */ - struct ether_addr *mac_addrs; + struct rte_ether_addr *mac_addrs; /**< Device Ethernet link address. * @see rte_eth_dev_release_port() */ uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR]; /**< Bitmap associating MAC addresses to pools. */ - struct ether_addr *hash_mac_addrs; + struct rte_ether_addr *hash_mac_addrs; /**< Device Ethernet MAC addresses of hash filtering. * @see rte_eth_dev_release_port() */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index c0fe87924..958a8e77c 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -585,8 +585,8 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = { * same order as on the wire. */ struct rte_flow_item_eth { - struct ether_addr dst; /**< Destination MAC. */ - struct ether_addr src; /**< Source MAC. */ + struct rte_ether_addr dst; /**< Destination MAC. */ + struct rte_ether_addr src; /**< Source MAC. */ rte_be16_t type; /**< EtherType or TPID. */ }; @@ -982,9 +982,9 @@ struct rte_flow_item_arp_eth_ipv4 { uint8_t hln; /**< Hardware address length, normally 6. */ uint8_t pln; /**< Protocol address length, normally 4. */ rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ - struct ether_addr sha; /**< Sender hardware address. */ + struct rte_ether_addr sha; /**< Sender hardware address. */ rte_be32_t spa; /**< Sender IPv4 address. */ - struct ether_addr tha; /**< Target hardware address. */ + struct rte_ether_addr tha; /**< Target hardware address. */ rte_be32_t tpa; /**< Target IPv4 address. */ }; @@ -1128,7 +1128,7 @@ rte_flow_item_icmp6_nd_opt_mask = { struct rte_flow_item_icmp6_nd_opt_sla_eth { uint8_t type; /**< ND option type, normally 1. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr sla; /**< Source Ethernet LLA. */ + struct rte_ether_addr sla; /**< Source Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */ @@ -1153,7 +1153,7 @@ rte_flow_item_icmp6_nd_opt_sla_eth_mask = { struct rte_flow_item_icmp6_nd_opt_tla_eth { uint8_t type; /**< ND option type, normally 2. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr tla; /**< Target Ethernet LLA. */ + struct rte_ether_addr tla; /**< Target Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index 8d178be15..d248f387f 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -614,8 +614,8 @@ static inline void rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, struct ipv6_hdr **ipv6_hdr) { - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); - struct vlan_hdr *vlan_hdr; + struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); + struct rte_vlan_hdr *vlan_hdr; *ipv4_hdr = NULL; *ipv6_hdr = NULL; @@ -630,7 +630,7 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, break; case RTE_BE16(ETHER_TYPE_VLAN): - vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(ETHER_TYPE_IPv4): *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 7d128a431..284219517 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -194,7 +194,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, struct gro_tcp4_tbl *tbl, uint64_t start_time) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; @@ -215,7 +215,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, if (unlikely(INVALID_TCP_HDRLEN(pkt->l4_len))) return -1; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index d97924883..988cca8c6 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -24,8 +24,8 @@ /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { - struct ether_addr eth_saddr; - struct ether_addr eth_daddr; + struct rte_ether_addr eth_saddr; + struct rte_ether_addr eth_daddr; uint32_t ip_src_addr; uint32_t ip_dst_addr; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index acb9bc919..d713e3dd6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -289,11 +289,11 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, struct gro_vxlan_tcp4_tbl *tbl, uint64_t start_time) { - struct ether_hdr *outer_eth_hdr, *eth_hdr; + struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; - struct vxlan_hdr *vxlan_hdr; + struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; int32_t tcp_dl; uint16_t frag_off, outer_ip_id, ip_id; @@ -313,15 +313,15 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, if (unlikely(INVALID_TCP_HDRLEN(pkt->l4_len))) return -1; - outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); - vxlan_hdr = (struct vxlan_hdr *)((char *)udp_hdr + + vxlan_hdr = (struct rte_vxlan_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr)); - eth_hdr = (struct ether_hdr *)((char *)vxlan_hdr + - sizeof(struct vxlan_hdr)); + eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); diff --git a/lib/librte_gro/gro_vxlan_tcp4.h b/lib/librte_gro/gro_vxlan_tcp4.h index 0cafb9211..7832942a6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.h +++ b/lib/librte_gro/gro_vxlan_tcp4.h @@ -12,10 +12,10 @@ /* Header fields representing a VxLAN flow */ struct vxlan_tcp4_flow_key { struct tcp4_flow_key inner_key; - struct vxlan_hdr vxlan_hdr; + struct rte_vxlan_hdr vxlan_hdr; - struct ether_addr outer_eth_saddr; - struct ether_addr outer_eth_daddr; + struct rte_ether_addr outer_eth_saddr; + struct rte_ether_addr outer_eth_daddr; uint32_t outer_ip_src_addr; uint32_t outer_ip_dst_addr; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index a626a11e3..433f2c8bb 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -18,11 +18,11 @@ extern "C" { #include <rte_mbuf.h> /* Minimum GSO segment size for TCP based packets. */ -#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ +#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ -#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ +#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 946459c79..d0975eda8 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -451,7 +451,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) RTE_LOG(INFO, KNI, "Configure mac address of %d", port_id); ret = rte_eth_dev_default_mac_addr_set(port_id, - (struct ether_addr *)mac_addr); + (struct rte_ether_addr *)mac_addr); if (ret < 0) RTE_LOG(ERR, KNI, "Failed to config mac_addr for port %d\n", port_id); diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 877874a5e..921adb4cf 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -9,9 +9,9 @@ #define RARP_PKT_SIZE 64 struct rte_mbuf * __rte_experimental rte_net_make_rarp_packet(struct rte_mempool *mpool, - const struct ether_addr *mac) + const struct rte_ether_addr *mac) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *rarp; struct rte_mbuf *mbuf; @@ -22,7 +22,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, if (mbuf == NULL) return NULL; - eth_hdr = (struct ether_hdr *)rte_pktmbuf_append(mbuf, RARP_PKT_SIZE); + eth_hdr = (struct rte_ether_hdr *)rte_pktmbuf_append(mbuf, RARP_PKT_SIZE); if (eth_hdr == NULL) { rte_pktmbuf_free(mbuf); return NULL; diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index a94fa6a00..f17c52972 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -22,9 +22,9 @@ extern "C" { * ARP header IPv4 payload. */ struct rte_arp_ipv4 { - struct ether_addr arp_sha; /**< sender hardware address */ + struct rte_ether_addr arp_sha; /**< sender hardware address */ uint32_t arp_sip; /**< sender IP address */ - struct ether_addr arp_tha; /**< target hardware address */ + struct rte_ether_addr arp_tha; /**< target hardware address */ uint32_t arp_tip; /**< target IP address */ } __attribute__((__packed__)); @@ -65,7 +65,7 @@ struct rte_arp_hdr { */ struct rte_mbuf * __rte_experimental rte_net_make_rarp_packet(struct rte_mempool *mpool, - const struct ether_addr *mac); + const struct rte_ether_addr *mac); #ifdef __cplusplus } diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 3a87ff184..afdbaa1a7 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -54,7 +54,7 @@ extern "C" { * administrator and does not contain OUIs. * See http://standards.ieee.org/regauth/groupmac/tutorial.html */ -struct ether_addr { +struct rte_ether_addr { uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ } __attribute__((__packed__)); @@ -75,8 +75,8 @@ struct ether_addr { * True (1) if the given two ethernet address are the same; * False (0) otherwise. */ -static inline int is_same_ether_addr(const struct ether_addr *ea1, - const struct ether_addr *ea2) +static inline int 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++) @@ -95,7 +95,7 @@ static inline int is_same_ether_addr(const struct ether_addr *ea1, * True (1) if the given ethernet address is filled with zeros; * false (0) otherwise. */ -static inline int is_zero_ether_addr(const struct ether_addr *ea) +static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -114,7 +114,7 @@ static inline int is_zero_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a unicast address; * false (0) otherwise. */ -static inline int is_unicast_ether_addr(const struct ether_addr *ea) +static inline int is_unicast_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_GROUP_ADDR) == 0; } @@ -129,7 +129,7 @@ static inline int is_unicast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a multicast address; * false (0) otherwise. */ -static inline int is_multicast_ether_addr(const struct ether_addr *ea) +static inline int is_multicast_ether_addr(const struct rte_ether_addr *ea) { return ea->addr_bytes[0] & ETHER_GROUP_ADDR; } @@ -144,7 +144,7 @@ static inline int is_multicast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a broadcast address; * false (0) otherwise. */ -static inline int is_broadcast_ether_addr(const struct ether_addr *ea) +static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) { const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; @@ -162,7 +162,7 @@ static inline int is_broadcast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a universally assigned address; * false (0) otherwise. */ -static inline int is_universal_ether_addr(const struct ether_addr *ea) +static inline int is_universal_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) == 0; } @@ -177,7 +177,7 @@ static inline int is_universal_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a locally assigned address; * false (0) otherwise. */ -static inline int is_local_admin_ether_addr(const struct ether_addr *ea) +static inline int is_local_admin_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) != 0; } @@ -193,7 +193,7 @@ static inline int is_local_admin_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is valid; * false (0) otherwise. */ -static inline int is_valid_assigned_ether_addr(const struct ether_addr *ea) +static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) { return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); } @@ -222,8 +222,8 @@ static inline void eth_random_addr(uint8_t *addr) * @param ea_to * A pointer to a ether_addr structure where to copy the Ethernet address. */ -static inline void ether_addr_copy(const struct ether_addr *ea_from, - struct ether_addr *ea_to) +static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { #ifdef __INTEL_COMPILER uint16_t *from_words = (uint16_t *)(ea_from->addr_bytes); @@ -253,7 +253,7 @@ static inline void ether_addr_copy(const struct ether_addr *ea_from, */ static inline void ether_format_addr(char *buf, uint16_t size, - const struct ether_addr *eth_addr) + const struct rte_ether_addr *eth_addr) { snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", eth_addr->addr_bytes[0], @@ -268,9 +268,9 @@ ether_format_addr(char *buf, uint16_t size, * Ethernet header: Contains the destination address, source address * and frame type. */ -struct ether_hdr { - struct ether_addr d_addr; /**< Destination address. */ - struct ether_addr s_addr; /**< Source address. */ +struct rte_ether_hdr { + struct rte_ether_addr d_addr; /**< Destination address. */ + struct rte_ether_addr s_addr; /**< Source address. */ uint16_t ether_type; /**< Frame type. */ } __attribute__((__packed__)); @@ -279,7 +279,7 @@ struct ether_hdr { * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type * of the encapsulated frame. */ -struct vlan_hdr { +struct rte_vlan_hdr { uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */ uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */ } __attribute__((__packed__)); @@ -289,7 +289,7 @@ struct vlan_hdr { * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and * Reserved fields (24 bits and 8 bits) */ -struct vxlan_hdr { +struct rte_vxlan_hdr { uint32_t vx_flags; /**< flag (8) + Reserved (24). */ uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ } __attribute__((__packed__)); @@ -311,7 +311,7 @@ struct vxlan_hdr { #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 vxlan_hdr)) +#define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -319,7 +319,7 @@ struct vxlan_hdr { * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network * Identifier and Reserved fields (16 bits and 8 bits). */ -struct vxlan_gpe_hdr { +struct rte_vxlan_gpe_hdr { uint8_t vx_flags; /**< flag (8). */ uint8_t reserved[2]; /**< Reserved (16). */ uint8_t proto; /**< next-protocol (8). */ @@ -336,7 +336,7 @@ struct vxlan_gpe_hdr { #define VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ #define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \ - sizeof(struct vxlan_gpe_hdr)) + sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ /** @@ -352,19 +352,19 @@ struct vxlan_gpe_hdr { */ static inline int rte_vlan_strip(struct rte_mbuf *m) { - struct ether_hdr *eh - = rte_pktmbuf_mtod(m, struct ether_hdr *); - struct vlan_hdr *vh; + struct rte_ether_hdr *eh + = 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)) return -1; - vh = (struct vlan_hdr *)(eh + 1); + vh = (struct rte_vlan_hdr *)(eh + 1); m->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci); /* Copy ether header over rather than moving whole packet */ - memmove(rte_pktmbuf_adj(m, sizeof(struct vlan_hdr)), + memmove(rte_pktmbuf_adj(m, sizeof(struct rte_vlan_hdr)), eh, 2 * ETHER_ADDR_LEN); return 0; @@ -384,8 +384,8 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) */ static inline int rte_vlan_insert(struct rte_mbuf **m) { - struct ether_hdr *oh, *nh; - struct vlan_hdr *vh; + struct rte_ether_hdr *oh, *nh; + struct rte_vlan_hdr *vh; /* Can't insert header if mbuf is shared */ if (rte_mbuf_refcnt_read(*m) > 1) { @@ -398,16 +398,16 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) *m = copy; } - oh = rte_pktmbuf_mtod(*m, struct ether_hdr *); - nh = (struct ether_hdr *) - rte_pktmbuf_prepend(*m, sizeof(struct vlan_hdr)); + oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *); + nh = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(*m, sizeof(struct rte_vlan_hdr)); if (nh == NULL) return -ENOSPC; memmove(nh, oh, 2 * ETHER_ADDR_LEN); nh->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); - vh = (struct vlan_hdr *) (nh + 1); + vh = (struct rte_vlan_hdr *) (nh + 1); vh->vlan_tci = rte_cpu_to_be_16((*m)->vlan_tci); (*m)->ol_flags &= ~(PKT_RX_VLAN_STRIPPED | PKT_TX_VLAN); diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 378a4126c..315c37c55 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -229,8 +229,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, struct rte_net_hdr_lens *hdr_lens, uint32_t layers) { struct rte_net_hdr_lens local_hdr_lens; - const struct ether_hdr *eh; - struct ether_hdr eh_copy; + const struct rte_ether_hdr *eh; + struct rte_ether_hdr eh_copy; uint32_t pkt_type = RTE_PTYPE_L2_ETHER; uint32_t off = 0; uint16_t proto; @@ -253,8 +253,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, goto l3; /* fast path if packet is IPv4 */ if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type = RTE_PTYPE_L2_ETHER_VLAN; vh = rte_pktmbuf_read(m, off, sizeof(*vh), &vh_copy); @@ -264,8 +264,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l2_len += sizeof(*vh); proto = vh->eth_proto; } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type = RTE_PTYPE_L2_ETHER_QINQ; vh = rte_pktmbuf_read(m, off + sizeof(*vh), sizeof(*vh), @@ -402,8 +402,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type &= ~RTE_PTYPE_INNER_L2_MASK; pkt_type |= RTE_PTYPE_INNER_L2_ETHER_VLAN; @@ -414,8 +414,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l2_len += sizeof(*vh); proto = vh->eth_proto; } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type &= ~RTE_PTYPE_INNER_L2_MASK; pkt_type |= RTE_PTYPE_INNER_L2_ETHER_QINQ; diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 6712bb697..8841de64f 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -438,7 +438,7 @@ encap_cfg_check(struct rte_table_action_encap_config *encap) } struct encap_ether_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; } __attribute__((__packed__)); #define VLAN(pcp, dei, vid) \ @@ -447,14 +447,14 @@ struct encap_ether_data { (((uint64_t)(vid)) & 0xFFFLLU)) \ struct encap_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; } __attribute__((__packed__)); struct encap_qinq_data { - struct ether_hdr ether; - struct vlan_hdr svlan; - struct vlan_hdr cvlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr svlan; + struct rte_vlan_hdr cvlan; } __attribute__((__packed__)); #define ETHER_TYPE_MPLS_UNICAST 0x8847 @@ -468,7 +468,7 @@ struct encap_qinq_data { (((uint64_t)(ttl)) & 0xFFLLU))) struct encap_mpls_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX]; uint32_t mpls_count; } __attribute__((__packed__)); @@ -483,46 +483,46 @@ struct pppoe_ppp_hdr { } __attribute__((__packed__)); struct encap_pppoe_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct pppoe_ppp_hdr pppoe_ppp; } __attribute__((__packed__)); #define IP_PROTO_UDP 17 struct encap_vxlan_ipv4_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct ipv4_hdr ipv4; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv4_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; struct ipv4_hdr ipv4; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct ipv6_hdr ipv6; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; struct ipv6_hdr ipv6; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_qinq_pppoe_data { - struct ether_hdr ether; - struct vlan_hdr svlan; - struct vlan_hdr cvlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr svlan; + struct rte_vlan_hdr cvlan; struct pppoe_ppp_hdr pppoe_ppp; } __attribute__((__packed__)); @@ -997,13 +997,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + sizeof(struct ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1027,13 +1027,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + sizeof(struct ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1057,10 +1057,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1083,10 +1083,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1133,7 +1133,7 @@ pkt_work_encap(struct rte_mbuf *mbuf, case 1LLU << RTE_TABLE_ACTION_ENCAP_MPLS: { struct encap_mpls_data *mpls = data; - size_t size = sizeof(struct ether_hdr) + + size_t size = sizeof(struct rte_ether_hdr) + mpls->mpls_count * 4; encap(ip, data, size); diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index 53d16af8a..e88dd49e7 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -387,8 +387,8 @@ enum rte_table_action_encap_type { /** Pre-computed Ethernet header fields for encapsulation action. */ struct rte_table_action_ether_hdr { - struct ether_addr da; /**< Destination address. */ - struct ether_addr sa; /**< Source address. */ + struct rte_ether_addr da; /**< Destination address. */ + struct rte_ether_addr sa; /**< Source address. */ }; /** Pre-computed VLAN header fields for encapsulation action. */ diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index e9138dfab..d49c3b8a9 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -308,7 +308,7 @@ struct virtio_net { uint64_t log_size; uint64_t log_base; uint64_t log_addr; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t mtu; struct vhost_device_ops const *notify_ops; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index a6a33a101..a71cf0cf7 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -969,18 +969,18 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t ethertype; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); - m->l2_len += sizeof(struct vlan_hdr); + m->l2_len += sizeof(struct rte_vlan_hdr); ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); } -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 04/14] net: add rte prefix to ether functions 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (3 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 03/14] net: add rte prefix to ether structures Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines Olivier Matz ` (11 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to functions: - rename is_same_ether_addr() as rte_is_same_ether_addr(). - rename is_zero_ether_addr() as rte_is_zero_ether_addr(). - rename is_unicast_ether_addr() as rte_is_unicast_ether_addr(). - rename is_multicast_ether_addr() as rte_is_multicast_ether_addr(). - rename is_broadcast_ether_addr() as rte_is_broadcast_ether_addr(). - rename is_universal_ether_addr() as rte_is_universal_ether_addr(). - rename is_local_admin_ether_addr() as rte_is_local_admin_ether_addr(). - rename is_valid_assigned_ether_addr() as rte_is_valid_assigned_ether_addr(). - rename eth_random_addr() as rte_eth_random_addr(). - rename ether_addr_copy() as rte_ether_addr_copy(). - rename ether_format_addr() as rte_ether_format_addr(). Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/cmdline.c | 6 ++-- app/test-pmd/config.c | 8 ++--- app/test-pmd/csumonly.c | 4 +-- app/test-pmd/flowgen.c | 4 +-- app/test-pmd/icmpecho.c | 22 ++++++------ app/test-pmd/ieee1588fwd.c | 6 ++-- app/test-pmd/macfwd.c | 4 +-- app/test-pmd/macswap.h | 6 ++-- app/test-pmd/txonly.c | 4 +-- app/test-pmd/util.c | 2 +- app/test/packet_burst_generator.c | 8 ++--- app/test/test_link_bonding.c | 14 ++++---- app/test/test_link_bonding_mode4.c | 26 +++++++------- app/test/test_pmd_perf.c | 2 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 4 +-- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 2 +- .../sample_app_ug/l2_forward_real_virtual.rst | 2 +- doc/guides/sample_app_ug/link_status_intr.rst | 2 +- drivers/net/atlantic/atl_ethdev.c | 2 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 4 +-- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 2 +- drivers/net/avp/avp_ethdev.c | 6 ++-- drivers/net/axgbe/axgbe_ethdev.c | 6 ++-- drivers/net/bnx2x/bnx2x.c | 4 +-- drivers/net/bnx2x/bnx2x_vfpf.c | 6 ++-- drivers/net/bnxt/bnxt_flow.c | 12 +++---- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 20 +++++------ drivers/net/bonding/rte_eth_bond_alb.c | 26 +++++++------- drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++----- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 4 +-- drivers/net/dpaa/dpaa_ethdev.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 8 ++--- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 8 ++--- drivers/net/e1000/igb_flow.c | 8 ++--- drivers/net/e1000/igb_pf.c | 6 ++-- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enetc/enetc_ethdev.c | 2 +- drivers/net/enic/enic_ethdev.c | 12 +++---- drivers/net/enic/enic_main.c | 2 +- drivers/net/failsafe/failsafe.c | 4 +-- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 12 +++---- drivers/net/i40e/i40e_ethdev.c | 38 ++++++++++---------- drivers/net/i40e/i40e_ethdev_vf.c | 16 ++++----- drivers/net/i40e/i40e_flow.c | 24 ++++++------- drivers/net/i40e/i40e_pf.c | 6 ++-- drivers/net/i40e/rte_pmd_i40e.c | 10 +++--- drivers/net/iavf/iavf_ethdev.c | 14 ++++---- drivers/net/iavf/iavf_vchnl.c | 4 +-- drivers/net/ice/ice_ethdev.c | 12 +++---- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++--- drivers/net/ixgbe/ixgbe_flow.c | 8 ++--- drivers/net/ixgbe/ixgbe_pf.c | 4 +-- drivers/net/ixgbe/rte_pmd_ixgbe.c | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/mlx4/mlx4_flow.c | 2 +- drivers/net/mlx5/mlx5_flow_tcf.c | 4 +-- drivers/net/mlx5/mlx5_mac.c | 4 +-- drivers/net/mlx5/mlx5_nl.c | 6 ++-- drivers/net/mvneta/mvneta_ethdev.c | 6 ++-- drivers/net/mvpp2/mrvl_ethdev.c | 6 ++-- drivers/net/netvsc/hn_rxtx.c | 4 +-- drivers/net/netvsc/hn_vf.c | 2 +- drivers/net/nfp/nfp_net.c | 6 ++-- drivers/net/null/rte_eth_null.c | 2 +- drivers/net/qede/qede_ethdev.c | 26 +++++++------- drivers/net/sfc/sfc_ethdev.c | 6 ++-- drivers/net/sfc/sfc_flow.c | 10 +++--- drivers/net/sfc/sfc_port.c | 2 +- drivers/net/softnic/rte_eth_softnic_flow.c | 4 +-- drivers/net/szedata2/rte_eth_szedata2.c | 2 +- drivers/net/tap/rte_eth_tap.c | 10 +++--- drivers/net/tap/tap_flow.c | 4 +-- drivers/net/thunderx/base/nicvf_mbox.c | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 6 ++-- drivers/net/vdev_netvsc/vdev_netvsc.c | 4 +-- drivers/net/vhost/rte_eth_vhost.c | 4 +-- drivers/net/virtio/virtio_ethdev.c | 10 +++--- drivers/net/virtio/virtio_rxtx.c | 4 +-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +-- examples/bond/main.c | 8 ++--- examples/ethtool/ethtool-app/main.c | 4 +-- examples/ethtool/lib/rte_ethtool.c | 2 +- examples/eventdev_pipeline/pipeline_common.h | 4 +-- examples/flow_filtering/main.c | 2 +- examples/ip_fragmentation/main.c | 4 +-- examples/ip_reassembly/main.c | 4 +-- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/ipv4_multicast/main.c | 6 ++-- examples/kni/main.c | 2 +- examples/l2fwd-crypto/main.c | 2 +- examples/l2fwd-jobstats/main.c | 2 +- examples/l2fwd-keepalive/main.c | 2 +- examples/l2fwd/main.c | 2 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 6 ++-- examples/l3fwd-vf/main.c | 4 +-- examples/l3fwd/l3fwd_em.h | 4 +-- examples/l3fwd/l3fwd_lpm.h | 4 +-- examples/l3fwd/main.c | 4 +-- examples/link_status_interrupt/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 40 +++++++++++----------- examples/ptpclient/ptpclient.c | 2 +- examples/quota_watermark/qw/main.c | 2 +- examples/tep_termination/vxlan_setup.c | 14 ++++---- examples/vhost/main.c | 4 +-- examples/vmdq/main.c | 2 +- examples/vmdq_dcb/main.c | 2 +- lib/librte_ethdev/rte_class_eth.c | 2 +- lib/librte_ethdev/rte_ethdev.c | 20 +++++------ lib/librte_gro/gro_tcp4.c | 8 ++--- lib/librte_gro/gro_tcp4.h | 4 +-- lib/librte_gro/gro_vxlan_tcp4.c | 20 +++++------ lib/librte_net/rte_arp.c | 6 ++-- lib/librte_net/rte_ether.h | 24 ++++++------- lib/librte_pipeline/rte_table_action.c | 40 +++++++++++----------- 120 files changed, 430 insertions(+), 430 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 032807378..b2c2b60dd 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -8720,8 +8720,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); - ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); - ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { @@ -12379,7 +12379,7 @@ static void cmd_mcast_addr_parsed(void *parsed_result, { struct cmd_mcast_addr_result *res = parsed_result; - if (!is_multicast_ether_addr(&res->mc_addr)) { + if (!rte_is_multicast_ether_addr(&res->mc_addr)) { printf("Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n", res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1], res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3], diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 83b9df103..01a19d8e8 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -111,7 +111,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3535,7 +3535,7 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) * in the pool of multicast addresses. */ for (i = 0; i < port->mc_addr_nb; i++) { - if (is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) { + if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) { printf("multicast address already filtered by port\n"); return; } @@ -3543,7 +3543,7 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) if (mcast_addr_pool_extend(port) != 0) return; - ether_addr_copy(mc_addr, &port->mc_addr_pool[i]); + rte_ether_addr_copy(mc_addr, &port->mc_addr_pool[i]); eth_port_multicast_addr_list_set(port_id); } @@ -3562,7 +3562,7 @@ mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr) * Search the pool of multicast MAC addresses for the removed address. */ for (i = 0; i < port->mc_addr_nb; i++) { - if (is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) + if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) break; } if (i == port->mc_addr_nb) { diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 1a7db7f0e..e052c7eb5 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -766,9 +766,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) * and inner headers */ eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); parse_ethernet(eth_hdr, &info); l3_hdr = (char *)eth_hdr + info.l2_len; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 7c6ad4b3c..69a3b5050 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -171,8 +171,8 @@ pkt_burst_flow_gen(struct fwd_stream *fs) /* Initialize Ethernet header. */ eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); - ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); + 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); /* Initialize IP header. */ diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 49720ad41..879f6283d 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -225,7 +225,7 @@ ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); if (what) printf("%s", what); printf("%s", buf); @@ -370,12 +370,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) continue; } if (verbose_level > 0) { - ether_addr_copy(&arp_h->arp_data.arp_sha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_sha, ð_addr); ether_addr_dump(" sha=", ð_addr); ip_addr = arp_h->arp_data.arp_sip; ipv4_addr_dump(" sip=", ip_addr); printf("\n"); - ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_dump(" tha=", ð_addr); ip_addr = arp_h->arp_data.arp_tip; ipv4_addr_dump(" tip=", ip_addr); @@ -391,15 +391,15 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) */ /* Use source MAC address as destination MAC address. */ - ether_addr_copy(ð_h->s_addr, ð_h->d_addr); + rte_ether_addr_copy(ð_h->s_addr, ð_h->d_addr); /* Set source MAC address with MAC address of TX port */ - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); - ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); - ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); - ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); + rte_ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); + rte_ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); /* Swap IP addresses in ARP payload */ ip_addr = arp_h->arp_data.arp_sip; @@ -456,9 +456,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ - ether_addr_copy(ð_h->s_addr, ð_addr); - ether_addr_copy(ð_h->d_addr, ð_h->s_addr); - ether_addr_copy(ð_addr, ð_h->d_addr); + rte_ether_addr_copy(ð_h->s_addr, ð_addr); + rte_ether_addr_copy(ð_h->d_addr, ð_h->s_addr); + rte_ether_addr_copy(ð_addr, ð_h->d_addr); ip_addr = ip_h->src_addr; if (is_multicast_ipv4_addr(ip_h->dst_addr)) { uint32_t ip_src; diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index c6aa3c618..2b7003be4 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -178,9 +178,9 @@ ieee1588_packet_fwd(struct fwd_stream *fs) port_ieee1588_rx_timestamp_check(fs->rx_port, timesync_index); /* Swap dest and src mac addresses. */ - ether_addr_copy(ð_hdr->d_addr, &addr); - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - ether_addr_copy(&addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->d_addr, &addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&addr, ð_hdr->s_addr); /* Forward PTP packet with hardware TX timestamp */ mb->ol_flags |= PKT_TX_IEEE1588_TMST; diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 631f86f3e..f15149252 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -92,9 +92,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs) void *)); mb = pkts_burst[i]; eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; diff --git a/app/test-pmd/macswap.h b/app/test-pmd/macswap.h index d53e5d482..013844156 100644 --- a/app/test-pmd/macswap.h +++ b/app/test-pmd/macswap.h @@ -29,9 +29,9 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ - ether_addr_copy(ð_hdr->d_addr, &addr); - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - ether_addr_copy(&addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->d_addr, &addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&addr, ð_hdr->s_addr); mbuf_field_set(mb, ol_flags); } diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index c4e891a13..3e3ead9fb 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -264,8 +264,8 @@ pkt_burst_transmit(struct fwd_stream *fs) /* * Initialize Ethernet header. */ - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); + 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); if (rte_mempool_get_bulk(mbp, (void **)pkts_burst, diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 0544b8e53..55f3844dd 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -17,7 +17,7 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 51ab0db29..2ef5d15a5 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -57,8 +57,8 @@ initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_ struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id) { - ether_addr_copy(dst_mac, ð_hdr->d_addr); - ether_addr_copy(src_mac, ð_hdr->s_addr); + rte_ether_addr_copy(dst_mac, ð_hdr->d_addr); + rte_ether_addr_copy(src_mac, ð_hdr->s_addr); if (vlan_enabled) { struct rte_vlan_hdr *vhdr = (struct rte_vlan_hdr *)((uint8_t *)eth_hdr + @@ -83,9 +83,9 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma arp_hdr->arp_hlen = ETHER_ADDR_LEN; arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); - ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = src_ip; - ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); + rte_ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = dst_ip; } diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 25276715a..00ddb0efe 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4482,7 +4482,7 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); @@ -4549,12 +4549,12 @@ test_alb_change_mac_in_reply_sent(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { - if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } @@ -4595,7 +4595,7 @@ test_alb_reply_from_client(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); @@ -4670,12 +4670,12 @@ test_alb_reply_from_client(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { - if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } @@ -4722,7 +4722,7 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 63fcafaea..f5ac6c99f 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -232,7 +232,7 @@ add_slave(struct slave_conf *slave, uint8_t start) RTE_VERIFY(slave->bonded == 0); RTE_VERIFY(slave->port_id != INVALID_PORT_ID); - ether_addr_copy(&slave_mac_default, &addr); + rte_ether_addr_copy(&slave_mac_default, &addr); addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; rte_eth_dev_mac_addr_remove(slave->port_id, &addr); @@ -253,7 +253,7 @@ add_slave(struct slave_conf *slave, uint8_t start) } rte_eth_macaddr_get(slave->port_id, &addr_check); - TEST_ASSERT_EQUAL(is_same_ether_addr(&addr, &addr_check), 1, + TEST_ASSERT_EQUAL(rte_is_same_ether_addr(&addr, &addr_check), 1, "Slave MAC address is not as expected"); RTE_VERIFY(slave->lacp_parnter_state == 0); @@ -491,7 +491,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *); /* Change source address to partner address */ - ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr); + 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; lacp = (struct lacpdu *) &slow_hdr->slow_protocol; @@ -503,7 +503,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) lacp->partner.state = lacp->actor.state; - ether_addr_copy(&parnter_system, &lacp->actor.port_params.system); + rte_ether_addr_copy(&parnter_system, &lacp->actor.port_params.system); lacp->actor.state = STATE_LACP_ACTIVE | STATE_SYNCHRONIZATION | STATE_AGGREGATION | @@ -810,7 +810,7 @@ test_mode4_rx(void) TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac); - ether_addr_copy(&bonded_mac, &dst_mac); + rte_ether_addr_copy(&bonded_mac, &dst_mac); /* Assert that dst address is not bonding address. Do not set the * least significant bit of the zero byte as this would create a @@ -845,7 +845,7 @@ test_mode4_rx(void) for (i = 0; i < expected_pkts_cnt; i++) { hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); - cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; + cnt[rte_is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; } free_pkts(pkts, expected_pkts_cnt); @@ -889,7 +889,7 @@ test_mode4_rx(void) for (i = 0; i < expected_pkts_cnt; i++) { hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); - eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac); + eq_cnt += rte_is_same_ether_addr(&hdr->d_addr, &bonded_mac); } free_pkts(pkts, expected_pkts_cnt); @@ -1130,10 +1130,10 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) struct marker_header *); /* Copy multicast destination address */ - ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr); + rte_ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr); /* Init source address */ - ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr); + 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.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW); @@ -1358,8 +1358,8 @@ test_mode4_ext_ctrl(void) }, }; - ether_addr_copy(&parnter_system, &src_mac); - ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); + rte_ether_addr_copy(&parnter_system, &src_mac); + 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); @@ -1412,8 +1412,8 @@ test_mode4_ext_lacp(void) }, }; - ether_addr_copy(&parnter_system, &src_mac); - ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); + rte_ether_addr_copy(&parnter_system, &src_mac); + 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); diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index b85da914c..a0c3eb956 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -174,7 +174,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 1fe6bf113..0b44ab90b 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -227,8 +227,8 @@ The actual packet transmission is done in the mcast_send_pkt() function: RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_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); /* Put new packet into the output queue */ diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index 02c1367f5..8d0c38721 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -467,7 +467,7 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); l2fwd_send_packet(m, (uint8_t) dst_port); } diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index 54e5b8022..bede06ed1 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -383,7 +383,7 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); l2fwd_send_packet(m, (uint8_t) dst_port); } diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index 3fd043e82..cfb1bcd58 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -324,7 +324,7 @@ The processing is very simple: processes the TX port from the RX port and then r *((uint64_t *)tmp) = 0x000000000002 + (dst_port << 40); /* src addr */ - ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); lsi_send_packet(m, dst_port); } diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 78039f882..f1df8e7fa 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -1238,7 +1238,7 @@ static int atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index __rte_unused, uint32_t pool __rte_unused) { - if (is_zero_ether_addr(mac_addr)) { + if (rte_is_zero_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); return -EINVAL; } diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c index e4a1da0be..8db38426b 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c @@ -656,7 +656,7 @@ static int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self, mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct rte_ether_addr *)mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mac_addr, (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { @@ -867,7 +867,7 @@ static int aq_fw1x_set_wol(struct aq_hw_s *self, bool wol_enabled, u8 *mac) prpc->msg_wol.pattern_id = 1U; prpc->msg_wol.wol_packet_type = 2U; /* Magic Packet */ - ether_addr_copy((struct rte_ether_addr *)mac, + rte_ether_addr_copy((struct rte_ether_addr *)mac, (struct rte_ether_addr *)&prpc->msg_wol.wol_pattern); } else { rpc_size = sizeof(prpc->msg_id) + sizeof(prpc->msg_del_id); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c index 9111be9f4..cddb5d632 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -222,7 +222,7 @@ int aq_fw2x_get_mac_permanent(struct aq_hw_s *self, u8 *mac) mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct rte_ether_addr *)mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mac_addr, (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 69a70d2cc..38e5eae05 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -1014,7 +1014,7 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev) } /* Get a mac from device config */ - ether_addr_copy(&avp->ethaddr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&avp->ethaddr, ð_dev->data->mac_addrs[0]); return 0; } @@ -1216,12 +1216,12 @@ _avp_mac_filter(struct avp_dev *avp, struct rte_mbuf *m) return 0; } - if (likely(is_broadcast_ether_addr(ð->d_addr))) { + if (likely(rte_is_broadcast_ether_addr(ð->d_addr))) { /* allow all broadcast packets */ return 0; } - if (likely(is_multicast_ether_addr(ð->d_addr))) { + if (likely(rte_is_multicast_ether_addr(ð->d_addr))) { /* allow all multicast packets */ return 0; } diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index e89c0ec2c..237b75c5d 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -634,11 +634,11 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } - if (!is_valid_assigned_ether_addr(&pdata->mac_addr)) - eth_random_addr(pdata->mac_addr.addr_bytes); + if (!rte_is_valid_assigned_ether_addr(&pdata->mac_addr)) + rte_eth_random_addr(pdata->mac_addr.addr_bytes); /* Copy the permanent MAC address */ - ether_addr_copy(&pdata->mac_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&pdata->mac_addr, ð_dev->data->mac_addrs[0]); /* Clock settings */ pdata->sysclk_rate = AXGBE_V2_DMA_CLOCK_FREQ; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 77a0f56b2..d83d3e686 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2194,8 +2194,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_parse_bd = &txq->tx_ring[TX_BD(bd_prod, txq)].parse_bd_e2; - if (is_multicast_ether_addr(&eh->d_addr)) { - if (is_broadcast_ether_addr(&eh->d_addr)) + if (rte_is_multicast_ether_addr(&eh->d_addr)) { + if (rte_is_broadcast_ether_addr(&eh->d_addr)) mac_type = BROADCAST_ADDRESS; else mac_type = MULTICAST_ADDRESS; diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index a044e6eac..67e3b54b1 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -300,11 +300,11 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ sc->igu_sb_cnt, sc->igu_base_sb); strncpy(sc->fw_ver, sc_resp.fw_ver, sizeof(sc->fw_ver)); - if (is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) - ether_addr_copy(&sc_resp.resc.current_mac_addr, + if (rte_is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) + rte_ether_addr_copy(&sc_resp.resc.current_mac_addr, (struct rte_ether_addr *)sc->link_params.mac_addr); else - eth_random_addr(sc->link_params.mac_addr); + rte_eth_random_addr(sc->link_params.mac_addr); out: bnx2x_vf_finalize(sc, &acq->first_tlv); diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 1afe67407..a1f527d4f 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -187,10 +187,10 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, * Destination MAC address mask must not be partially * set. Should be all 1's or all 0's. */ - if ((!is_zero_ether_addr(ð_mask->src) && - !is_broadcast_ether_addr(ð_mask->src)) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if ((!rte_is_zero_ether_addr(ð_mask->src) && + !rte_is_broadcast_ether_addr(ð_mask->src)) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -209,7 +209,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, return -rte_errno; } - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { rte_memcpy(filter->dst_macaddr, ð_spec->dst, 6); en |= use_ntuple ? @@ -217,7 +217,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, EM_FLOW_ALLOC_INPUT_EN_DST_MACADDR; } - if (is_broadcast_ether_addr(ð_mask->src)) { + if (rte_is_broadcast_ether_addr(ð_mask->src)) { rte_memcpy(filter->src_macaddr, ð_spec->src, 6); en |= use_ntuple ? diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 59e75b0be..e2fe4f7a0 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2586,7 +2586,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, if (memcmp(mac.addr_bytes, "\x00\x00\x00\x00\x00", 6) == 0) { cfg_req->enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_MAC_ADDR); - eth_random_addr(cfg_req->dflt_mac_addr); + 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); diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 51bf3f52e..7a775cd0c 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -322,7 +322,7 @@ rx_machine(struct bond_dev_private *internals, uint16_t slave_id, agg = &bond_mode_8023ad_ports[port->aggregator_port_id]; bool match = port->actor.system_priority == lacp->partner.port_params.system_priority && - is_same_ether_addr(&agg->actor.system, + rte_is_same_ether_addr(&agg->actor.system, &lacp->partner.port_params.system) && port->actor.port_priority == lacp->partner.port_params.port_priority && @@ -575,7 +575,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) hdr = rte_pktmbuf_mtod(lacp_pkt, struct lacpdu_header *); /* Source and destination MAC */ - ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.d_addr); + 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); @@ -592,7 +592,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) memcpy(&hdr->lacpdu.actor.port_params, &port->actor, sizeof(port->actor)); agg = &bond_mode_8023ad_ports[port->aggregator_port_id]; - ether_addr_copy(&agg->actor.system, &hdr->lacpdu.actor.port_params.system); + rte_ether_addr_copy(&agg->actor.system, &hdr->lacpdu.actor.port_params.system); lacpdu->actor.state = port->actor_state; /* PARTNER */ @@ -694,9 +694,9 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) * ID (MAC address). */ if ((agg->actor.key == port->actor.key && agg->partner.system_priority == port->partner.system_priority && - is_same_ether_addr(&agg->partner.system, &port->partner.system) == 1 + rte_is_same_ether_addr(&agg->partner.system, &port->partner.system) == 1 && (agg->partner.key == port->partner.key)) && - is_zero_ether_addr(&port->partner.system) != 1 && + rte_is_zero_ether_addr(&port->partner.system) != 1 && (agg->actor.key & rte_cpu_to_be_16(BOND_LINK_FULL_DUPLEX_KEY)) != 0) { @@ -791,7 +791,7 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id, RTE_ASSERT(lacp->lacpdu.subtype == SLOW_SUBTYPE_LACP); partner = &lacp->lacpdu.partner; - if (is_same_ether_addr(&partner->port_params.system, + if (rte_is_same_ether_addr(&partner->port_params.system, &internals->mode4.mac_addr)) { /* This LACP frame is sending to the bonding port * so pass it to rx_machine. @@ -842,8 +842,8 @@ bond_mode_8023ad_periodic_cb(void *arg) SM_FLAG_SET(port, NTT); } - if (!is_same_ether_addr(&port->actor.system, &slave_addr)) { - ether_addr_copy(&slave_addr, &port->actor.system); + if (!rte_is_same_ether_addr(&port->actor.system, &slave_addr)) { + rte_ether_addr_copy(&slave_addr, &port->actor.system); if (port->aggregator_port_id == slave_id) SM_FLAG_SET(port, NTT); } @@ -1055,10 +1055,10 @@ bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) slave = &bond_mode_8023ad_ports[slave_id]; rte_eth_macaddr_get(slave_id, &slave_addr); - if (is_same_ether_addr(&slave_addr, &slave->actor.system)) + if (rte_is_same_ether_addr(&slave_addr, &slave->actor.system)) continue; - ether_addr_copy(&slave_addr, &slave->actor.system); + rte_ether_addr_copy(&slave_addr, &slave->actor.system); /* Do nothing if this port is not an aggregator. In other case * Set NTT flag on every port that use this aggregator. */ if (slave->aggregator_port_id != slave_id) diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index d47046142..5b7c3296e 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -101,17 +101,17 @@ void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, if (client_info->in_use == 0 || client_info->app_ip != arp->arp_data.arp_tip || client_info->cli_ip != arp->arp_data.arp_sip || - !is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || + !rte_is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || client_info->vlan_count != offset / sizeof(struct rte_vlan_hdr) || memcmp(client_info->vlan, eth_h + 1, offset) != 0 ) { client_info->in_use = 1; client_info->app_ip = arp->arp_data.arp_tip; client_info->cli_ip = arp->arp_data.arp_sip; - ether_addr_copy(&arp->arp_data.arp_sha, &client_info->cli_mac); + rte_ether_addr_copy(&arp->arp_data.arp_sha, &client_info->cli_mac); client_info->slave_idx = calculate_slave(internals); rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); } @@ -139,7 +139,7 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, * current primary port. */ rte_eth_macaddr_get(internals->port_id, &bonding_mac); - if (!is_same_ether_addr(&bonding_mac, &arp->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(&bonding_mac, &arp->arp_data.arp_sha)) { rte_eth_macaddr_get(internals->current_primary_port, &arp->arp_data.arp_sha); return internals->current_primary_port; @@ -155,13 +155,13 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { /* Entry is already assigned to this client */ - if (!is_broadcast_ether_addr(&arp->arp_data.arp_tha)) { - ether_addr_copy(&arp->arp_data.arp_tha, + if (!rte_is_broadcast_ether_addr(&arp->arp_data.arp_tha)) { + rte_ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); } rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); @@ -173,11 +173,11 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, client_info->in_use = 1; client_info->ntt = 0; client_info->app_ip = arp->arp_data.arp_sip; - ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); + rte_ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); client_info->cli_ip = arp->arp_data.arp_tip; client_info->slave_idx = calculate_slave(internals); rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); @@ -202,8 +202,8 @@ bond_mode_alb_arp_upd(struct client_data *client_info, rte_spinlock_lock(&internals->mode6.lock); eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ether_addr_copy(&client_info->app_mac, ð_h->s_addr); - ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); + 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); else @@ -215,9 +215,9 @@ bond_mode_alb_arp_upd(struct client_data *client_info, memcpy(eth_h + 1, client_info->vlan, client_info->vlan_count * sizeof(struct rte_vlan_hdr)); - ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); arp_h->arp_data.arp_sip = client_info->app_ip; - ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); + rte_ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; arp_h->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 67a78603f..fc905776c 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -453,8 +453,8 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, if (unlikely(is_lacp_packets(hdr->ether_type, subtype, bufs[j]) || !collecting || (!promisc && - !is_multicast_ether_addr(&hdr->d_addr) && - !is_same_ether_addr(bond_mac, + !rte_is_multicast_ether_addr(&hdr->d_addr) && + !rte_is_same_ether_addr(bond_mac, &hdr->d_addr)))) { if (hdr->ether_type == ether_type_slow_be) { @@ -1014,7 +1014,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) sizeof(internals->tlb_slaves_order[0]) * num_of_slaves); - ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); + rte_ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); if (nb_pkts > 3) { for (i = 0; i < 3; i++) @@ -1028,8 +1028,8 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) rte_prefetch0(rte_pktmbuf_mtod(bufs[j+3], void*)); ether_hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); - if (is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) - ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); + if (rte_is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) + rte_ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) mode6_debug("TX IPv4:", ether_hdr, slaves[i], &burstnumberTX); #endif @@ -1510,7 +1510,7 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr mac_addr = eth_dev->data->mac_addrs; - ether_addr_copy(mac_addr, dst_mac_addr); + rte_ether_addr_copy(mac_addr, dst_mac_addr); return 0; } @@ -1552,7 +1552,7 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; - if (is_same_ether_addr(mac_addr, &null_mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; ret = rte_eth_dev_mac_addr_add(slave_port_id, mac_addr, 0); @@ -1581,7 +1581,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, rc = 0; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; - if (is_same_ether_addr(mac_addr, &null_mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; ret = rte_eth_dev_mac_addr_remove(slave_port_id, mac_addr); diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index b54f75ebc..122166410 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -671,7 +671,7 @@ static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx, { struct port_info *pi = adap2pinfo(adapter, port_idx); - ether_addr_copy((struct rte_ether_addr *)hw_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0]); } diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index ee9920ad6..a7b053b4a 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -115,12 +115,12 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item, mask = umask ? umask : (const struct rte_flow_item_eth *)dmask; /* we don't support SRC_MAC filtering*/ - if (!is_zero_ether_addr(&mask->src)) + if (!rte_is_zero_ether_addr(&mask->src)) return rte_flow_error_set(e, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "src mac filtering not supported"); - if (!is_zero_ether_addr(&mask->dst)) { + if (!rte_is_zero_ether_addr(&mask->dst)) { const u8 *addr = (const u8 *)&spec->dst.addr_bytes[0]; const u8 *m = (const u8 *)&mask->dst.addr_bytes[0]; struct rte_flow *flow = (struct rte_flow *)fs->private; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 0e1dc1ae8..6716dd0cf 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1374,7 +1374,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) } /* copy the primary mac address */ - ether_addr_copy(&fman_intf->mac_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&fman_intf->mac_addr, ð_dev->data->mac_addrs[0]); RTE_LOG(INFO, PMD, "net: dpaa: %s: %02x:%02x:%02x:%02x:%02x:%02x\n", dpaa_device->name, diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index bfb9f9dad..40e357127 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2021,9 +2021,9 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, * If empty_mac(phy), return prime. * if both are empty, create random MAC, set as prime and return */ - if (!is_zero_ether_addr(&phy_mac)) { + if (!rte_is_zero_ether_addr(&phy_mac)) { /* If the addresses are not same, overwrite prime */ - if (!is_same_ether_addr(&phy_mac, &prime_mac)) { + if (!rte_is_same_ether_addr(&phy_mac, &prime_mac)) { ret = dpni_set_primary_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, phy_mac.addr_bytes); @@ -2034,9 +2034,9 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, } memcpy(&prime_mac, &phy_mac, sizeof(struct rte_ether_addr)); } - } else if (is_zero_ether_addr(&prime_mac)) { + } else if (rte_is_zero_ether_addr(&prime_mac)) { /* In case phys and prime, both are zero, create random MAC */ - eth_random_addr(prime_mac.addr_bytes); + rte_eth_random_addr(prime_mac.addr_bytes); ret = dpni_set_primary_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, prime_mac.addr_bytes); diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index ae69a64ea..355ffc8b1 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -293,7 +293,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, eth_dev->data->mac_addrs); /* initialize the vfta */ diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index df1419f27..e5d69251f 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -840,7 +840,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* initialize the vfta */ memset(shadow_vfta, 0, sizeof(*shadow_vfta)); @@ -1037,8 +1037,8 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) } /* Generate a random MAC address, if none was assigned by PF. */ - if (is_zero_ether_addr(perm_addr)) { - eth_random_addr(perm_addr->addr_bytes); + if (rte_is_zero_ether_addr(perm_addr)) { + rte_eth_random_addr(perm_addr->addr_bytes); PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF"); PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address " "%02x:%02x:%02x:%02x:%02x:%02x", @@ -1057,7 +1057,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) return diag; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x " diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c index 33683498a..8dcfc71c5 100644 --- a/drivers/net/e1000/igb_flow.c +++ b/drivers/net/e1000/igb_flow.c @@ -548,9 +548,9 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid ether address mask"); @@ -567,7 +567,7 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index 9f1521350..ab48a269f 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -43,7 +43,7 @@ int igb_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) uint16_t vfn; for (vfn = 0; vfn < vf_num; vfn++) { - eth_random_addr(vf_mac_addr); + 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); @@ -306,8 +306,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); int rah; - if (is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { - if (!is_zero_ether_addr((struct rte_ether_addr *)new_mac)) + if (rte_is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { + if (!rte_is_zero_ether_addr((struct rte_ether_addr *)new_mac)) rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 14846be94..62986b6d6 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1814,7 +1814,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) /* Copy MAC address and point DPDK to it */ eth_dev->data->mac_addrs = (struct rte_ether_addr *)adapter->mac_addr; - ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, (struct rte_ether_addr *)adapter->mac_addr); /* diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 49fbf4e88..3aa4977ff 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -98,7 +98,7 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x", diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 71e1b9c7d..597c1f214 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -648,7 +648,7 @@ static void debug_log_add_del_addr(struct rte_ether_addr *addr, bool add) { char mac_str[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(DEBUG, " %s address %s\n", add ? "add" : "remove", mac_str); } @@ -668,9 +668,9 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, /* Validate the given addresses first */ for (i = 0; i < nb_mc_addr && mc_addr_set != NULL; i++) { addr = &mc_addr_set[i]; - if (!is_multicast_ether_addr(addr) || - is_broadcast_ether_addr(addr)) { - ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + if (!rte_is_multicast_ether_addr(addr) || + rte_is_broadcast_ether_addr(addr)) { + rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(ERR, " invalid multicast address %s\n", mac_str); return -EINVAL; @@ -704,7 +704,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, for (i = 0; i < enic->mc_count; i++) { addr = &enic->mc_addrs[i]; for (j = 0; j < nb_mc_addr; j++) { - if (is_same_ether_addr(addr, &mc_addr_set[j])) + if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) break; } if (j < nb_mc_addr) @@ -718,7 +718,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, for (i = 0; i < nb_mc_addr; i++) { addr = &mc_addr_set[i]; for (j = 0; j < enic->mc_count; j++) { - if (is_same_ether_addr(addr, &enic->mc_addrs[j])) + if (rte_is_same_ether_addr(addr, &enic->mc_addrs[j])) break; } if (j < enic->mc_count) diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 6e8c5cf91..d50185a92 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1673,7 +1673,7 @@ static int enic_dev_init(struct enic *enic) dev_err(enic, "mac addr storage alloc failed, aborting.\n"); return -1; } - ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, eth_dev->data->mac_addrs); vnic_dev_set_reset_flag(enic->vdev, 0); diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 8f7d91169..185c27eaa 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -253,7 +253,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) */ FOREACH_SUBDEV(sdev, i, dev) if (sdev->state >= DEV_PROBED) { - ether_addr_copy(Ð(sdev)->data->mac_addrs[0], + rte_ether_addr_copy(Ð(sdev)->data->mac_addrs[0], mac); break; } @@ -265,7 +265,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) * probed slaves. */ if (i == priv->subs_tail) - eth_random_addr(&mac->addr_bytes[0]); + rte_eth_random_addr(&mac->addr_bytes[0]); } INFO("MAC address is %02x:%02x:%02x:%02x:%02x:%02x", mac->addr_bytes[0], mac->addr_bytes[1], diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 549ee6bb8..325c67ca9 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -174,7 +174,7 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, if (ret) { char ea_fmt[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); ERROR("Adding MAC address %s failed", ea_fmt); return ret; } diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index ac00828dd..e6956cbdb 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -614,7 +614,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); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); macvlan->nb_queue_pools = nb_queue_pools; @@ -1525,7 +1525,7 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) for (mac_index = 0; (mac_index < FM10K_MAX_MACADDR_NUM) && (result == FM10K_SUCCESS); mac_index++) { - if (is_zero_ether_addr(&data->mac_addrs[mac_index])) + if (rte_is_zero_ether_addr(&data->mac_addrs[mac_index])) continue; if (mac_num > macvlan->mac_num - 1) { PMD_INIT_LOG(ERR, "MAC address number " @@ -3080,16 +3080,16 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_read_mac_addr(hw); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); if (diag != FM10K_SUCCESS || - !is_valid_assigned_ether_addr(dev->data->mac_addrs)) { + !rte_is_valid_assigned_ether_addr(dev->data->mac_addrs)) { /* Generate a random addr */ - eth_random_addr(hw->mac.addr); + rte_eth_random_addr(hw->mac.addr); memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 331519ff4..5d0343a42 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1467,7 +1467,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) goto err_get_mac_addr; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, (struct rte_ether_addr *) hw->mac.perm_addr); /* Disable flow control */ @@ -1519,7 +1519,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) "Failed to allocated memory for storing mac address"); goto err_mac_alloc; } - ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, &dev->data->mac_addrs[0]); /* Init dcb to sw mode by default */ @@ -4112,7 +4112,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, new_mac = &filter->mac_addr; - if (is_zero_ether_addr(new_mac)) { + if (rte_is_zero_ether_addr(new_mac)) { PMD_DRV_LOG(ERR, "Invalid ethernet address."); return -EINVAL; } @@ -4125,7 +4125,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } vf = &pf->vfs[vf_id]; - if (add && is_same_ether_addr(new_mac, &(pf->dev_addr))) { + if (add && rte_is_same_ether_addr(new_mac, &(pf->dev_addr))) { PMD_DRV_LOG(INFO, "Ignore adding permanent MAC address."); return -EINVAL; } @@ -4143,7 +4143,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, PMD_DRV_LOG(ERR, "Failed to add MAC filter."); return -1; } - ether_addr_copy(new_mac, &pf->dev_addr); + rte_ether_addr_copy(new_mac, &pf->dev_addr); } else { rte_memcpy(hw->mac.addr, hw->mac.perm_addr, ETHER_ADDR_LEN); @@ -4154,7 +4154,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } /* Clear device address as it has been removed */ - if (is_same_ether_addr(&(pf->dev_addr), new_mac)) + if (rte_is_same_ether_addr(&(pf->dev_addr), new_mac)) memset(&pf->dev_addr, 0, sizeof(struct rte_ether_addr)); } @@ -6902,7 +6902,7 @@ i40e_find_mac_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f; TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) return f; } @@ -7575,9 +7575,9 @@ i40e_tunnel_filter_convert( struct i40e_aqc_cloud_filters_element_bb *cld_filter, struct i40e_tunnel_filter *tunnel_filter) { - ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, (struct rte_ether_addr *)&tunnel_filter->input.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, (struct rte_ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->element.inner_vlan; if ((rte_le_to_cpu_16(cld_filter->element.flags) & @@ -7686,9 +7686,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - ether_addr_copy(&tunnel_filter->outer_mac, + rte_ether_addr_copy(&tunnel_filter->outer_mac, (struct rte_ether_addr *)&pfilter->element.outer_mac); - ether_addr_copy(&tunnel_filter->inner_mac, + rte_ether_addr_copy(&tunnel_filter->inner_mac, (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = @@ -8133,9 +8133,9 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - ether_addr_copy(&tunnel_filter->outer_mac, + rte_ether_addr_copy(&tunnel_filter->outer_mac, (struct rte_ether_addr *)&pfilter->element.outer_mac); - ether_addr_copy(&tunnel_filter->inner_mac, + rte_ether_addr_copy(&tunnel_filter->inner_mac, (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = @@ -8616,13 +8616,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(&filter->outer_mac))) { + (rte_is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(&filter->inner_mac))) { + (rte_is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } @@ -11948,13 +11948,13 @@ static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, struct i40e_mac_filter *f; int ret; - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) break; } @@ -12072,9 +12072,9 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) vsi = vf->vsi; } memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, (struct rte_ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = f->input.inner_vlan; cld_filter.element.flags = f->input.flags; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 6fe062d16..ba9dd348f 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -787,7 +787,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev, int err; struct vf_cmd_info args; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x", addr->addr_bytes[0], addr->addr_bytes[1], addr->addr_bytes[2], addr->addr_bytes[3], @@ -1273,10 +1273,10 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) + if (rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; else - eth_random_addr(hw->mac.addr); /* Generate a random one */ + rte_eth_random_addr(hw->mac.addr); /* Generate a random one */ I40E_WRITE_REG(hw, I40E_VFINT_DYN_CTL01, (I40E_ITR_INDEX_DEFAULT << @@ -1511,7 +1511,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); return 0; @@ -1937,7 +1937,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) j = 0; len = sizeof(struct virtchnl_ether_addr_list); for (i = begin; i < I40E_NUM_MACADDR_MAX; i++, next_begin++) { - if (is_zero_ether_addr(&dev->data->mac_addrs[i])) + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[i])) continue; len += sizeof(struct virtchnl_ether_addr); if (len >= I40E_AQ_BUF_SZ) { @@ -1954,7 +1954,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) for (i = begin; i < next_begin; i++) { addr = &dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); @@ -2707,7 +2707,7 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } @@ -2720,7 +2720,7 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0) return -EIO; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index ae88ccd48..e21a8f63b 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2007,9 +2007,9 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2028,7 +2028,7 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { @@ -2485,8 +2485,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, eth_mask = item->mask; if (eth_spec && eth_mask) { - if (!is_zero_ether_addr(ð_mask->src) || - !is_zero_ether_addr(ð_mask->dst)) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + !rte_is_zero_ether_addr(ð_mask->dst)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -3326,8 +3326,8 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, /* DST address of inner MAC shouldn't be masked. * SRC address of Inner MAC should be masked. */ - if (!is_broadcast_ether_addr(ð_mask->dst) || - !is_zero_ether_addr(ð_mask->src) || + if (!rte_is_broadcast_ether_addr(ð_mask->dst) || + !rte_is_zero_ether_addr(ð_mask->src) || eth_mask->type) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -3556,8 +3556,8 @@ i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, /* DST address of inner MAC shouldn't be masked. * SRC address of Inner MAC should be masked. */ - if (!is_broadcast_ether_addr(ð_mask->dst) || - !is_zero_ether_addr(ð_mask->src) || + if (!rte_is_broadcast_ether_addr(ð_mask->dst) || + !rte_is_zero_ether_addr(ð_mask->src) || eth_mask->type) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -4803,9 +4803,9 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, int ret = 0; memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, (struct rte_ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = filter->input.inner_vlan; cld_filter.element.flags = filter->input.flags; diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 4d7001df5..6a86ec57b 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -348,7 +348,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, vf_res->vsi_res[0].vsi_type = VIRTCHNL_VSI_SRIOV; vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; - ether_addr_copy(&vf->mac_addr, + rte_ether_addr_copy(&vf->mac_addr, (struct rte_ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: @@ -845,7 +845,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, mac = (struct rte_ether_addr *)(addr_list->list[i].addr); rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - if (is_zero_ether_addr(mac) || + if (rte_is_zero_ether_addr(mac) || i40e_vsi_add_mac(vf->vsi, &filter)) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; @@ -887,7 +887,7 @@ i40e_pf_host_process_cmd_del_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); - if(is_zero_ether_addr(mac) || + if(rte_is_zero_ether_addr(mac) || i40e_vsi_delete_mac(vf->vsi, mac)) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index e6f18ab28..c4ba8f89a 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -560,7 +560,7 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, return -EINVAL; } - ether_addr_copy(mac_addr, &vf->mac_addr); + rte_ether_addr_copy(mac_addr, &vf->mac_addr); /* Remove all existing mac */ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) @@ -604,9 +604,9 @@ rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, return -EINVAL; } - if (is_same_ether_addr(mac_addr, &vf->mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &vf->mac_addr)) /* Reset the mac with NULL address */ - ether_addr_copy(&null_mac_addr, &vf->mac_addr); + rte_ether_addr_copy(&null_mac_addr, &vf->mac_addr); /* Remove the mac */ i40e_vsi_delete_mac(vsi, mac_addr); @@ -2387,7 +2387,7 @@ rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, } mac_filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - ether_addr_copy(mac_addr, &mac_filter.mac_addr); + rte_ether_addr_copy(mac_addr, &mac_filter.mac_addr); ret = i40e_vsi_add_mac(vsi, &mac_filter); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to add MAC filter."); @@ -2514,7 +2514,7 @@ rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct rte_ether_addr *vf_ma vf = &pf->vfs[vf_id]; mac = &vf->mac_addr; - if (is_same_ether_addr(mac, vf_mac)) + if (rte_is_same_ether_addr(mac, vf_mac)) return vf_id; } diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 7ecd86804..b56fbcb13 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -696,7 +696,7 @@ iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); int err; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); return -EINVAL; } @@ -941,11 +941,11 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, old_addr = (struct rte_ether_addr *)hw->mac.addr; perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; - if (is_same_ether_addr(mac_addr, old_addr)) + if (rte_is_same_ether_addr(mac_addr, old_addr)) return 0; /* If the MAC address is configured by host, skip the setting */ - if (is_valid_assigned_ether_addr(perm_addr)) + if (rte_is_valid_assigned_ether_addr(perm_addr)) return -EPERM; ret = iavf_add_del_eth_addr(adapter, old_addr, FALSE); @@ -973,7 +973,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, if (ret) return -EIO; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } @@ -1244,9 +1244,9 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) /* If the MAC address is not configured by host, * generate a random one. */ - if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) - eth_random_addr(hw->mac.addr); - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + if (!rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) + rte_eth_random_addr(hw->mac.addr); + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* register callback func to eal lib */ diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 0303e7809..674682b05 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -647,7 +647,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) len = sizeof(struct virtchnl_ether_addr_list); for (i = begin; i < IAVF_NUM_MACADDR_MAX; i++, next_begin++) { addr = &adapter->eth_dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; len += sizeof(struct virtchnl_ether_addr); if (len >= IAVF_AQ_BUF_SZ) { @@ -664,7 +664,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) for (i = begin; i < next_begin; i++) { addr = &adapter->eth_dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 092051a9c..91f052852 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -479,13 +479,13 @@ ice_init_mac_address(struct rte_eth_dev *dev) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!is_unicast_ether_addr + if (!rte_is_unicast_ether_addr ((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr)) { PMD_INIT_LOG(ERR, "Invalid MAC address"); return -EINVAL; } - ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0); @@ -495,7 +495,7 @@ ice_init_mac_address(struct rte_eth_dev *dev) return -ENOMEM; } /* store it to dev data */ - ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, &dev->data->mac_addrs[0]); return 0; } @@ -507,7 +507,7 @@ ice_find_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *macaddr) struct ice_mac_filter *f; TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) return f; } @@ -2243,13 +2243,13 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, uint8_t flags = 0; int ret; - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) break; } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index a3b045e71..6b44ca4c1 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1222,7 +1222,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ @@ -1656,7 +1656,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } /* Generate a random MAC address, if none was assigned by PF. */ - if (is_zero_ether_addr(perm_addr)) { + if (rte_is_zero_ether_addr(perm_addr)) { generate_random_mac_addr(perm_addr); diag = ixgbe_set_rar_vf(hw, 1, perm_addr->addr_bytes, 0, 1); if (diag) { @@ -1676,7 +1676,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]); /* reset the hardware with the new settings */ diag = hw->mac.ops.start_hw(hw); @@ -6085,7 +6085,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) if (i == index) continue; /* Skip NULL MAC addresses */ - if (is_zero_ether_addr(mac_addr)) + if (rte_is_zero_ether_addr(mac_addr)) continue; /* Skip the permanent MAC address */ if (memcmp(perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index f0fafebc8..7024354cd 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -744,9 +744,9 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid ether address mask"); @@ -763,7 +763,7 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 6180c9473..37521af7c 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -46,7 +46,7 @@ int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) uint16_t vfn; for (vfn = 0; vfn < vf_num; vfn++) { - eth_random_addr(vf_mac_addr); + 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); @@ -463,7 +463,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { + if (rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 3defba175..45fc3a4ad 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -35,7 +35,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); rar_entry = hw->mac.num_rar_entries - (vf + 1); - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { + 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); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index a88469223..0e304fd00 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -363,7 +363,7 @@ eth_kni_create(struct rte_vdev_device *vdev, data->dev_link = pmd_link; data->mac_addrs = &internals->eth_addr; - eth_random_addr(internals->eth_addr.addr_bytes); + rte_eth_random_addr(internals->eth_addr.addr_bytes); eth_dev->dev_ops = ð_kni_ops; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 925581a78..fea9f4922 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1835,7 +1835,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) 2 + i)); /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); /* enable firmware checksum support for tunnel packets */ lio_enable_hw_tunnel_rx_checksum(eth_dev); diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index ea2709b29..9c87694a2 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -1399,7 +1399,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) mac = &priv->mac[i]; else mac = ð_mask.dst; - if (is_zero_ether_addr(mac)) + if (rte_is_zero_ether_addr(mac)) continue; /* Check if MAC flow rule is already present. */ for (flow = LIST_FIRST(&priv->flows); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 90f586675..938f68c19 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -3334,7 +3334,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, " parameter is ignored"); break; } - if (!is_zero_ether_addr(&mask.eth->dst)) { + if (!rte_is_zero_ether_addr(&mask.eth->dst)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, spec.eth->dst.addr_bytes); @@ -3342,7 +3342,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, ETHER_ADDR_LEN, mask.eth->dst.addr_bytes); } - if (!is_zero_ether_addr(&mask.eth->src)) { + if (!rte_is_zero_ether_addr(&mask.eth->src)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, spec.eth->src.addr_bytes); diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 9f6b89a82..9204c5f52 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -71,7 +71,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) const int vf = priv->config.vf; assert(index < MLX5_MAX_MAC_ADDRESSES); - if (is_zero_ether_addr(&dev->data->mac_addrs[index])) + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[index])) return; if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], @@ -101,7 +101,7 @@ mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, unsigned int i; assert(index < MLX5_MAX_MAC_ADDRESSES); - if (is_zero_ether_addr(mac)) { + if (rte_is_zero_ether_addr(mac)) { rte_errno = EINVAL; return -rte_errno; } diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index e0de54489..19b4e346f 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -340,7 +340,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) #ifndef NDEBUG char m[18]; - ether_format_addr(m, 18, RTA_DATA(attribute)); + rte_ether_format_addr(m, 18, RTA_DATA(attribute)); DRV_LOG(DEBUG, "bridge MAC address %s", m); #endif memcpy(&(*data->mac)[data->mac_n++], @@ -555,14 +555,14 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) /* Verify the address is not in the array yet. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) - if (is_same_ether_addr(&macs[i], + if (rte_is_same_ether_addr(&macs[i], &dev->data->mac_addrs[j])) break; if (j != MLX5_MAX_MAC_ADDRESSES) continue; /* Find the first entry available. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) { - if (is_zero_ether_addr(&dev->data->mac_addrs[j])) { + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) { dev->data->mac_addrs[j] = macs[i]; break; } diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index d539ba6a1..9ec71c3c1 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -595,7 +595,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = neta_ppio_remove_mac_addr(priv->ppio, dev->data->mac_addrs[index].addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), + rte_ether_format_addr(buf, sizeof(buf), &dev->data->mac_addrs[index]); MVNETA_LOG(ERR, "Failed to remove mac %s", buf); } @@ -633,7 +633,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, ret = neta_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to add mac %s", buf); return -1; } @@ -661,7 +661,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]; - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to set mac to %s", buf); } return 0; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 8647c9b0d..4c6edb41d 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1080,7 +1080,7 @@ mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = pp2_ppio_remove_mac_addr(priv->ppio, dev->data->mac_addrs[index].addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), + rte_ether_format_addr(buf, sizeof(buf), &dev->data->mac_addrs[index]); MRVL_LOG(ERR, "Failed to remove mac %s", buf); } @@ -1134,7 +1134,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, */ ret = pp2_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to add mac %s", buf); return -1; } @@ -1168,7 +1168,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]; - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to set mac to %s", buf); } diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index cfb502523..ef5abd37b 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -128,8 +128,8 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) } ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) stats->broadcast++; else stats->multicast++; diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index 6a851a8ff..dbec4551f 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -42,7 +42,7 @@ static int hn_vf_match(const struct rte_eth_dev *dev) if (vf_dev == dev) continue; - if (is_same_ether_addr(mac, vf_mac)) + if (rte_is_same_ether_addr(mac, vf_mac)) return i; } return -ENOENT; diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index c1b42e504..a54243392 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2962,16 +2962,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_vf_read_mac(hw); } - if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { + if (!rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { PMD_INIT_LOG(INFO, "Using random mac address for port %d", port); /* Using random mac addresses for VFs */ - eth_random_addr(&hw->mac_addr[0]); + rte_eth_random_addr(&hw->mac_addr[0]); nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr); } /* Copying mac address to DPDK eth_dev struct */ - ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 7683511cf..d1d49b53b 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -535,7 +535,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, internals->packet_size = packet_size; internals->packet_copy = packet_copy; internals->port_id = eth_dev->data->port_id; - eth_random_addr(internals->eth_addr.addr_bytes); + rte_eth_random_addr(internals->eth_addr.addr_bytes); internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK; internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_RETA_GROUP_SIZE; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 205740016..243c6974e 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -580,7 +580,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, DP_ERR(edev, "Did not allocate memory for ucast\n"); return -ENOMEM; } - ether_addr_copy(mac_addr, &u->mac); + rte_ether_addr_copy(mac_addr, &u->mac); u->vlan = ucast->vlan; u->vni = ucast->vni; SLIST_INSERT_HEAD(&qdev->uc_list_head, u, list); @@ -622,14 +622,14 @@ qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_ad DP_ERR(edev, "Did not allocate memory for mcast\n"); return -ENOMEM; } - ether_addr_copy(&mc_addrs[i], &m->mac); + rte_ether_addr_copy(&mc_addrs[i], &m->mac); SLIST_INSERT_HEAD(&qdev->mc_list_head, m, list); } memset(&mcast, 0, sizeof(mcast)); mcast.num_mc_addrs = mc_addrs_num; mcast.opcode = ECORE_FILTER_ADD; for (i = 0; i < mc_addrs_num; i++) - ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) + rte_ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) &mcast.mac[i]); rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { @@ -654,7 +654,7 @@ static int qede_del_mcast_filters(struct rte_eth_dev *eth_dev) mcast.opcode = ECORE_FILTER_REMOVE; j = 0; SLIST_FOREACH(tmp, &qdev->mc_list_head, list) { - ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); + rte_ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); j++; } rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); @@ -707,13 +707,13 @@ qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, struct ecore_filter_ucast ucast; int re; - if (!is_valid_assigned_ether_addr(mac_addr)) + if (!rte_is_valid_assigned_ether_addr(mac_addr)) return -EINVAL; qede_set_ucast_cmn_params(&ucast); ucast.opcode = ECORE_FILTER_ADD; ucast.type = ECORE_FILTER_MAC; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); re = (int)qede_mac_int_ops(eth_dev, &ucast, 1); return re; } @@ -733,7 +733,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) return; } - if (!is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) + if (!rte_is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) return; qede_set_ucast_cmn_params(&ucast); @@ -741,7 +741,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) ucast.type = ECORE_FILTER_MAC; /* Use the index maintained by rte */ - ether_addr_copy(ð_dev->data->mac_addrs[index], + rte_ether_addr_copy(ð_dev->data->mac_addrs[index], (struct rte_ether_addr *)&ucast.mac); qede_mac_int_ops(eth_dev, &ucast, false); @@ -1771,7 +1771,7 @@ qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_add } for (i = 0; i < mc_addrs_num; i++) { - if (!is_multicast_ether_addr(&mc_addrs[i])) { + if (!rte_is_multicast_ether_addr(&mc_addrs[i])) { DP_ERR(edev, "Not a valid multicast MAC\n"); return -EINVAL; } @@ -2549,10 +2549,10 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) } if (!is_vf) { - ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. + rte_ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. hw_info.hw_mac_addr, ð_dev->data->mac_addrs[0]); - ether_addr_copy(ð_dev->data->mac_addrs[0], + rte_ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); } else { ecore_vf_read_bulletin(ECORE_LEADING_HWFN(edev), @@ -2565,9 +2565,9 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) &is_mac_forced); if (is_mac_exist) { DP_INFO(edev, "VF macaddr received from PF\n"); - ether_addr_copy((struct rte_ether_addr *)&vf_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&vf_mac, ð_dev->data->mac_addrs[0]); - ether_addr_copy(ð_dev->data->mac_addrs[0], + rte_ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); } else { DP_ERR(edev, "No VF macaddr assigned\n"); diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 2a5fb22e3..3324194d5 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -945,7 +945,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) * Copy the address to the device private data so that * it could be recalled in the case of adapter restart. */ - ether_addr_copy(mac_addr, &port->default_mac_addr); + rte_ether_addr_copy(mac_addr, &port->default_mac_addr); /* * Neither of the two following checks can return @@ -1005,7 +1005,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) unlock: if (rc != 0) - ether_addr_copy(old_addr, &port->default_mac_addr); + rte_ether_addr_copy(old_addr, &port->default_mac_addr); sfc_adapter_unlock(sa); @@ -2088,7 +2088,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) * Linux kernel. Copy from NIC config to Ethernet device data. */ from = (const struct rte_ether_addr *)(encp->enc_mac_addr); - ether_addr_copy(from, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(from, &dev->data->mac_addrs[0]); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index cffcd9a4c..26d7de91e 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -278,7 +278,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, if (spec == NULL) return 0; - if (is_same_ether_addr(&mask->dst, &supp_mask.dst)) { + if (rte_is_same_ether_addr(&mask->dst, &supp_mask.dst)) { efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_LOC_MAC : EFX_FILTER_MATCH_LOC_MAC; @@ -286,7 +286,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, EFX_MAC_ADDR_LEN); } else if (memcmp(mask->dst.addr_bytes, ig_mask, EFX_MAC_ADDR_LEN) == 0) { - if (is_unicast_ether_addr(&spec->dst)) + if (rte_is_unicast_ether_addr(&spec->dst)) efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST : EFX_FILTER_MATCH_UNKNOWN_UCAST_DST; @@ -294,7 +294,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST : EFX_FILTER_MATCH_UNKNOWN_MCAST_DST; - } else if (!is_zero_ether_addr(&mask->dst)) { + } else if (!rte_is_zero_ether_addr(&mask->dst)) { goto fail_bad_mask; } @@ -303,11 +303,11 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, * ethertype masks are equal to zero in inner frame, * so these fields are filled in only for the outer frame */ - if (is_same_ether_addr(&mask->src, &supp_mask.src)) { + if (rte_is_same_ether_addr(&mask->src, &supp_mask.src)) { efx_spec->efs_match_flags |= EFX_FILTER_MATCH_REM_MAC; rte_memcpy(efx_spec->efs_rem_mac, spec->src.addr_bytes, EFX_MAC_ADDR_LEN); - } else if (!is_zero_ether_addr(&mask->src)) { + } else if (!rte_is_zero_ether_addr(&mask->src)) { goto fail_bad_mask; } diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 8de5f0c60..23313e125 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -402,7 +402,7 @@ sfc_port_attach(struct sfc_adapter *sa) RTE_BUILD_BUG_ON(sizeof(encp->enc_mac_addr) != sizeof(*from)); from = (const struct rte_ether_addr *)(encp->enc_mac_addr); - ether_addr_copy(from, &port->default_mac_addr); + rte_ether_addr_copy(from, &port->default_mac_addr); port->max_mcast_addrs = EFX_MAC_MULTICAST_LIST_MAX; port->nb_mcast_addrs = 0; diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index aefc384dc..fdcd44e35 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -1681,9 +1681,9 @@ flow_rule_action_get(struct pmd_internals *softnic, item, "VXLAN ENCAP: first encap item should be ether"); } - ether_addr_copy(&spec.eth.dst, + rte_ether_addr_copy(&spec.eth.dst, &rule_action->encap.vxlan.ether.da); - ether_addr_copy(&spec.eth.src, + rte_ether_addr_copy(&spec.eth.src, &rule_action->encap.vxlan.ether.sa); item++; diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 43a66432a..99de9f4e6 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1522,7 +1522,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi) return -ENOMEM; } - ether_addr_copy(ð_addr, data->mac_addrs); + rte_ether_addr_copy(ð_addr, data->mac_addrs); PMD_INIT_LOG(INFO, "%s device %s successfully initialized", RTE_STR(RTE_SZEDATA2_DRIVER_NAME), data->name); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 3206c533f..df92a536c 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1163,7 +1163,7 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) return -ENOTSUP; } - if (is_zero_ether_addr(mac_addr)) { + if (rte_is_zero_ether_addr(mac_addr)) { TAP_LOG(ERR, "%s: can't set an empty MAC address", dev->device->name); return -EINVAL; @@ -1172,14 +1172,14 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY); if (ret < 0) return ret; - if (is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (rte_is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) return 0; /* Check the current MAC address on the remote */ ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY); if (ret < 0) return ret; - if (!is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (!rte_is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; @@ -1753,8 +1753,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, } if (pmd->type == ETH_TUNTAP_TYPE_TAP) { - if (is_zero_ether_addr(mac_addr)) - eth_random_addr((uint8_t *)&pmd->eth_addr); + if (rte_is_zero_ether_addr(mac_addr)) + rte_eth_random_addr((uint8_t *)&pmd->eth_addr); else rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); } diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index d155618fc..20963090c 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -537,14 +537,14 @@ tap_flow_create_eth(const struct rte_flow_item *item, void *data) if (!flow) return 0; msg = &flow->msg; - if (!is_zero_ether_addr(&mask->dst)) { + if (!rte_is_zero_ether_addr(&mask->dst)) { tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, &spec->dst.addr_bytes); tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST_MASK, ETHER_ADDR_LEN, &mask->dst.addr_bytes); } - if (!is_zero_ether_addr(&mask->src)) { + if (!rte_is_zero_ether_addr(&mask->src)) { tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, &spec->src.addr_bytes); tap_nlattr_add(&msg->nh, diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c index 2a793a4b1..332a249e8 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.c +++ b/drivers/net/thunderx/base/nicvf_mbox.c @@ -135,7 +135,7 @@ nicvf_handle_mbx_intr(struct nicvf *nic) nic->node = mbx.nic_cfg.node_id; nic->sqs_mode = mbx.nic_cfg.sqs_mode; nic->loopback_supported = mbx.nic_cfg.loopback_supported; - ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, (struct rte_ether_addr *)nic->mac_addr); nic->pf_acked = true; break; diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index ec2087924..482968b7a 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2179,10 +2179,10 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) ret = -ENOMEM; goto alarm_fail; } - if (is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) - eth_random_addr(&nic->mac_addr[0]); + if (rte_is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) + rte_eth_random_addr(&nic->mac_addr[0]); - ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, ð_dev->data->mac_addrs[0]); ret = nicvf_mbox_set_mac_addr(nic, nic->mac_addr); diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index ef02fdcdd..ad13eac3b 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -387,7 +387,7 @@ vdev_netvsc_device_probe(const struct if_nameindex *iface, strlcpy(ctx->if_name, iface->if_name, sizeof(ctx->if_name)); return 0; } - if (!is_same_ether_addr(eth_addr, &ctx->if_addr)) + if (!rte_is_same_ether_addr(eth_addr, &ctx->if_addr)) return 0; /* Look for associated PCI device. */ ret = vdev_netvsc_sysfs_readlink(buf, sizeof(buf), iface->if_name, @@ -544,7 +544,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, pair->value); return -EINVAL; } - if (is_same_ether_addr(eth_addr, &tmp)) + if (rte_is_same_ether_addr(eth_addr, &tmp)) break; } } diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 6705e90db..774774b94 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -329,8 +329,8 @@ vhost_count_multicast_broadcast(struct vhost_queue *vq, struct vhost_stats *pstats = &vq->stats; ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) pstats->xstats[VHOST_BROADCAST_PKT]++; else pstats->xstats[VHOST_MULTICAST_PKT]++; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index d34d94482..445f89989 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1108,7 +1108,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) offsetof(struct virtio_net_config, mac), &hw->mac_addr, ETHER_ADDR_LEN); } else { - eth_random_addr(&hw->mac_addr[0]); + rte_eth_random_addr(&hw->mac_addr[0]); virtio_set_hwaddr(hw); } } @@ -1164,7 +1164,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, const struct rte_ether_addr *addr = (i == index) ? mac_addr : addrs + i; struct virtio_net_ctrl_mac *tbl - = is_multicast_ether_addr(addr) ? mc : uc; + = rte_is_multicast_ether_addr(addr) ? mc : uc; memcpy(&tbl->macs[tbl->entries++], addr, ETHER_ADDR_LEN); } @@ -1193,10 +1193,10 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { struct virtio_net_ctrl_mac *tbl; - if (i == index || is_zero_ether_addr(addrs + i)) + if (i == index || rte_is_zero_ether_addr(addrs + i)) continue; - tbl = is_multicast_ether_addr(addrs + i) ? mc : uc; + tbl = rte_is_multicast_ether_addr(addrs + i) ? mc : uc; memcpy(&tbl->macs[tbl->entries++], addrs + i, ETHER_ADDR_LEN); } @@ -1662,7 +1662,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Copy the permanent MAC address to: virtio_hw */ virtio_get_hwaddr(hw); - ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index d6f46586e..ab3b6cf1b 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1114,8 +1114,8 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) } ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) stats->broadcast++; else stats->multicast++; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 2c42f2677..3ac65d0e4 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -311,7 +311,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -1189,7 +1189,7 @@ vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct vmxnet3_hw *hw = dev->data->dev_private; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); vmxnet3_write_mac(hw, mac_addr->addr_bytes); return 0; } diff --git a/examples/bond/main.c b/examples/bond/main.c index 8b510cab8..23171f4cf 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -387,12 +387,12 @@ static int lcore_main(__attribute__((unused)) void *arg1) if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) { arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); - ether_addr_copy(&arp_hdr->arp_data.arp_sha, &arp_hdr->arp_data.arp_tha); + rte_ether_addr_copy(&arp_hdr->arp_data.arp_sha, &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = arp_hdr->arp_data.arp_sip; rte_eth_macaddr_get(BOND_PORT, &d_addr); - ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1); is_free = 1; @@ -407,7 +407,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) } ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); ipv4_hdr->dst_addr = ipv4_hdr->src_addr; ipv4_hdr->src_addr = bond_ip; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index 27c22cf90..3d2a70d52 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -161,8 +161,8 @@ static void process_frame(struct app_port *ptr_port, struct rte_ether_hdr *ptr_mac_hdr; ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *); - ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); - ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); + rte_ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); + rte_ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); } static int slave_main(__attribute__((unused)) void *ptr_data) diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index 299488c1c..571c4e5aa 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -327,7 +327,7 @@ rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused, { if (addr == NULL) return -EINVAL; - return is_valid_assigned_ether_addr(addr); + return rte_is_valid_assigned_ether_addr(addr); } int diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index ef23d963a..8e30393d0 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -104,8 +104,8 @@ exchange_mac(struct rte_mbuf *m) /* change mac addresses on packet (to use mbuf data) */ eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ether_addr_copy(ð->d_addr, &addr); - ether_addr_copy(&addr, ð->d_addr); + rte_ether_addr_copy(ð->d_addr, &addr); + rte_ether_addr_copy(&addr, ð->d_addr); } static __rte_always_inline void diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index 7b8e7c4fa..cf9421874 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -48,7 +48,7 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 175803078..ed92d6f06 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -353,7 +353,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, *((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)port_out << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[port_out], ð_hdr->s_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); else @@ -571,7 +571,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 226153968..3a98e644f 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -409,7 +409,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, *((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } @@ -694,7 +694,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 10af1280a..959fa569a 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1429,7 +1429,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 a38aabe75..8f84545df 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -277,8 +277,8 @@ mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_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); /* Put new packet into the output queue */ @@ -538,7 +538,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/kni/main.c b/examples/kni/main.c index e4e27e87e..c96095f5f 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -835,7 +835,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); RTE_LOG(INFO, APP, "\t%s%s\n", name, buf); } diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index dd09855e7..a77b000a9 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -603,7 +603,7 @@ l2fwd_mac_updating(struct rte_mbuf *m, uint16_t dest_portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } static void diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 033104d63..77e44dc82 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -349,7 +349,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 21d19932d..9831a4323 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -179,7 +179,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index c1d6797b0..1e2b14297 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -161,7 +161,7 @@ l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } static void diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index ed25f75d8..4b94c246a 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1757,7 +1757,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 bcd584d3e..7d57a7f39 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -700,7 +700,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -725,7 +725,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); #else @@ -1580,7 +1580,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 2c0c89e21..56a55ac28 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -450,7 +450,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); @@ -791,7 +791,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 5612ef378..4a7336350 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -47,7 +47,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { @@ -68,7 +68,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else { diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 28635bf03..323f853ee 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -43,7 +43,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -64,7 +64,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else { diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index a91a0a16c..ad013bae8 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -637,7 +637,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -895,7 +895,7 @@ main(int argc, char **argv) /* * prepare src MACs for each port. */ - ether_addr_copy(&ports_eth_addr[portid], + rte_ether_addr_copy(&ports_eth_addr[portid], (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 9997c58f4..9cd4dc7a6 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -176,7 +176,7 @@ lsi_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index b29ed9e97..bd1ec8fa0 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -1070,14 +1070,14 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); send_single_packet(m[0], (uint8_t)dst_port[0]); send_single_packet(m[1], (uint8_t)dst_port[1]); @@ -1204,14 +1204,14 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); send_single_packet(m[0], dst_port[0]); send_single_packet(m[1], dst_port[1]); @@ -1262,7 +1262,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -1283,7 +1283,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else @@ -3024,7 +3024,7 @@ print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3582,7 +3582,7 @@ main(int argc, char **argv) /* * prepare src MACs for each port. */ - ether_addr_copy(&ports_eth_addr[portid], + rte_ether_addr_copy(&ports_eth_addr[portid], (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 7d28f59ce..1266f521c 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -401,7 +401,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ - ether_addr_copy(ð_multicast, ð_hdr->d_addr); + rte_ether_addr_copy(ð_multicast, ð_hdr->d_addr); eth_hdr->ether_type = htons(PTP_PROTOCOL); ptp_msg = (struct ptp_message *) diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 61e92a820..a61360b99 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -67,7 +67,7 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) pause_frame = (struct ether_fc_frame *) &hdr[1]; rte_eth_macaddr_get(port_id, &mac_addr); - ether_addr_copy(&mac_addr, &hdr->s_addr); + rte_ether_addr_copy(&mac_addr, &hdr->s_addr); void *tmp = &hdr->d_addr.addr_bytes[0]; *((uint64_t *)tmp) = 0x010000C28001ULL; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index e4af7bc4d..18a2215b4 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -243,7 +243,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) /* Learn MAC address of guest device from packet */ pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { + if (rte_is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: This device is using an existing" " MAC address and has not been registered.\n", @@ -261,11 +261,11 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; /* inner MAC */ - ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.queue_id = vdev->rx_q; tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; @@ -309,9 +309,9 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) } vxdev.out_key = tenant_id_conf[vdev->rx_q]; - ether_addr_copy(&vxdev.port[portid].peer_mac, + rte_ether_addr_copy(&vxdev.port[portid].peer_mac, &app_l2_hdr[portid].d_addr); - ether_addr_copy(&ports_eth_addr[0], + 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); @@ -349,8 +349,8 @@ vxlan_unlink(struct vhost_dev *vdev) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); - ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 5a3614117..96d697677 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -666,7 +666,7 @@ find_vhost_dev(struct rte_ether_addr *mac) TAILQ_FOREACH(vdev, &vhost_dev_list, global_vdev_entry) { if (vdev->ready == DEVICE_RX && - is_same_ether_addr(mac, &vdev->mac_address)) + rte_is_same_ether_addr(mac, &vdev->mac_address)) return vdev; } @@ -914,7 +914,7 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) { + if (unlikely(rte_is_broadcast_ether_addr(&nh->d_addr))) { struct vhost_dev *vdev2; TAILQ_FOREACH(vdev2, &vhost_dev_list, global_vdev_entry) { diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 5195a515a..7281ffd7f 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -417,7 +417,7 @@ update_mac_address(struct rte_mbuf *m, unsigned dst_port) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); } /* When we receive a HUP signal, print out our stats */ diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 75cf31a10..389000327 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -504,7 +504,7 @@ update_mac_address(struct rte_mbuf *m, unsigned dst_port) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); } /* When we receive a HUP signal, print out our stats */ diff --git a/lib/librte_ethdev/rte_class_eth.c b/lib/librte_ethdev/rte_class_eth.c index e554668da..873a65353 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/rte_class_eth.c @@ -61,7 +61,7 @@ eth_mac_cmp(const char *key __rte_unused, /* Return 0 if devargs MAC is matching one of the device MACs. */ rte_eth_dev_info_get(data->port_id, &dev_info); for (index = 0; index < dev_info.max_mac_addrs; index++) - if (is_same_ether_addr(&mac, &data->mac_addrs[index])) + if (rte_is_same_ether_addr(&mac, &data->mac_addrs[index])) return 0; return -1; /* no match */ } diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index e5fc7ffdf..f5e4e2d12 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1360,7 +1360,7 @@ rte_eth_dev_mac_restore(struct rte_eth_dev *dev, addr = &dev->data->mac_addrs[i]; /* skip zero address */ - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; pool = 0; @@ -2594,7 +2594,7 @@ rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr) RTE_ETH_VALID_PORTID_OR_RET(port_id); dev = &rte_eth_devices[port_id]; - ether_addr_copy(&dev->data->mac_addrs[0], mac_addr); + rte_ether_addr_copy(&dev->data->mac_addrs[0], mac_addr); } @@ -3106,7 +3106,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP); - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n", port_id); return -EINVAL; @@ -3137,7 +3137,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, if (ret == 0) { /* Update address in NIC data structure */ - ether_addr_copy(addr, &dev->data->mac_addrs[index]); + rte_ether_addr_copy(addr, &dev->data->mac_addrs[index]); /* Update pool bitmap in NIC data structure */ dev->data->mac_pool_sel[index] |= (1ULL << pool); @@ -3169,7 +3169,7 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr) (*dev->dev_ops->mac_addr_remove)(dev, index); /* Update address in NIC data structure */ - ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]); + rte_ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]); /* reset pool bitmap */ dev->data->mac_pool_sel[index] = 0; @@ -3185,7 +3185,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); - if (!is_valid_assigned_ether_addr(addr)) + if (!rte_is_valid_assigned_ether_addr(addr)) return -EINVAL; dev = &rte_eth_devices[port_id]; @@ -3196,7 +3196,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) return ret; /* Update default address in NIC data structure */ - ether_addr_copy(addr, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(addr, &dev->data->mac_addrs[0]); return 0; } @@ -3236,7 +3236,7 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n", port_id); return -EINVAL; @@ -3268,10 +3268,10 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, if (ret == 0) { /* Update address in NIC data structure */ if (on) - ether_addr_copy(addr, + rte_ether_addr_copy(addr, &dev->data->hash_mac_addrs[index]); else - ether_addr_copy(&null_mac_addr, + rte_ether_addr_copy(&null_mac_addr, &dev->data->hash_mac_addrs[index]); } diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 284219517..99c9c7d91 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -160,8 +160,8 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, dst = &(tbl->flows[flow_idx].key); - ether_addr_copy(&(src->eth_saddr), &(dst->eth_saddr)); - ether_addr_copy(&(src->eth_daddr), &(dst->eth_daddr)); + rte_ether_addr_copy(&(src->eth_saddr), &(dst->eth_saddr)); + rte_ether_addr_copy(&(src->eth_daddr), &(dst->eth_daddr)); dst->ip_src_addr = src->ip_src_addr; dst->ip_dst_addr = src->ip_dst_addr; dst->recv_ack = src->recv_ack; @@ -243,8 +243,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); - ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr)); - ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr)); + rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr)); + rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr)); key.ip_src_addr = ipv4_hdr->src_addr; key.ip_dst_addr = ipv4_hdr->dst_addr; key.src_port = tcp_hdr->src_port; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 988cca8c6..ce3471a4d 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -187,8 +187,8 @@ uint32_t gro_tcp4_tbl_pkt_count(void *tbl); static inline int is_same_tcp4_flow(struct tcp4_flow_key k1, struct tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && - is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && + return (rte_is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && + rte_is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && (k1.ip_src_addr == k2.ip_src_addr) && (k1.ip_dst_addr == k2.ip_dst_addr) && (k1.recv_ack == k2.recv_ack) && diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index d713e3dd6..53425f6d3 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -164,9 +164,9 @@ insert_new_flow(struct gro_vxlan_tcp4_tbl *tbl, dst = &(tbl->flows[flow_idx].key); - ether_addr_copy(&(src->inner_key.eth_saddr), + rte_ether_addr_copy(&(src->inner_key.eth_saddr), &(dst->inner_key.eth_saddr)); - ether_addr_copy(&(src->inner_key.eth_daddr), + rte_ether_addr_copy(&(src->inner_key.eth_daddr), &(dst->inner_key.eth_daddr)); dst->inner_key.ip_src_addr = src->inner_key.ip_src_addr; dst->inner_key.ip_dst_addr = src->inner_key.ip_dst_addr; @@ -176,8 +176,8 @@ insert_new_flow(struct gro_vxlan_tcp4_tbl *tbl, dst->vxlan_hdr.vx_flags = src->vxlan_hdr.vx_flags; dst->vxlan_hdr.vx_vni = src->vxlan_hdr.vx_vni; - ether_addr_copy(&(src->outer_eth_saddr), &(dst->outer_eth_saddr)); - ether_addr_copy(&(src->outer_eth_daddr), &(dst->outer_eth_daddr)); + rte_ether_addr_copy(&(src->outer_eth_saddr), &(dst->outer_eth_saddr)); + rte_ether_addr_copy(&(src->outer_eth_daddr), &(dst->outer_eth_daddr)); dst->outer_ip_src_addr = src->outer_ip_src_addr; dst->outer_ip_dst_addr = src->outer_ip_dst_addr; dst->outer_src_port = src->outer_src_port; @@ -193,8 +193,8 @@ static inline int is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, struct vxlan_tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.outer_eth_saddr, &k2.outer_eth_saddr) && - is_same_ether_addr(&k1.outer_eth_daddr, + return (rte_is_same_ether_addr(&k1.outer_eth_saddr, &k2.outer_eth_saddr) && + rte_is_same_ether_addr(&k1.outer_eth_daddr, &k2.outer_eth_daddr) && (k1.outer_ip_src_addr == k2.outer_ip_src_addr) && (k1.outer_ip_dst_addr == k2.outer_ip_dst_addr) && @@ -356,8 +356,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); - ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr)); - ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr)); + rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr)); + rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr)); key.inner_key.ip_src_addr = ipv4_hdr->src_addr; key.inner_key.ip_dst_addr = ipv4_hdr->dst_addr; key.inner_key.recv_ack = tcp_hdr->recv_ack; @@ -366,8 +366,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, key.vxlan_hdr.vx_flags = vxlan_hdr->vx_flags; key.vxlan_hdr.vx_vni = vxlan_hdr->vx_vni; - ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr)); - ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr)); + rte_ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr)); + rte_ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr)); key.outer_ip_src_addr = outer_ipv4_hdr->src_addr; key.outer_ip_dst_addr = outer_ipv4_hdr->dst_addr; key.outer_src_port = udp_hdr->src_port; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 921adb4cf..2274dc65d 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -30,7 +30,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, /* Ethernet header. */ memset(eth_hdr->d_addr.addr_bytes, 0xff, ETHER_ADDR_LEN); - ether_addr_copy(mac, ð_hdr->s_addr); + rte_ether_addr_copy(mac, ð_hdr->s_addr); eth_hdr->ether_type = htons(ETHER_TYPE_RARP); /* RARP header. */ @@ -41,8 +41,8 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, rarp->arp_plen = 4; rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); - ether_addr_copy(mac, &rarp->arp_data.arp_sha); - ether_addr_copy(mac, &rarp->arp_data.arp_tha); + rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha); + rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha); memset(&rarp->arp_data.arp_sip, 0x00, 4); memset(&rarp->arp_data.arp_tip, 0x00, 4); diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index afdbaa1a7..cc31fbd9b 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -75,7 +75,7 @@ struct rte_ether_addr { * True (1) if the given two ethernet address are the same; * False (0) otherwise. */ -static inline int is_same_ether_addr(const struct rte_ether_addr *ea1, +static inline int rte_is_same_ether_addr(const struct rte_ether_addr *ea1, const struct rte_ether_addr *ea2) { int i; @@ -95,7 +95,7 @@ static inline int is_same_ether_addr(const struct rte_ether_addr *ea1, * True (1) if the given ethernet address is filled with zeros; * false (0) otherwise. */ -static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -114,7 +114,7 @@ static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a unicast address; * false (0) otherwise. */ -static inline int is_unicast_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; } @@ -129,7 +129,7 @@ static inline int is_unicast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a multicast address; * false (0) otherwise. */ -static inline int is_multicast_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; } @@ -144,7 +144,7 @@ static inline int is_multicast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a broadcast address; * false (0) otherwise. */ -static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_broadcast_ether_addr(const struct rte_ether_addr *ea) { const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; @@ -162,7 +162,7 @@ static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a universally assigned address; * false (0) otherwise. */ -static inline int is_universal_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; } @@ -177,7 +177,7 @@ static inline int is_universal_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a locally assigned address; * false (0) otherwise. */ -static inline int is_local_admin_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; } @@ -193,9 +193,9 @@ static inline int is_local_admin_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is valid; * false (0) otherwise. */ -static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) { - return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); + return rte_is_unicast_ether_addr(ea) && (!rte_is_zero_ether_addr(ea)); } /** @@ -204,7 +204,7 @@ static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) * @param addr * A pointer to Ethernet address. */ -static inline void eth_random_addr(uint8_t *addr) +static inline void rte_eth_random_addr(uint8_t *addr) { uint64_t rand = rte_rand(); uint8_t *p = (uint8_t *)&rand; @@ -222,7 +222,7 @@ static inline void eth_random_addr(uint8_t *addr) * @param ea_to * A pointer to a ether_addr structure where to copy the Ethernet address. */ -static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, +static inline void rte_ether_addr_copy(const struct rte_ether_addr *ea_from, struct rte_ether_addr *ea_to) { #ifdef __INTEL_COMPILER @@ -252,7 +252,7 @@ static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, * A pointer to a ether_addr structure. */ static inline void -ether_format_addr(char *buf, uint16_t size, +rte_ether_format_addr(char *buf, uint16_t size, const struct rte_ether_addr *eth_addr) { snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 8841de64f..d4318ecb0 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -615,8 +615,8 @@ encap_ether_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ethertype); return 0; @@ -633,8 +633,8 @@ encap_vlan_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->vlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -657,8 +657,8 @@ encap_qinq_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); + 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); /* SVLAN */ @@ -683,8 +683,8 @@ encap_qinq_pppoe_apply(void *data, struct encap_qinq_pppoe_data *d = data; /* Ethernet */ - ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); + 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); /* SVLAN */ @@ -719,8 +719,8 @@ encap_mpls_apply(void *data, uint32_t i; /* Ethernet */ - ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ethertype); /* MPLS */ @@ -746,8 +746,8 @@ encap_pppoe_apply(void *data, struct encap_pppoe_data *d = data; /* Ethernet */ - ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ETHER_TYPE_PPPOE_SESSION); /* PPPoE and PPP*/ @@ -776,8 +776,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv4_vlan_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -815,8 +815,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv4_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* IPv4*/ @@ -850,8 +850,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv6_vlan_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -889,8 +889,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv6_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* IPv6*/ -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 04/14] net: add rte prefix to ether functions 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 04/14] net: add rte prefix to ether functions Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to functions: - rename is_same_ether_addr() as rte_is_same_ether_addr(). - rename is_zero_ether_addr() as rte_is_zero_ether_addr(). - rename is_unicast_ether_addr() as rte_is_unicast_ether_addr(). - rename is_multicast_ether_addr() as rte_is_multicast_ether_addr(). - rename is_broadcast_ether_addr() as rte_is_broadcast_ether_addr(). - rename is_universal_ether_addr() as rte_is_universal_ether_addr(). - rename is_local_admin_ether_addr() as rte_is_local_admin_ether_addr(). - rename is_valid_assigned_ether_addr() as rte_is_valid_assigned_ether_addr(). - rename eth_random_addr() as rte_eth_random_addr(). - rename ether_addr_copy() as rte_ether_addr_copy(). - rename ether_format_addr() as rte_ether_format_addr(). Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/cmdline.c | 6 ++-- app/test-pmd/config.c | 8 ++--- app/test-pmd/csumonly.c | 4 +-- app/test-pmd/flowgen.c | 4 +-- app/test-pmd/icmpecho.c | 22 ++++++------ app/test-pmd/ieee1588fwd.c | 6 ++-- app/test-pmd/macfwd.c | 4 +-- app/test-pmd/macswap.h | 6 ++-- app/test-pmd/txonly.c | 4 +-- app/test-pmd/util.c | 2 +- app/test/packet_burst_generator.c | 8 ++--- app/test/test_link_bonding.c | 14 ++++---- app/test/test_link_bonding_mode4.c | 26 +++++++------- app/test/test_pmd_perf.c | 2 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 4 +-- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 2 +- .../sample_app_ug/l2_forward_real_virtual.rst | 2 +- doc/guides/sample_app_ug/link_status_intr.rst | 2 +- drivers/net/atlantic/atl_ethdev.c | 2 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 4 +-- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 2 +- drivers/net/avp/avp_ethdev.c | 6 ++-- drivers/net/axgbe/axgbe_ethdev.c | 6 ++-- drivers/net/bnx2x/bnx2x.c | 4 +-- drivers/net/bnx2x/bnx2x_vfpf.c | 6 ++-- drivers/net/bnxt/bnxt_flow.c | 12 +++---- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 20 +++++------ drivers/net/bonding/rte_eth_bond_alb.c | 26 +++++++------- drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++----- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 4 +-- drivers/net/dpaa/dpaa_ethdev.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 8 ++--- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 8 ++--- drivers/net/e1000/igb_flow.c | 8 ++--- drivers/net/e1000/igb_pf.c | 6 ++-- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enetc/enetc_ethdev.c | 2 +- drivers/net/enic/enic_ethdev.c | 12 +++---- drivers/net/enic/enic_main.c | 2 +- drivers/net/failsafe/failsafe.c | 4 +-- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 12 +++---- drivers/net/i40e/i40e_ethdev.c | 38 ++++++++++---------- drivers/net/i40e/i40e_ethdev_vf.c | 16 ++++----- drivers/net/i40e/i40e_flow.c | 24 ++++++------- drivers/net/i40e/i40e_pf.c | 6 ++-- drivers/net/i40e/rte_pmd_i40e.c | 10 +++--- drivers/net/iavf/iavf_ethdev.c | 14 ++++---- drivers/net/iavf/iavf_vchnl.c | 4 +-- drivers/net/ice/ice_ethdev.c | 12 +++---- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++--- drivers/net/ixgbe/ixgbe_flow.c | 8 ++--- drivers/net/ixgbe/ixgbe_pf.c | 4 +-- drivers/net/ixgbe/rte_pmd_ixgbe.c | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/mlx4/mlx4_flow.c | 2 +- drivers/net/mlx5/mlx5_flow_tcf.c | 4 +-- drivers/net/mlx5/mlx5_mac.c | 4 +-- drivers/net/mlx5/mlx5_nl.c | 6 ++-- drivers/net/mvneta/mvneta_ethdev.c | 6 ++-- drivers/net/mvpp2/mrvl_ethdev.c | 6 ++-- drivers/net/netvsc/hn_rxtx.c | 4 +-- drivers/net/netvsc/hn_vf.c | 2 +- drivers/net/nfp/nfp_net.c | 6 ++-- drivers/net/null/rte_eth_null.c | 2 +- drivers/net/qede/qede_ethdev.c | 26 +++++++------- drivers/net/sfc/sfc_ethdev.c | 6 ++-- drivers/net/sfc/sfc_flow.c | 10 +++--- drivers/net/sfc/sfc_port.c | 2 +- drivers/net/softnic/rte_eth_softnic_flow.c | 4 +-- drivers/net/szedata2/rte_eth_szedata2.c | 2 +- drivers/net/tap/rte_eth_tap.c | 10 +++--- drivers/net/tap/tap_flow.c | 4 +-- drivers/net/thunderx/base/nicvf_mbox.c | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 6 ++-- drivers/net/vdev_netvsc/vdev_netvsc.c | 4 +-- drivers/net/vhost/rte_eth_vhost.c | 4 +-- drivers/net/virtio/virtio_ethdev.c | 10 +++--- drivers/net/virtio/virtio_rxtx.c | 4 +-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +-- examples/bond/main.c | 8 ++--- examples/ethtool/ethtool-app/main.c | 4 +-- examples/ethtool/lib/rte_ethtool.c | 2 +- examples/eventdev_pipeline/pipeline_common.h | 4 +-- examples/flow_filtering/main.c | 2 +- examples/ip_fragmentation/main.c | 4 +-- examples/ip_reassembly/main.c | 4 +-- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/ipv4_multicast/main.c | 6 ++-- examples/kni/main.c | 2 +- examples/l2fwd-crypto/main.c | 2 +- examples/l2fwd-jobstats/main.c | 2 +- examples/l2fwd-keepalive/main.c | 2 +- examples/l2fwd/main.c | 2 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 6 ++-- examples/l3fwd-vf/main.c | 4 +-- examples/l3fwd/l3fwd_em.h | 4 +-- examples/l3fwd/l3fwd_lpm.h | 4 +-- examples/l3fwd/main.c | 4 +-- examples/link_status_interrupt/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 40 +++++++++++----------- examples/ptpclient/ptpclient.c | 2 +- examples/quota_watermark/qw/main.c | 2 +- examples/tep_termination/vxlan_setup.c | 14 ++++---- examples/vhost/main.c | 4 +-- examples/vmdq/main.c | 2 +- examples/vmdq_dcb/main.c | 2 +- lib/librte_ethdev/rte_class_eth.c | 2 +- lib/librte_ethdev/rte_ethdev.c | 20 +++++------ lib/librte_gro/gro_tcp4.c | 8 ++--- lib/librte_gro/gro_tcp4.h | 4 +-- lib/librte_gro/gro_vxlan_tcp4.c | 20 +++++------ lib/librte_net/rte_arp.c | 6 ++-- lib/librte_net/rte_ether.h | 24 ++++++------- lib/librte_pipeline/rte_table_action.c | 40 +++++++++++----------- 120 files changed, 430 insertions(+), 430 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 032807378..b2c2b60dd 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -8720,8 +8720,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); - ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); - ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { @@ -12379,7 +12379,7 @@ static void cmd_mcast_addr_parsed(void *parsed_result, { struct cmd_mcast_addr_result *res = parsed_result; - if (!is_multicast_ether_addr(&res->mc_addr)) { + if (!rte_is_multicast_ether_addr(&res->mc_addr)) { printf("Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n", res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1], res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3], diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 83b9df103..01a19d8e8 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -111,7 +111,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3535,7 +3535,7 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) * in the pool of multicast addresses. */ for (i = 0; i < port->mc_addr_nb; i++) { - if (is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) { + if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) { printf("multicast address already filtered by port\n"); return; } @@ -3543,7 +3543,7 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) if (mcast_addr_pool_extend(port) != 0) return; - ether_addr_copy(mc_addr, &port->mc_addr_pool[i]); + rte_ether_addr_copy(mc_addr, &port->mc_addr_pool[i]); eth_port_multicast_addr_list_set(port_id); } @@ -3562,7 +3562,7 @@ mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr) * Search the pool of multicast MAC addresses for the removed address. */ for (i = 0; i < port->mc_addr_nb; i++) { - if (is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) + if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) break; } if (i == port->mc_addr_nb) { diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 1a7db7f0e..e052c7eb5 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -766,9 +766,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) * and inner headers */ eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); parse_ethernet(eth_hdr, &info); l3_hdr = (char *)eth_hdr + info.l2_len; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 7c6ad4b3c..69a3b5050 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -171,8 +171,8 @@ pkt_burst_flow_gen(struct fwd_stream *fs) /* Initialize Ethernet header. */ eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); - ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); + 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); /* Initialize IP header. */ diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 49720ad41..879f6283d 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -225,7 +225,7 @@ ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); if (what) printf("%s", what); printf("%s", buf); @@ -370,12 +370,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) continue; } if (verbose_level > 0) { - ether_addr_copy(&arp_h->arp_data.arp_sha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_sha, ð_addr); ether_addr_dump(" sha=", ð_addr); ip_addr = arp_h->arp_data.arp_sip; ipv4_addr_dump(" sip=", ip_addr); printf("\n"); - ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_dump(" tha=", ð_addr); ip_addr = arp_h->arp_data.arp_tip; ipv4_addr_dump(" tip=", ip_addr); @@ -391,15 +391,15 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) */ /* Use source MAC address as destination MAC address. */ - ether_addr_copy(ð_h->s_addr, ð_h->d_addr); + rte_ether_addr_copy(ð_h->s_addr, ð_h->d_addr); /* Set source MAC address with MAC address of TX port */ - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); - ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); - ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); - ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); + rte_ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); + rte_ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); /* Swap IP addresses in ARP payload */ ip_addr = arp_h->arp_data.arp_sip; @@ -456,9 +456,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ - ether_addr_copy(ð_h->s_addr, ð_addr); - ether_addr_copy(ð_h->d_addr, ð_h->s_addr); - ether_addr_copy(ð_addr, ð_h->d_addr); + rte_ether_addr_copy(ð_h->s_addr, ð_addr); + rte_ether_addr_copy(ð_h->d_addr, ð_h->s_addr); + rte_ether_addr_copy(ð_addr, ð_h->d_addr); ip_addr = ip_h->src_addr; if (is_multicast_ipv4_addr(ip_h->dst_addr)) { uint32_t ip_src; diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index c6aa3c618..2b7003be4 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -178,9 +178,9 @@ ieee1588_packet_fwd(struct fwd_stream *fs) port_ieee1588_rx_timestamp_check(fs->rx_port, timesync_index); /* Swap dest and src mac addresses. */ - ether_addr_copy(ð_hdr->d_addr, &addr); - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - ether_addr_copy(&addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->d_addr, &addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&addr, ð_hdr->s_addr); /* Forward PTP packet with hardware TX timestamp */ mb->ol_flags |= PKT_TX_IEEE1588_TMST; diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 631f86f3e..f15149252 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -92,9 +92,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs) void *)); mb = pkts_burst[i]; eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; diff --git a/app/test-pmd/macswap.h b/app/test-pmd/macswap.h index d53e5d482..013844156 100644 --- a/app/test-pmd/macswap.h +++ b/app/test-pmd/macswap.h @@ -29,9 +29,9 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ - ether_addr_copy(ð_hdr->d_addr, &addr); - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - ether_addr_copy(&addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->d_addr, &addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&addr, ð_hdr->s_addr); mbuf_field_set(mb, ol_flags); } diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index c4e891a13..3e3ead9fb 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -264,8 +264,8 @@ pkt_burst_transmit(struct fwd_stream *fs) /* * Initialize Ethernet header. */ - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); + 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); if (rte_mempool_get_bulk(mbp, (void **)pkts_burst, diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 0544b8e53..55f3844dd 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -17,7 +17,7 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 51ab0db29..2ef5d15a5 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -57,8 +57,8 @@ initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *src_ struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id) { - ether_addr_copy(dst_mac, ð_hdr->d_addr); - ether_addr_copy(src_mac, ð_hdr->s_addr); + rte_ether_addr_copy(dst_mac, ð_hdr->d_addr); + rte_ether_addr_copy(src_mac, ð_hdr->s_addr); if (vlan_enabled) { struct rte_vlan_hdr *vhdr = (struct rte_vlan_hdr *)((uint8_t *)eth_hdr + @@ -83,9 +83,9 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma arp_hdr->arp_hlen = ETHER_ADDR_LEN; arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); - ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = src_ip; - ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); + rte_ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = dst_ip; } diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 25276715a..00ddb0efe 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4482,7 +4482,7 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); @@ -4549,12 +4549,12 @@ test_alb_change_mac_in_reply_sent(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { - if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } @@ -4595,7 +4595,7 @@ test_alb_reply_from_client(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); @@ -4670,12 +4670,12 @@ test_alb_reply_from_client(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { - if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } @@ -4722,7 +4722,7 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 63fcafaea..f5ac6c99f 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -232,7 +232,7 @@ add_slave(struct slave_conf *slave, uint8_t start) RTE_VERIFY(slave->bonded == 0); RTE_VERIFY(slave->port_id != INVALID_PORT_ID); - ether_addr_copy(&slave_mac_default, &addr); + rte_ether_addr_copy(&slave_mac_default, &addr); addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; rte_eth_dev_mac_addr_remove(slave->port_id, &addr); @@ -253,7 +253,7 @@ add_slave(struct slave_conf *slave, uint8_t start) } rte_eth_macaddr_get(slave->port_id, &addr_check); - TEST_ASSERT_EQUAL(is_same_ether_addr(&addr, &addr_check), 1, + TEST_ASSERT_EQUAL(rte_is_same_ether_addr(&addr, &addr_check), 1, "Slave MAC address is not as expected"); RTE_VERIFY(slave->lacp_parnter_state == 0); @@ -491,7 +491,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *); /* Change source address to partner address */ - ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr); + 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; lacp = (struct lacpdu *) &slow_hdr->slow_protocol; @@ -503,7 +503,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) lacp->partner.state = lacp->actor.state; - ether_addr_copy(&parnter_system, &lacp->actor.port_params.system); + rte_ether_addr_copy(&parnter_system, &lacp->actor.port_params.system); lacp->actor.state = STATE_LACP_ACTIVE | STATE_SYNCHRONIZATION | STATE_AGGREGATION | @@ -810,7 +810,7 @@ test_mode4_rx(void) TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac); - ether_addr_copy(&bonded_mac, &dst_mac); + rte_ether_addr_copy(&bonded_mac, &dst_mac); /* Assert that dst address is not bonding address. Do not set the * least significant bit of the zero byte as this would create a @@ -845,7 +845,7 @@ test_mode4_rx(void) for (i = 0; i < expected_pkts_cnt; i++) { hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); - cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; + cnt[rte_is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; } free_pkts(pkts, expected_pkts_cnt); @@ -889,7 +889,7 @@ test_mode4_rx(void) for (i = 0; i < expected_pkts_cnt; i++) { hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); - eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac); + eq_cnt += rte_is_same_ether_addr(&hdr->d_addr, &bonded_mac); } free_pkts(pkts, expected_pkts_cnt); @@ -1130,10 +1130,10 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) struct marker_header *); /* Copy multicast destination address */ - ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr); + rte_ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr); /* Init source address */ - ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr); + 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.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW); @@ -1358,8 +1358,8 @@ test_mode4_ext_ctrl(void) }, }; - ether_addr_copy(&parnter_system, &src_mac); - ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); + rte_ether_addr_copy(&parnter_system, &src_mac); + 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); @@ -1412,8 +1412,8 @@ test_mode4_ext_lacp(void) }, }; - ether_addr_copy(&parnter_system, &src_mac); - ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); + rte_ether_addr_copy(&parnter_system, &src_mac); + 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); diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index b85da914c..a0c3eb956 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -174,7 +174,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 1fe6bf113..0b44ab90b 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -227,8 +227,8 @@ The actual packet transmission is done in the mcast_send_pkt() function: RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_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); /* Put new packet into the output queue */ diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index 02c1367f5..8d0c38721 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -467,7 +467,7 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); l2fwd_send_packet(m, (uint8_t) dst_port); } diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index 54e5b8022..bede06ed1 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -383,7 +383,7 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); l2fwd_send_packet(m, (uint8_t) dst_port); } diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index 3fd043e82..cfb1bcd58 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -324,7 +324,7 @@ The processing is very simple: processes the TX port from the RX port and then r *((uint64_t *)tmp) = 0x000000000002 + (dst_port << 40); /* src addr */ - ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); lsi_send_packet(m, dst_port); } diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 78039f882..f1df8e7fa 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -1238,7 +1238,7 @@ static int atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index __rte_unused, uint32_t pool __rte_unused) { - if (is_zero_ether_addr(mac_addr)) { + if (rte_is_zero_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); return -EINVAL; } diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c index e4a1da0be..8db38426b 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c @@ -656,7 +656,7 @@ static int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self, mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct rte_ether_addr *)mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mac_addr, (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { @@ -867,7 +867,7 @@ static int aq_fw1x_set_wol(struct aq_hw_s *self, bool wol_enabled, u8 *mac) prpc->msg_wol.pattern_id = 1U; prpc->msg_wol.wol_packet_type = 2U; /* Magic Packet */ - ether_addr_copy((struct rte_ether_addr *)mac, + rte_ether_addr_copy((struct rte_ether_addr *)mac, (struct rte_ether_addr *)&prpc->msg_wol.wol_pattern); } else { rpc_size = sizeof(prpc->msg_id) + sizeof(prpc->msg_del_id); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c index 9111be9f4..cddb5d632 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -222,7 +222,7 @@ int aq_fw2x_get_mac_permanent(struct aq_hw_s *self, u8 *mac) mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct rte_ether_addr *)mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mac_addr, (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 69a70d2cc..38e5eae05 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -1014,7 +1014,7 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev) } /* Get a mac from device config */ - ether_addr_copy(&avp->ethaddr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&avp->ethaddr, ð_dev->data->mac_addrs[0]); return 0; } @@ -1216,12 +1216,12 @@ _avp_mac_filter(struct avp_dev *avp, struct rte_mbuf *m) return 0; } - if (likely(is_broadcast_ether_addr(ð->d_addr))) { + if (likely(rte_is_broadcast_ether_addr(ð->d_addr))) { /* allow all broadcast packets */ return 0; } - if (likely(is_multicast_ether_addr(ð->d_addr))) { + if (likely(rte_is_multicast_ether_addr(ð->d_addr))) { /* allow all multicast packets */ return 0; } diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index e89c0ec2c..237b75c5d 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -634,11 +634,11 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } - if (!is_valid_assigned_ether_addr(&pdata->mac_addr)) - eth_random_addr(pdata->mac_addr.addr_bytes); + if (!rte_is_valid_assigned_ether_addr(&pdata->mac_addr)) + rte_eth_random_addr(pdata->mac_addr.addr_bytes); /* Copy the permanent MAC address */ - ether_addr_copy(&pdata->mac_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&pdata->mac_addr, ð_dev->data->mac_addrs[0]); /* Clock settings */ pdata->sysclk_rate = AXGBE_V2_DMA_CLOCK_FREQ; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 77a0f56b2..d83d3e686 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2194,8 +2194,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_parse_bd = &txq->tx_ring[TX_BD(bd_prod, txq)].parse_bd_e2; - if (is_multicast_ether_addr(&eh->d_addr)) { - if (is_broadcast_ether_addr(&eh->d_addr)) + if (rte_is_multicast_ether_addr(&eh->d_addr)) { + if (rte_is_broadcast_ether_addr(&eh->d_addr)) mac_type = BROADCAST_ADDRESS; else mac_type = MULTICAST_ADDRESS; diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index a044e6eac..67e3b54b1 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -300,11 +300,11 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ sc->igu_sb_cnt, sc->igu_base_sb); strncpy(sc->fw_ver, sc_resp.fw_ver, sizeof(sc->fw_ver)); - if (is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) - ether_addr_copy(&sc_resp.resc.current_mac_addr, + if (rte_is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) + rte_ether_addr_copy(&sc_resp.resc.current_mac_addr, (struct rte_ether_addr *)sc->link_params.mac_addr); else - eth_random_addr(sc->link_params.mac_addr); + rte_eth_random_addr(sc->link_params.mac_addr); out: bnx2x_vf_finalize(sc, &acq->first_tlv); diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 1afe67407..a1f527d4f 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -187,10 +187,10 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, * Destination MAC address mask must not be partially * set. Should be all 1's or all 0's. */ - if ((!is_zero_ether_addr(ð_mask->src) && - !is_broadcast_ether_addr(ð_mask->src)) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if ((!rte_is_zero_ether_addr(ð_mask->src) && + !rte_is_broadcast_ether_addr(ð_mask->src)) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -209,7 +209,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, return -rte_errno; } - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { rte_memcpy(filter->dst_macaddr, ð_spec->dst, 6); en |= use_ntuple ? @@ -217,7 +217,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, EM_FLOW_ALLOC_INPUT_EN_DST_MACADDR; } - if (is_broadcast_ether_addr(ð_mask->src)) { + if (rte_is_broadcast_ether_addr(ð_mask->src)) { rte_memcpy(filter->src_macaddr, ð_spec->src, 6); en |= use_ntuple ? diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 59e75b0be..e2fe4f7a0 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2586,7 +2586,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, if (memcmp(mac.addr_bytes, "\x00\x00\x00\x00\x00", 6) == 0) { cfg_req->enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_MAC_ADDR); - eth_random_addr(cfg_req->dflt_mac_addr); + 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); diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 51bf3f52e..7a775cd0c 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -322,7 +322,7 @@ rx_machine(struct bond_dev_private *internals, uint16_t slave_id, agg = &bond_mode_8023ad_ports[port->aggregator_port_id]; bool match = port->actor.system_priority == lacp->partner.port_params.system_priority && - is_same_ether_addr(&agg->actor.system, + rte_is_same_ether_addr(&agg->actor.system, &lacp->partner.port_params.system) && port->actor.port_priority == lacp->partner.port_params.port_priority && @@ -575,7 +575,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) hdr = rte_pktmbuf_mtod(lacp_pkt, struct lacpdu_header *); /* Source and destination MAC */ - ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.d_addr); + 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); @@ -592,7 +592,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) memcpy(&hdr->lacpdu.actor.port_params, &port->actor, sizeof(port->actor)); agg = &bond_mode_8023ad_ports[port->aggregator_port_id]; - ether_addr_copy(&agg->actor.system, &hdr->lacpdu.actor.port_params.system); + rte_ether_addr_copy(&agg->actor.system, &hdr->lacpdu.actor.port_params.system); lacpdu->actor.state = port->actor_state; /* PARTNER */ @@ -694,9 +694,9 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) * ID (MAC address). */ if ((agg->actor.key == port->actor.key && agg->partner.system_priority == port->partner.system_priority && - is_same_ether_addr(&agg->partner.system, &port->partner.system) == 1 + rte_is_same_ether_addr(&agg->partner.system, &port->partner.system) == 1 && (agg->partner.key == port->partner.key)) && - is_zero_ether_addr(&port->partner.system) != 1 && + rte_is_zero_ether_addr(&port->partner.system) != 1 && (agg->actor.key & rte_cpu_to_be_16(BOND_LINK_FULL_DUPLEX_KEY)) != 0) { @@ -791,7 +791,7 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id, RTE_ASSERT(lacp->lacpdu.subtype == SLOW_SUBTYPE_LACP); partner = &lacp->lacpdu.partner; - if (is_same_ether_addr(&partner->port_params.system, + if (rte_is_same_ether_addr(&partner->port_params.system, &internals->mode4.mac_addr)) { /* This LACP frame is sending to the bonding port * so pass it to rx_machine. @@ -842,8 +842,8 @@ bond_mode_8023ad_periodic_cb(void *arg) SM_FLAG_SET(port, NTT); } - if (!is_same_ether_addr(&port->actor.system, &slave_addr)) { - ether_addr_copy(&slave_addr, &port->actor.system); + if (!rte_is_same_ether_addr(&port->actor.system, &slave_addr)) { + rte_ether_addr_copy(&slave_addr, &port->actor.system); if (port->aggregator_port_id == slave_id) SM_FLAG_SET(port, NTT); } @@ -1055,10 +1055,10 @@ bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) slave = &bond_mode_8023ad_ports[slave_id]; rte_eth_macaddr_get(slave_id, &slave_addr); - if (is_same_ether_addr(&slave_addr, &slave->actor.system)) + if (rte_is_same_ether_addr(&slave_addr, &slave->actor.system)) continue; - ether_addr_copy(&slave_addr, &slave->actor.system); + rte_ether_addr_copy(&slave_addr, &slave->actor.system); /* Do nothing if this port is not an aggregator. In other case * Set NTT flag on every port that use this aggregator. */ if (slave->aggregator_port_id != slave_id) diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index d47046142..5b7c3296e 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -101,17 +101,17 @@ void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, if (client_info->in_use == 0 || client_info->app_ip != arp->arp_data.arp_tip || client_info->cli_ip != arp->arp_data.arp_sip || - !is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || + !rte_is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || client_info->vlan_count != offset / sizeof(struct rte_vlan_hdr) || memcmp(client_info->vlan, eth_h + 1, offset) != 0 ) { client_info->in_use = 1; client_info->app_ip = arp->arp_data.arp_tip; client_info->cli_ip = arp->arp_data.arp_sip; - ether_addr_copy(&arp->arp_data.arp_sha, &client_info->cli_mac); + rte_ether_addr_copy(&arp->arp_data.arp_sha, &client_info->cli_mac); client_info->slave_idx = calculate_slave(internals); rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); } @@ -139,7 +139,7 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, * current primary port. */ rte_eth_macaddr_get(internals->port_id, &bonding_mac); - if (!is_same_ether_addr(&bonding_mac, &arp->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(&bonding_mac, &arp->arp_data.arp_sha)) { rte_eth_macaddr_get(internals->current_primary_port, &arp->arp_data.arp_sha); return internals->current_primary_port; @@ -155,13 +155,13 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { /* Entry is already assigned to this client */ - if (!is_broadcast_ether_addr(&arp->arp_data.arp_tha)) { - ether_addr_copy(&arp->arp_data.arp_tha, + if (!rte_is_broadcast_ether_addr(&arp->arp_data.arp_tha)) { + rte_ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); } rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); @@ -173,11 +173,11 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, client_info->in_use = 1; client_info->ntt = 0; client_info->app_ip = arp->arp_data.arp_sip; - ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); + rte_ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); client_info->cli_ip = arp->arp_data.arp_tip; client_info->slave_idx = calculate_slave(internals); rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); @@ -202,8 +202,8 @@ bond_mode_alb_arp_upd(struct client_data *client_info, rte_spinlock_lock(&internals->mode6.lock); eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ether_addr_copy(&client_info->app_mac, ð_h->s_addr); - ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); + 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); else @@ -215,9 +215,9 @@ bond_mode_alb_arp_upd(struct client_data *client_info, memcpy(eth_h + 1, client_info->vlan, client_info->vlan_count * sizeof(struct rte_vlan_hdr)); - ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); arp_h->arp_data.arp_sip = client_info->app_ip; - ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); + rte_ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; arp_h->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 67a78603f..fc905776c 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -453,8 +453,8 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, if (unlikely(is_lacp_packets(hdr->ether_type, subtype, bufs[j]) || !collecting || (!promisc && - !is_multicast_ether_addr(&hdr->d_addr) && - !is_same_ether_addr(bond_mac, + !rte_is_multicast_ether_addr(&hdr->d_addr) && + !rte_is_same_ether_addr(bond_mac, &hdr->d_addr)))) { if (hdr->ether_type == ether_type_slow_be) { @@ -1014,7 +1014,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) sizeof(internals->tlb_slaves_order[0]) * num_of_slaves); - ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); + rte_ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); if (nb_pkts > 3) { for (i = 0; i < 3; i++) @@ -1028,8 +1028,8 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) rte_prefetch0(rte_pktmbuf_mtod(bufs[j+3], void*)); ether_hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); - if (is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) - ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); + if (rte_is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) + rte_ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) mode6_debug("TX IPv4:", ether_hdr, slaves[i], &burstnumberTX); #endif @@ -1510,7 +1510,7 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct rte_ether_addr *dst_mac_addr mac_addr = eth_dev->data->mac_addrs; - ether_addr_copy(mac_addr, dst_mac_addr); + rte_ether_addr_copy(mac_addr, dst_mac_addr); return 0; } @@ -1552,7 +1552,7 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; - if (is_same_ether_addr(mac_addr, &null_mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; ret = rte_eth_dev_mac_addr_add(slave_port_id, mac_addr, 0); @@ -1581,7 +1581,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, rc = 0; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; - if (is_same_ether_addr(mac_addr, &null_mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; ret = rte_eth_dev_mac_addr_remove(slave_port_id, mac_addr); diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index b54f75ebc..122166410 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -671,7 +671,7 @@ static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx, { struct port_info *pi = adap2pinfo(adapter, port_idx); - ether_addr_copy((struct rte_ether_addr *)hw_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0]); } diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index ee9920ad6..a7b053b4a 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -115,12 +115,12 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item, mask = umask ? umask : (const struct rte_flow_item_eth *)dmask; /* we don't support SRC_MAC filtering*/ - if (!is_zero_ether_addr(&mask->src)) + if (!rte_is_zero_ether_addr(&mask->src)) return rte_flow_error_set(e, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "src mac filtering not supported"); - if (!is_zero_ether_addr(&mask->dst)) { + if (!rte_is_zero_ether_addr(&mask->dst)) { const u8 *addr = (const u8 *)&spec->dst.addr_bytes[0]; const u8 *m = (const u8 *)&mask->dst.addr_bytes[0]; struct rte_flow *flow = (struct rte_flow *)fs->private; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 0e1dc1ae8..6716dd0cf 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1374,7 +1374,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) } /* copy the primary mac address */ - ether_addr_copy(&fman_intf->mac_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&fman_intf->mac_addr, ð_dev->data->mac_addrs[0]); RTE_LOG(INFO, PMD, "net: dpaa: %s: %02x:%02x:%02x:%02x:%02x:%02x\n", dpaa_device->name, diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index bfb9f9dad..40e357127 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2021,9 +2021,9 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, * If empty_mac(phy), return prime. * if both are empty, create random MAC, set as prime and return */ - if (!is_zero_ether_addr(&phy_mac)) { + if (!rte_is_zero_ether_addr(&phy_mac)) { /* If the addresses are not same, overwrite prime */ - if (!is_same_ether_addr(&phy_mac, &prime_mac)) { + if (!rte_is_same_ether_addr(&phy_mac, &prime_mac)) { ret = dpni_set_primary_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, phy_mac.addr_bytes); @@ -2034,9 +2034,9 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, } memcpy(&prime_mac, &phy_mac, sizeof(struct rte_ether_addr)); } - } else if (is_zero_ether_addr(&prime_mac)) { + } else if (rte_is_zero_ether_addr(&prime_mac)) { /* In case phys and prime, both are zero, create random MAC */ - eth_random_addr(prime_mac.addr_bytes); + rte_eth_random_addr(prime_mac.addr_bytes); ret = dpni_set_primary_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, prime_mac.addr_bytes); diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index ae69a64ea..355ffc8b1 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -293,7 +293,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, eth_dev->data->mac_addrs); /* initialize the vfta */ diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index df1419f27..e5d69251f 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -840,7 +840,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* initialize the vfta */ memset(shadow_vfta, 0, sizeof(*shadow_vfta)); @@ -1037,8 +1037,8 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) } /* Generate a random MAC address, if none was assigned by PF. */ - if (is_zero_ether_addr(perm_addr)) { - eth_random_addr(perm_addr->addr_bytes); + if (rte_is_zero_ether_addr(perm_addr)) { + rte_eth_random_addr(perm_addr->addr_bytes); PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF"); PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address " "%02x:%02x:%02x:%02x:%02x:%02x", @@ -1057,7 +1057,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) return diag; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x " diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c index 33683498a..8dcfc71c5 100644 --- a/drivers/net/e1000/igb_flow.c +++ b/drivers/net/e1000/igb_flow.c @@ -548,9 +548,9 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid ether address mask"); @@ -567,7 +567,7 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index 9f1521350..ab48a269f 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -43,7 +43,7 @@ int igb_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) uint16_t vfn; for (vfn = 0; vfn < vf_num; vfn++) { - eth_random_addr(vf_mac_addr); + 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); @@ -306,8 +306,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); int rah; - if (is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { - if (!is_zero_ether_addr((struct rte_ether_addr *)new_mac)) + if (rte_is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { + if (!rte_is_zero_ether_addr((struct rte_ether_addr *)new_mac)) rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 14846be94..62986b6d6 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1814,7 +1814,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) /* Copy MAC address and point DPDK to it */ eth_dev->data->mac_addrs = (struct rte_ether_addr *)adapter->mac_addr; - ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, (struct rte_ether_addr *)adapter->mac_addr); /* diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 49fbf4e88..3aa4977ff 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -98,7 +98,7 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x", diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 71e1b9c7d..597c1f214 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -648,7 +648,7 @@ static void debug_log_add_del_addr(struct rte_ether_addr *addr, bool add) { char mac_str[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(DEBUG, " %s address %s\n", add ? "add" : "remove", mac_str); } @@ -668,9 +668,9 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, /* Validate the given addresses first */ for (i = 0; i < nb_mc_addr && mc_addr_set != NULL; i++) { addr = &mc_addr_set[i]; - if (!is_multicast_ether_addr(addr) || - is_broadcast_ether_addr(addr)) { - ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + if (!rte_is_multicast_ether_addr(addr) || + rte_is_broadcast_ether_addr(addr)) { + rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(ERR, " invalid multicast address %s\n", mac_str); return -EINVAL; @@ -704,7 +704,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, for (i = 0; i < enic->mc_count; i++) { addr = &enic->mc_addrs[i]; for (j = 0; j < nb_mc_addr; j++) { - if (is_same_ether_addr(addr, &mc_addr_set[j])) + if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) break; } if (j < nb_mc_addr) @@ -718,7 +718,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, for (i = 0; i < nb_mc_addr; i++) { addr = &mc_addr_set[i]; for (j = 0; j < enic->mc_count; j++) { - if (is_same_ether_addr(addr, &enic->mc_addrs[j])) + if (rte_is_same_ether_addr(addr, &enic->mc_addrs[j])) break; } if (j < enic->mc_count) diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 6e8c5cf91..d50185a92 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1673,7 +1673,7 @@ static int enic_dev_init(struct enic *enic) dev_err(enic, "mac addr storage alloc failed, aborting.\n"); return -1; } - ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *) enic->mac_addr, eth_dev->data->mac_addrs); vnic_dev_set_reset_flag(enic->vdev, 0); diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 8f7d91169..185c27eaa 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -253,7 +253,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) */ FOREACH_SUBDEV(sdev, i, dev) if (sdev->state >= DEV_PROBED) { - ether_addr_copy(Ð(sdev)->data->mac_addrs[0], + rte_ether_addr_copy(Ð(sdev)->data->mac_addrs[0], mac); break; } @@ -265,7 +265,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) * probed slaves. */ if (i == priv->subs_tail) - eth_random_addr(&mac->addr_bytes[0]); + rte_eth_random_addr(&mac->addr_bytes[0]); } INFO("MAC address is %02x:%02x:%02x:%02x:%02x:%02x", mac->addr_bytes[0], mac->addr_bytes[1], diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 549ee6bb8..325c67ca9 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -174,7 +174,7 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, if (ret) { char ea_fmt[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); ERROR("Adding MAC address %s failed", ea_fmt); return ret; } diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index ac00828dd..e6956cbdb 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -614,7 +614,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); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); macvlan->nb_queue_pools = nb_queue_pools; @@ -1525,7 +1525,7 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) for (mac_index = 0; (mac_index < FM10K_MAX_MACADDR_NUM) && (result == FM10K_SUCCESS); mac_index++) { - if (is_zero_ether_addr(&data->mac_addrs[mac_index])) + if (rte_is_zero_ether_addr(&data->mac_addrs[mac_index])) continue; if (mac_num > macvlan->mac_num - 1) { PMD_INIT_LOG(ERR, "MAC address number " @@ -3080,16 +3080,16 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_read_mac_addr(hw); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); if (diag != FM10K_SUCCESS || - !is_valid_assigned_ether_addr(dev->data->mac_addrs)) { + !rte_is_valid_assigned_ether_addr(dev->data->mac_addrs)) { /* Generate a random addr */ - eth_random_addr(hw->mac.addr); + rte_eth_random_addr(hw->mac.addr); memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 331519ff4..5d0343a42 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1467,7 +1467,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) goto err_get_mac_addr; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.addr, (struct rte_ether_addr *) hw->mac.perm_addr); /* Disable flow control */ @@ -1519,7 +1519,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) "Failed to allocated memory for storing mac address"); goto err_mac_alloc; } - ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, &dev->data->mac_addrs[0]); /* Init dcb to sw mode by default */ @@ -4112,7 +4112,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, new_mac = &filter->mac_addr; - if (is_zero_ether_addr(new_mac)) { + if (rte_is_zero_ether_addr(new_mac)) { PMD_DRV_LOG(ERR, "Invalid ethernet address."); return -EINVAL; } @@ -4125,7 +4125,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } vf = &pf->vfs[vf_id]; - if (add && is_same_ether_addr(new_mac, &(pf->dev_addr))) { + if (add && rte_is_same_ether_addr(new_mac, &(pf->dev_addr))) { PMD_DRV_LOG(INFO, "Ignore adding permanent MAC address."); return -EINVAL; } @@ -4143,7 +4143,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, PMD_DRV_LOG(ERR, "Failed to add MAC filter."); return -1; } - ether_addr_copy(new_mac, &pf->dev_addr); + rte_ether_addr_copy(new_mac, &pf->dev_addr); } else { rte_memcpy(hw->mac.addr, hw->mac.perm_addr, ETHER_ADDR_LEN); @@ -4154,7 +4154,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } /* Clear device address as it has been removed */ - if (is_same_ether_addr(&(pf->dev_addr), new_mac)) + if (rte_is_same_ether_addr(&(pf->dev_addr), new_mac)) memset(&pf->dev_addr, 0, sizeof(struct rte_ether_addr)); } @@ -6902,7 +6902,7 @@ i40e_find_mac_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f; TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) return f; } @@ -7575,9 +7575,9 @@ i40e_tunnel_filter_convert( struct i40e_aqc_cloud_filters_element_bb *cld_filter, struct i40e_tunnel_filter *tunnel_filter) { - ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, (struct rte_ether_addr *)&tunnel_filter->input.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, (struct rte_ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->element.inner_vlan; if ((rte_le_to_cpu_16(cld_filter->element.flags) & @@ -7686,9 +7686,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - ether_addr_copy(&tunnel_filter->outer_mac, + rte_ether_addr_copy(&tunnel_filter->outer_mac, (struct rte_ether_addr *)&pfilter->element.outer_mac); - ether_addr_copy(&tunnel_filter->inner_mac, + rte_ether_addr_copy(&tunnel_filter->inner_mac, (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = @@ -8133,9 +8133,9 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - ether_addr_copy(&tunnel_filter->outer_mac, + rte_ether_addr_copy(&tunnel_filter->outer_mac, (struct rte_ether_addr *)&pfilter->element.outer_mac); - ether_addr_copy(&tunnel_filter->inner_mac, + rte_ether_addr_copy(&tunnel_filter->inner_mac, (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = @@ -8616,13 +8616,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(&filter->outer_mac))) { + (rte_is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(&filter->inner_mac))) { + (rte_is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } @@ -11948,13 +11948,13 @@ static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, struct i40e_mac_filter *f; int ret; - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) break; } @@ -12072,9 +12072,9 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) vsi = vf->vsi; } memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, (struct rte_ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = f->input.inner_vlan; cld_filter.element.flags = f->input.flags; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 6fe062d16..ba9dd348f 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -787,7 +787,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev, int err; struct vf_cmd_info args; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x", addr->addr_bytes[0], addr->addr_bytes[1], addr->addr_bytes[2], addr->addr_bytes[3], @@ -1273,10 +1273,10 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) + if (rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; else - eth_random_addr(hw->mac.addr); /* Generate a random one */ + rte_eth_random_addr(hw->mac.addr); /* Generate a random one */ I40E_WRITE_REG(hw, I40E_VFINT_DYN_CTL01, (I40E_ITR_INDEX_DEFAULT << @@ -1511,7 +1511,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); return 0; @@ -1937,7 +1937,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) j = 0; len = sizeof(struct virtchnl_ether_addr_list); for (i = begin; i < I40E_NUM_MACADDR_MAX; i++, next_begin++) { - if (is_zero_ether_addr(&dev->data->mac_addrs[i])) + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[i])) continue; len += sizeof(struct virtchnl_ether_addr); if (len >= I40E_AQ_BUF_SZ) { @@ -1954,7 +1954,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) for (i = begin; i < next_begin; i++) { addr = &dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); @@ -2707,7 +2707,7 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } @@ -2720,7 +2720,7 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0) return -EIO; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index ae88ccd48..e21a8f63b 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2007,9 +2007,9 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2028,7 +2028,7 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { @@ -2485,8 +2485,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, eth_mask = item->mask; if (eth_spec && eth_mask) { - if (!is_zero_ether_addr(ð_mask->src) || - !is_zero_ether_addr(ð_mask->dst)) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + !rte_is_zero_ether_addr(ð_mask->dst)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -3326,8 +3326,8 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, /* DST address of inner MAC shouldn't be masked. * SRC address of Inner MAC should be masked. */ - if (!is_broadcast_ether_addr(ð_mask->dst) || - !is_zero_ether_addr(ð_mask->src) || + if (!rte_is_broadcast_ether_addr(ð_mask->dst) || + !rte_is_zero_ether_addr(ð_mask->src) || eth_mask->type) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -3556,8 +3556,8 @@ i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, /* DST address of inner MAC shouldn't be masked. * SRC address of Inner MAC should be masked. */ - if (!is_broadcast_ether_addr(ð_mask->dst) || - !is_zero_ether_addr(ð_mask->src) || + if (!rte_is_broadcast_ether_addr(ð_mask->dst) || + !rte_is_zero_ether_addr(ð_mask->src) || eth_mask->type) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -4803,9 +4803,9 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, int ret = 0; memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, (struct rte_ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = filter->input.inner_vlan; cld_filter.element.flags = filter->input.flags; diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 4d7001df5..6a86ec57b 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -348,7 +348,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, vf_res->vsi_res[0].vsi_type = VIRTCHNL_VSI_SRIOV; vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; - ether_addr_copy(&vf->mac_addr, + rte_ether_addr_copy(&vf->mac_addr, (struct rte_ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: @@ -845,7 +845,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, mac = (struct rte_ether_addr *)(addr_list->list[i].addr); rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - if (is_zero_ether_addr(mac) || + if (rte_is_zero_ether_addr(mac) || i40e_vsi_add_mac(vf->vsi, &filter)) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; @@ -887,7 +887,7 @@ i40e_pf_host_process_cmd_del_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); - if(is_zero_ether_addr(mac) || + if(rte_is_zero_ether_addr(mac) || i40e_vsi_delete_mac(vf->vsi, mac)) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index e6f18ab28..c4ba8f89a 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -560,7 +560,7 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, return -EINVAL; } - ether_addr_copy(mac_addr, &vf->mac_addr); + rte_ether_addr_copy(mac_addr, &vf->mac_addr); /* Remove all existing mac */ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) @@ -604,9 +604,9 @@ rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, return -EINVAL; } - if (is_same_ether_addr(mac_addr, &vf->mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &vf->mac_addr)) /* Reset the mac with NULL address */ - ether_addr_copy(&null_mac_addr, &vf->mac_addr); + rte_ether_addr_copy(&null_mac_addr, &vf->mac_addr); /* Remove the mac */ i40e_vsi_delete_mac(vsi, mac_addr); @@ -2387,7 +2387,7 @@ rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, } mac_filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - ether_addr_copy(mac_addr, &mac_filter.mac_addr); + rte_ether_addr_copy(mac_addr, &mac_filter.mac_addr); ret = i40e_vsi_add_mac(vsi, &mac_filter); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to add MAC filter."); @@ -2514,7 +2514,7 @@ rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct rte_ether_addr *vf_ma vf = &pf->vfs[vf_id]; mac = &vf->mac_addr; - if (is_same_ether_addr(mac, vf_mac)) + if (rte_is_same_ether_addr(mac, vf_mac)) return vf_id; } diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 7ecd86804..b56fbcb13 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -696,7 +696,7 @@ iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); int err; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); return -EINVAL; } @@ -941,11 +941,11 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, old_addr = (struct rte_ether_addr *)hw->mac.addr; perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; - if (is_same_ether_addr(mac_addr, old_addr)) + if (rte_is_same_ether_addr(mac_addr, old_addr)) return 0; /* If the MAC address is configured by host, skip the setting */ - if (is_valid_assigned_ether_addr(perm_addr)) + if (rte_is_valid_assigned_ether_addr(perm_addr)) return -EPERM; ret = iavf_add_del_eth_addr(adapter, old_addr, FALSE); @@ -973,7 +973,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, if (ret) return -EIO; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } @@ -1244,9 +1244,9 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) /* If the MAC address is not configured by host, * generate a random one. */ - if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) - eth_random_addr(hw->mac.addr); - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + if (!rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) + rte_eth_random_addr(hw->mac.addr); + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* register callback func to eal lib */ diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 0303e7809..674682b05 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -647,7 +647,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) len = sizeof(struct virtchnl_ether_addr_list); for (i = begin; i < IAVF_NUM_MACADDR_MAX; i++, next_begin++) { addr = &adapter->eth_dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; len += sizeof(struct virtchnl_ether_addr); if (len >= IAVF_AQ_BUF_SZ) { @@ -664,7 +664,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) for (i = begin; i < next_begin; i++) { addr = &adapter->eth_dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 092051a9c..91f052852 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -479,13 +479,13 @@ ice_init_mac_address(struct rte_eth_dev *dev) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!is_unicast_ether_addr + if (!rte_is_unicast_ether_addr ((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr)) { PMD_INIT_LOG(ERR, "Invalid MAC address"); return -EINVAL; } - ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0); @@ -495,7 +495,7 @@ ice_init_mac_address(struct rte_eth_dev *dev) return -ENOMEM; } /* store it to dev data */ - ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, &dev->data->mac_addrs[0]); return 0; } @@ -507,7 +507,7 @@ ice_find_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *macaddr) struct ice_mac_filter *f; TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) return f; } @@ -2243,13 +2243,13 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, uint8_t flags = 0; int ret; - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) break; } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index a3b045e71..6b44ca4c1 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1222,7 +1222,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ @@ -1656,7 +1656,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } /* Generate a random MAC address, if none was assigned by PF. */ - if (is_zero_ether_addr(perm_addr)) { + if (rte_is_zero_ether_addr(perm_addr)) { generate_random_mac_addr(perm_addr); diag = ixgbe_set_rar_vf(hw, 1, perm_addr->addr_bytes, 0, 1); if (diag) { @@ -1676,7 +1676,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]); /* reset the hardware with the new settings */ diag = hw->mac.ops.start_hw(hw); @@ -6085,7 +6085,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) if (i == index) continue; /* Skip NULL MAC addresses */ - if (is_zero_ether_addr(mac_addr)) + if (rte_is_zero_ether_addr(mac_addr)) continue; /* Skip the permanent MAC address */ if (memcmp(perm_addr, mac_addr, sizeof(struct rte_ether_addr)) == 0) diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index f0fafebc8..7024354cd 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -744,9 +744,9 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid ether address mask"); @@ -763,7 +763,7 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 6180c9473..37521af7c 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -46,7 +46,7 @@ int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) uint16_t vfn; for (vfn = 0; vfn < vf_num; vfn++) { - eth_random_addr(vf_mac_addr); + 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); @@ -463,7 +463,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { + if (rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 3defba175..45fc3a4ad 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -35,7 +35,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); rar_entry = hw->mac.num_rar_entries - (vf + 1); - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { + 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); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index a88469223..0e304fd00 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -363,7 +363,7 @@ eth_kni_create(struct rte_vdev_device *vdev, data->dev_link = pmd_link; data->mac_addrs = &internals->eth_addr; - eth_random_addr(internals->eth_addr.addr_bytes); + rte_eth_random_addr(internals->eth_addr.addr_bytes); eth_dev->dev_ops = ð_kni_ops; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 925581a78..fea9f4922 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1835,7 +1835,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) 2 + i)); /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); /* enable firmware checksum support for tunnel packets */ lio_enable_hw_tunnel_rx_checksum(eth_dev); diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index ea2709b29..9c87694a2 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -1399,7 +1399,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) mac = &priv->mac[i]; else mac = ð_mask.dst; - if (is_zero_ether_addr(mac)) + if (rte_is_zero_ether_addr(mac)) continue; /* Check if MAC flow rule is already present. */ for (flow = LIST_FIRST(&priv->flows); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 90f586675..938f68c19 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -3334,7 +3334,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, " parameter is ignored"); break; } - if (!is_zero_ether_addr(&mask.eth->dst)) { + if (!rte_is_zero_ether_addr(&mask.eth->dst)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, spec.eth->dst.addr_bytes); @@ -3342,7 +3342,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, ETHER_ADDR_LEN, mask.eth->dst.addr_bytes); } - if (!is_zero_ether_addr(&mask.eth->src)) { + if (!rte_is_zero_ether_addr(&mask.eth->src)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, spec.eth->src.addr_bytes); diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 9f6b89a82..9204c5f52 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -71,7 +71,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) const int vf = priv->config.vf; assert(index < MLX5_MAX_MAC_ADDRESSES); - if (is_zero_ether_addr(&dev->data->mac_addrs[index])) + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[index])) return; if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], @@ -101,7 +101,7 @@ mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, unsigned int i; assert(index < MLX5_MAX_MAC_ADDRESSES); - if (is_zero_ether_addr(mac)) { + if (rte_is_zero_ether_addr(mac)) { rte_errno = EINVAL; return -rte_errno; } diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index e0de54489..19b4e346f 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -340,7 +340,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) #ifndef NDEBUG char m[18]; - ether_format_addr(m, 18, RTA_DATA(attribute)); + rte_ether_format_addr(m, 18, RTA_DATA(attribute)); DRV_LOG(DEBUG, "bridge MAC address %s", m); #endif memcpy(&(*data->mac)[data->mac_n++], @@ -555,14 +555,14 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) /* Verify the address is not in the array yet. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) - if (is_same_ether_addr(&macs[i], + if (rte_is_same_ether_addr(&macs[i], &dev->data->mac_addrs[j])) break; if (j != MLX5_MAX_MAC_ADDRESSES) continue; /* Find the first entry available. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) { - if (is_zero_ether_addr(&dev->data->mac_addrs[j])) { + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) { dev->data->mac_addrs[j] = macs[i]; break; } diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index d539ba6a1..9ec71c3c1 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -595,7 +595,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = neta_ppio_remove_mac_addr(priv->ppio, dev->data->mac_addrs[index].addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), + rte_ether_format_addr(buf, sizeof(buf), &dev->data->mac_addrs[index]); MVNETA_LOG(ERR, "Failed to remove mac %s", buf); } @@ -633,7 +633,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, ret = neta_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to add mac %s", buf); return -1; } @@ -661,7 +661,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]; - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to set mac to %s", buf); } return 0; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 8647c9b0d..4c6edb41d 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1080,7 +1080,7 @@ mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = pp2_ppio_remove_mac_addr(priv->ppio, dev->data->mac_addrs[index].addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), + rte_ether_format_addr(buf, sizeof(buf), &dev->data->mac_addrs[index]); MRVL_LOG(ERR, "Failed to remove mac %s", buf); } @@ -1134,7 +1134,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, */ ret = pp2_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to add mac %s", buf); return -1; } @@ -1168,7 +1168,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]; - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to set mac to %s", buf); } diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index cfb502523..ef5abd37b 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -128,8 +128,8 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) } ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) stats->broadcast++; else stats->multicast++; diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index 6a851a8ff..dbec4551f 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -42,7 +42,7 @@ static int hn_vf_match(const struct rte_eth_dev *dev) if (vf_dev == dev) continue; - if (is_same_ether_addr(mac, vf_mac)) + if (rte_is_same_ether_addr(mac, vf_mac)) return i; } return -ENOENT; diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index c1b42e504..a54243392 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2962,16 +2962,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_vf_read_mac(hw); } - if (!is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { + if (!rte_is_valid_assigned_ether_addr((struct rte_ether_addr *)&hw->mac_addr)) { PMD_INIT_LOG(INFO, "Using random mac address for port %d", port); /* Using random mac addresses for VFs */ - eth_random_addr(&hw->mac_addr[0]); + rte_eth_random_addr(&hw->mac_addr[0]); nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr); } /* Copying mac address to DPDK eth_dev struct */ - ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 7683511cf..d1d49b53b 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -535,7 +535,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, internals->packet_size = packet_size; internals->packet_copy = packet_copy; internals->port_id = eth_dev->data->port_id; - eth_random_addr(internals->eth_addr.addr_bytes); + rte_eth_random_addr(internals->eth_addr.addr_bytes); internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK; internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_RETA_GROUP_SIZE; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 205740016..243c6974e 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -580,7 +580,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, DP_ERR(edev, "Did not allocate memory for ucast\n"); return -ENOMEM; } - ether_addr_copy(mac_addr, &u->mac); + rte_ether_addr_copy(mac_addr, &u->mac); u->vlan = ucast->vlan; u->vni = ucast->vni; SLIST_INSERT_HEAD(&qdev->uc_list_head, u, list); @@ -622,14 +622,14 @@ qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_ad DP_ERR(edev, "Did not allocate memory for mcast\n"); return -ENOMEM; } - ether_addr_copy(&mc_addrs[i], &m->mac); + rte_ether_addr_copy(&mc_addrs[i], &m->mac); SLIST_INSERT_HEAD(&qdev->mc_list_head, m, list); } memset(&mcast, 0, sizeof(mcast)); mcast.num_mc_addrs = mc_addrs_num; mcast.opcode = ECORE_FILTER_ADD; for (i = 0; i < mc_addrs_num; i++) - ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) + rte_ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) &mcast.mac[i]); rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { @@ -654,7 +654,7 @@ static int qede_del_mcast_filters(struct rte_eth_dev *eth_dev) mcast.opcode = ECORE_FILTER_REMOVE; j = 0; SLIST_FOREACH(tmp, &qdev->mc_list_head, list) { - ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); + rte_ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); j++; } rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); @@ -707,13 +707,13 @@ qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, struct ecore_filter_ucast ucast; int re; - if (!is_valid_assigned_ether_addr(mac_addr)) + if (!rte_is_valid_assigned_ether_addr(mac_addr)) return -EINVAL; qede_set_ucast_cmn_params(&ucast); ucast.opcode = ECORE_FILTER_ADD; ucast.type = ECORE_FILTER_MAC; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); re = (int)qede_mac_int_ops(eth_dev, &ucast, 1); return re; } @@ -733,7 +733,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) return; } - if (!is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) + if (!rte_is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) return; qede_set_ucast_cmn_params(&ucast); @@ -741,7 +741,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) ucast.type = ECORE_FILTER_MAC; /* Use the index maintained by rte */ - ether_addr_copy(ð_dev->data->mac_addrs[index], + rte_ether_addr_copy(ð_dev->data->mac_addrs[index], (struct rte_ether_addr *)&ucast.mac); qede_mac_int_ops(eth_dev, &ucast, false); @@ -1771,7 +1771,7 @@ qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mc_add } for (i = 0; i < mc_addrs_num; i++) { - if (!is_multicast_ether_addr(&mc_addrs[i])) { + if (!rte_is_multicast_ether_addr(&mc_addrs[i])) { DP_ERR(edev, "Not a valid multicast MAC\n"); return -EINVAL; } @@ -2549,10 +2549,10 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) } if (!is_vf) { - ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. + rte_ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. hw_info.hw_mac_addr, ð_dev->data->mac_addrs[0]); - ether_addr_copy(ð_dev->data->mac_addrs[0], + rte_ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); } else { ecore_vf_read_bulletin(ECORE_LEADING_HWFN(edev), @@ -2565,9 +2565,9 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) &is_mac_forced); if (is_mac_exist) { DP_INFO(edev, "VF macaddr received from PF\n"); - ether_addr_copy((struct rte_ether_addr *)&vf_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&vf_mac, ð_dev->data->mac_addrs[0]); - ether_addr_copy(ð_dev->data->mac_addrs[0], + rte_ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); } else { DP_ERR(edev, "No VF macaddr assigned\n"); diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 2a5fb22e3..3324194d5 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -945,7 +945,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) * Copy the address to the device private data so that * it could be recalled in the case of adapter restart. */ - ether_addr_copy(mac_addr, &port->default_mac_addr); + rte_ether_addr_copy(mac_addr, &port->default_mac_addr); /* * Neither of the two following checks can return @@ -1005,7 +1005,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) unlock: if (rc != 0) - ether_addr_copy(old_addr, &port->default_mac_addr); + rte_ether_addr_copy(old_addr, &port->default_mac_addr); sfc_adapter_unlock(sa); @@ -2088,7 +2088,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) * Linux kernel. Copy from NIC config to Ethernet device data. */ from = (const struct rte_ether_addr *)(encp->enc_mac_addr); - ether_addr_copy(from, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(from, &dev->data->mac_addrs[0]); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index cffcd9a4c..26d7de91e 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -278,7 +278,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, if (spec == NULL) return 0; - if (is_same_ether_addr(&mask->dst, &supp_mask.dst)) { + if (rte_is_same_ether_addr(&mask->dst, &supp_mask.dst)) { efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_LOC_MAC : EFX_FILTER_MATCH_LOC_MAC; @@ -286,7 +286,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, EFX_MAC_ADDR_LEN); } else if (memcmp(mask->dst.addr_bytes, ig_mask, EFX_MAC_ADDR_LEN) == 0) { - if (is_unicast_ether_addr(&spec->dst)) + if (rte_is_unicast_ether_addr(&spec->dst)) efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST : EFX_FILTER_MATCH_UNKNOWN_UCAST_DST; @@ -294,7 +294,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST : EFX_FILTER_MATCH_UNKNOWN_MCAST_DST; - } else if (!is_zero_ether_addr(&mask->dst)) { + } else if (!rte_is_zero_ether_addr(&mask->dst)) { goto fail_bad_mask; } @@ -303,11 +303,11 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, * ethertype masks are equal to zero in inner frame, * so these fields are filled in only for the outer frame */ - if (is_same_ether_addr(&mask->src, &supp_mask.src)) { + if (rte_is_same_ether_addr(&mask->src, &supp_mask.src)) { efx_spec->efs_match_flags |= EFX_FILTER_MATCH_REM_MAC; rte_memcpy(efx_spec->efs_rem_mac, spec->src.addr_bytes, EFX_MAC_ADDR_LEN); - } else if (!is_zero_ether_addr(&mask->src)) { + } else if (!rte_is_zero_ether_addr(&mask->src)) { goto fail_bad_mask; } diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 8de5f0c60..23313e125 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -402,7 +402,7 @@ sfc_port_attach(struct sfc_adapter *sa) RTE_BUILD_BUG_ON(sizeof(encp->enc_mac_addr) != sizeof(*from)); from = (const struct rte_ether_addr *)(encp->enc_mac_addr); - ether_addr_copy(from, &port->default_mac_addr); + rte_ether_addr_copy(from, &port->default_mac_addr); port->max_mcast_addrs = EFX_MAC_MULTICAST_LIST_MAX; port->nb_mcast_addrs = 0; diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index aefc384dc..fdcd44e35 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -1681,9 +1681,9 @@ flow_rule_action_get(struct pmd_internals *softnic, item, "VXLAN ENCAP: first encap item should be ether"); } - ether_addr_copy(&spec.eth.dst, + rte_ether_addr_copy(&spec.eth.dst, &rule_action->encap.vxlan.ether.da); - ether_addr_copy(&spec.eth.src, + rte_ether_addr_copy(&spec.eth.src, &rule_action->encap.vxlan.ether.sa); item++; diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 43a66432a..99de9f4e6 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1522,7 +1522,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi) return -ENOMEM; } - ether_addr_copy(ð_addr, data->mac_addrs); + rte_ether_addr_copy(ð_addr, data->mac_addrs); PMD_INIT_LOG(INFO, "%s device %s successfully initialized", RTE_STR(RTE_SZEDATA2_DRIVER_NAME), data->name); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 3206c533f..df92a536c 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1163,7 +1163,7 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) return -ENOTSUP; } - if (is_zero_ether_addr(mac_addr)) { + if (rte_is_zero_ether_addr(mac_addr)) { TAP_LOG(ERR, "%s: can't set an empty MAC address", dev->device->name); return -EINVAL; @@ -1172,14 +1172,14 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY); if (ret < 0) return ret; - if (is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (rte_is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) return 0; /* Check the current MAC address on the remote */ ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY); if (ret < 0) return ret; - if (!is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (!rte_is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; @@ -1753,8 +1753,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, } if (pmd->type == ETH_TUNTAP_TYPE_TAP) { - if (is_zero_ether_addr(mac_addr)) - eth_random_addr((uint8_t *)&pmd->eth_addr); + if (rte_is_zero_ether_addr(mac_addr)) + rte_eth_random_addr((uint8_t *)&pmd->eth_addr); else rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); } diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index d155618fc..20963090c 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -537,14 +537,14 @@ tap_flow_create_eth(const struct rte_flow_item *item, void *data) if (!flow) return 0; msg = &flow->msg; - if (!is_zero_ether_addr(&mask->dst)) { + if (!rte_is_zero_ether_addr(&mask->dst)) { tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, &spec->dst.addr_bytes); tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST_MASK, ETHER_ADDR_LEN, &mask->dst.addr_bytes); } - if (!is_zero_ether_addr(&mask->src)) { + if (!rte_is_zero_ether_addr(&mask->src)) { tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, &spec->src.addr_bytes); tap_nlattr_add(&msg->nh, diff --git a/drivers/net/thunderx/base/nicvf_mbox.c b/drivers/net/thunderx/base/nicvf_mbox.c index 2a793a4b1..332a249e8 100644 --- a/drivers/net/thunderx/base/nicvf_mbox.c +++ b/drivers/net/thunderx/base/nicvf_mbox.c @@ -135,7 +135,7 @@ nicvf_handle_mbx_intr(struct nicvf *nic) nic->node = mbx.nic_cfg.node_id; nic->sqs_mode = mbx.nic_cfg.sqs_mode; nic->loopback_supported = mbx.nic_cfg.loopback_supported; - ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mbx.nic_cfg.mac_addr, (struct rte_ether_addr *)nic->mac_addr); nic->pf_acked = true; break; diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index ec2087924..482968b7a 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2179,10 +2179,10 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) ret = -ENOMEM; goto alarm_fail; } - if (is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) - eth_random_addr(&nic->mac_addr[0]); + if (rte_is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) + rte_eth_random_addr(&nic->mac_addr[0]); - ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, ð_dev->data->mac_addrs[0]); ret = nicvf_mbox_set_mac_addr(nic, nic->mac_addr); diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index ef02fdcdd..ad13eac3b 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -387,7 +387,7 @@ vdev_netvsc_device_probe(const struct if_nameindex *iface, strlcpy(ctx->if_name, iface->if_name, sizeof(ctx->if_name)); return 0; } - if (!is_same_ether_addr(eth_addr, &ctx->if_addr)) + if (!rte_is_same_ether_addr(eth_addr, &ctx->if_addr)) return 0; /* Look for associated PCI device. */ ret = vdev_netvsc_sysfs_readlink(buf, sizeof(buf), iface->if_name, @@ -544,7 +544,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, pair->value); return -EINVAL; } - if (is_same_ether_addr(eth_addr, &tmp)) + if (rte_is_same_ether_addr(eth_addr, &tmp)) break; } } diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 6705e90db..774774b94 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -329,8 +329,8 @@ vhost_count_multicast_broadcast(struct vhost_queue *vq, struct vhost_stats *pstats = &vq->stats; ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) pstats->xstats[VHOST_BROADCAST_PKT]++; else pstats->xstats[VHOST_MULTICAST_PKT]++; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index d34d94482..445f89989 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1108,7 +1108,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) offsetof(struct virtio_net_config, mac), &hw->mac_addr, ETHER_ADDR_LEN); } else { - eth_random_addr(&hw->mac_addr[0]); + rte_eth_random_addr(&hw->mac_addr[0]); virtio_set_hwaddr(hw); } } @@ -1164,7 +1164,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, const struct rte_ether_addr *addr = (i == index) ? mac_addr : addrs + i; struct virtio_net_ctrl_mac *tbl - = is_multicast_ether_addr(addr) ? mc : uc; + = rte_is_multicast_ether_addr(addr) ? mc : uc; memcpy(&tbl->macs[tbl->entries++], addr, ETHER_ADDR_LEN); } @@ -1193,10 +1193,10 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { struct virtio_net_ctrl_mac *tbl; - if (i == index || is_zero_ether_addr(addrs + i)) + if (i == index || rte_is_zero_ether_addr(addrs + i)) continue; - tbl = is_multicast_ether_addr(addrs + i) ? mc : uc; + tbl = rte_is_multicast_ether_addr(addrs + i) ? mc : uc; memcpy(&tbl->macs[tbl->entries++], addrs + i, ETHER_ADDR_LEN); } @@ -1662,7 +1662,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Copy the permanent MAC address to: virtio_hw */ virtio_get_hwaddr(hw); - ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->mac_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index d6f46586e..ab3b6cf1b 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1114,8 +1114,8 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) } ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) stats->broadcast++; else stats->multicast++; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 2c42f2677..3ac65d0e4 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -311,7 +311,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *) hw->perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -1189,7 +1189,7 @@ vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct vmxnet3_hw *hw = dev->data->dev_private; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); vmxnet3_write_mac(hw, mac_addr->addr_bytes); return 0; } diff --git a/examples/bond/main.c b/examples/bond/main.c index 8b510cab8..23171f4cf 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -387,12 +387,12 @@ static int lcore_main(__attribute__((unused)) void *arg1) if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) { arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); - ether_addr_copy(&arp_hdr->arp_data.arp_sha, &arp_hdr->arp_data.arp_tha); + rte_ether_addr_copy(&arp_hdr->arp_data.arp_sha, &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = arp_hdr->arp_data.arp_sip; rte_eth_macaddr_get(BOND_PORT, &d_addr); - ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1); is_free = 1; @@ -407,7 +407,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) } ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); ipv4_hdr->dst_addr = ipv4_hdr->src_addr; ipv4_hdr->src_addr = bond_ip; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index 27c22cf90..3d2a70d52 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -161,8 +161,8 @@ static void process_frame(struct app_port *ptr_port, struct rte_ether_hdr *ptr_mac_hdr; ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *); - ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); - ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); + rte_ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); + rte_ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); } static int slave_main(__attribute__((unused)) void *ptr_data) diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index 299488c1c..571c4e5aa 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -327,7 +327,7 @@ rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused, { if (addr == NULL) return -EINVAL; - return is_valid_assigned_ether_addr(addr); + return rte_is_valid_assigned_ether_addr(addr); } int diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index ef23d963a..8e30393d0 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -104,8 +104,8 @@ exchange_mac(struct rte_mbuf *m) /* change mac addresses on packet (to use mbuf data) */ eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ether_addr_copy(ð->d_addr, &addr); - ether_addr_copy(&addr, ð->d_addr); + rte_ether_addr_copy(ð->d_addr, &addr); + rte_ether_addr_copy(&addr, ð->d_addr); } static __rte_always_inline void diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index 7b8e7c4fa..cf9421874 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -48,7 +48,7 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 175803078..ed92d6f06 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -353,7 +353,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, *((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)port_out << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[port_out], ð_hdr->s_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); else @@ -571,7 +571,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 226153968..3a98e644f 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -409,7 +409,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, *((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } @@ -694,7 +694,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 10af1280a..959fa569a 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1429,7 +1429,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 a38aabe75..8f84545df 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -277,8 +277,8 @@ mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_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); /* Put new packet into the output queue */ @@ -538,7 +538,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/kni/main.c b/examples/kni/main.c index e4e27e87e..c96095f5f 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -835,7 +835,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); RTE_LOG(INFO, APP, "\t%s%s\n", name, buf); } diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index dd09855e7..a77b000a9 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -603,7 +603,7 @@ l2fwd_mac_updating(struct rte_mbuf *m, uint16_t dest_portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } static void diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 033104d63..77e44dc82 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -349,7 +349,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 21d19932d..9831a4323 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -179,7 +179,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index c1d6797b0..1e2b14297 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -161,7 +161,7 @@ l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } static void diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index ed25f75d8..4b94c246a 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1757,7 +1757,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 bcd584d3e..7d57a7f39 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -700,7 +700,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -725,7 +725,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); #else @@ -1580,7 +1580,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 2c0c89e21..56a55ac28 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -450,7 +450,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); @@ -791,7 +791,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 5612ef378..4a7336350 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -47,7 +47,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { @@ -68,7 +68,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else { diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 28635bf03..323f853ee 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -43,7 +43,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -64,7 +64,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else { diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index a91a0a16c..ad013bae8 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -637,7 +637,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -895,7 +895,7 @@ main(int argc, char **argv) /* * prepare src MACs for each port. */ - ether_addr_copy(&ports_eth_addr[portid], + rte_ether_addr_copy(&ports_eth_addr[portid], (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 9997c58f4..9cd4dc7a6 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -176,7 +176,7 @@ lsi_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index b29ed9e97..bd1ec8fa0 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -1070,14 +1070,14 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); send_single_packet(m[0], (uint8_t)dst_port[0]); send_single_packet(m[1], (uint8_t)dst_port[1]); @@ -1204,14 +1204,14 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); send_single_packet(m[0], dst_port[0]); send_single_packet(m[1], dst_port[1]); @@ -1262,7 +1262,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -1283,7 +1283,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } else @@ -3024,7 +3024,7 @@ print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3582,7 +3582,7 @@ main(int argc, char **argv) /* * prepare src MACs for each port. */ - ether_addr_copy(&ports_eth_addr[portid], + rte_ether_addr_copy(&ports_eth_addr[portid], (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 7d28f59ce..1266f521c 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -401,7 +401,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ - ether_addr_copy(ð_multicast, ð_hdr->d_addr); + rte_ether_addr_copy(ð_multicast, ð_hdr->d_addr); eth_hdr->ether_type = htons(PTP_PROTOCOL); ptp_msg = (struct ptp_message *) diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 61e92a820..a61360b99 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -67,7 +67,7 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) pause_frame = (struct ether_fc_frame *) &hdr[1]; rte_eth_macaddr_get(port_id, &mac_addr); - ether_addr_copy(&mac_addr, &hdr->s_addr); + rte_ether_addr_copy(&mac_addr, &hdr->s_addr); void *tmp = &hdr->d_addr.addr_bytes[0]; *((uint64_t *)tmp) = 0x010000C28001ULL; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index e4af7bc4d..18a2215b4 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -243,7 +243,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) /* Learn MAC address of guest device from packet */ pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { + if (rte_is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: This device is using an existing" " MAC address and has not been registered.\n", @@ -261,11 +261,11 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; /* inner MAC */ - ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.queue_id = vdev->rx_q; tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; @@ -309,9 +309,9 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) } vxdev.out_key = tenant_id_conf[vdev->rx_q]; - ether_addr_copy(&vxdev.port[portid].peer_mac, + rte_ether_addr_copy(&vxdev.port[portid].peer_mac, &app_l2_hdr[portid].d_addr); - ether_addr_copy(&ports_eth_addr[0], + 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); @@ -349,8 +349,8 @@ vxlan_unlink(struct vhost_dev *vdev) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); - ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 5a3614117..96d697677 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -666,7 +666,7 @@ find_vhost_dev(struct rte_ether_addr *mac) TAILQ_FOREACH(vdev, &vhost_dev_list, global_vdev_entry) { if (vdev->ready == DEVICE_RX && - is_same_ether_addr(mac, &vdev->mac_address)) + rte_is_same_ether_addr(mac, &vdev->mac_address)) return vdev; } @@ -914,7 +914,7 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) { + if (unlikely(rte_is_broadcast_ether_addr(&nh->d_addr))) { struct vhost_dev *vdev2; TAILQ_FOREACH(vdev2, &vhost_dev_list, global_vdev_entry) { diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 5195a515a..7281ffd7f 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -417,7 +417,7 @@ update_mac_address(struct rte_mbuf *m, unsigned dst_port) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); } /* When we receive a HUP signal, print out our stats */ diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 75cf31a10..389000327 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -504,7 +504,7 @@ update_mac_address(struct rte_mbuf *m, unsigned dst_port) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); } /* When we receive a HUP signal, print out our stats */ diff --git a/lib/librte_ethdev/rte_class_eth.c b/lib/librte_ethdev/rte_class_eth.c index e554668da..873a65353 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/rte_class_eth.c @@ -61,7 +61,7 @@ eth_mac_cmp(const char *key __rte_unused, /* Return 0 if devargs MAC is matching one of the device MACs. */ rte_eth_dev_info_get(data->port_id, &dev_info); for (index = 0; index < dev_info.max_mac_addrs; index++) - if (is_same_ether_addr(&mac, &data->mac_addrs[index])) + if (rte_is_same_ether_addr(&mac, &data->mac_addrs[index])) return 0; return -1; /* no match */ } diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index e5fc7ffdf..f5e4e2d12 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1360,7 +1360,7 @@ rte_eth_dev_mac_restore(struct rte_eth_dev *dev, addr = &dev->data->mac_addrs[i]; /* skip zero address */ - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; pool = 0; @@ -2594,7 +2594,7 @@ rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr) RTE_ETH_VALID_PORTID_OR_RET(port_id); dev = &rte_eth_devices[port_id]; - ether_addr_copy(&dev->data->mac_addrs[0], mac_addr); + rte_ether_addr_copy(&dev->data->mac_addrs[0], mac_addr); } @@ -3106,7 +3106,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP); - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n", port_id); return -EINVAL; @@ -3137,7 +3137,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, if (ret == 0) { /* Update address in NIC data structure */ - ether_addr_copy(addr, &dev->data->mac_addrs[index]); + rte_ether_addr_copy(addr, &dev->data->mac_addrs[index]); /* Update pool bitmap in NIC data structure */ dev->data->mac_pool_sel[index] |= (1ULL << pool); @@ -3169,7 +3169,7 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr) (*dev->dev_ops->mac_addr_remove)(dev, index); /* Update address in NIC data structure */ - ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]); + rte_ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]); /* reset pool bitmap */ dev->data->mac_pool_sel[index] = 0; @@ -3185,7 +3185,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); - if (!is_valid_assigned_ether_addr(addr)) + if (!rte_is_valid_assigned_ether_addr(addr)) return -EINVAL; dev = &rte_eth_devices[port_id]; @@ -3196,7 +3196,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) return ret; /* Update default address in NIC data structure */ - ether_addr_copy(addr, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(addr, &dev->data->mac_addrs[0]); return 0; } @@ -3236,7 +3236,7 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n", port_id); return -EINVAL; @@ -3268,10 +3268,10 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, if (ret == 0) { /* Update address in NIC data structure */ if (on) - ether_addr_copy(addr, + rte_ether_addr_copy(addr, &dev->data->hash_mac_addrs[index]); else - ether_addr_copy(&null_mac_addr, + rte_ether_addr_copy(&null_mac_addr, &dev->data->hash_mac_addrs[index]); } diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 284219517..99c9c7d91 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -160,8 +160,8 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, dst = &(tbl->flows[flow_idx].key); - ether_addr_copy(&(src->eth_saddr), &(dst->eth_saddr)); - ether_addr_copy(&(src->eth_daddr), &(dst->eth_daddr)); + rte_ether_addr_copy(&(src->eth_saddr), &(dst->eth_saddr)); + rte_ether_addr_copy(&(src->eth_daddr), &(dst->eth_daddr)); dst->ip_src_addr = src->ip_src_addr; dst->ip_dst_addr = src->ip_dst_addr; dst->recv_ack = src->recv_ack; @@ -243,8 +243,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); - ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr)); - ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr)); + rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr)); + rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr)); key.ip_src_addr = ipv4_hdr->src_addr; key.ip_dst_addr = ipv4_hdr->dst_addr; key.src_port = tcp_hdr->src_port; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 988cca8c6..ce3471a4d 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -187,8 +187,8 @@ uint32_t gro_tcp4_tbl_pkt_count(void *tbl); static inline int is_same_tcp4_flow(struct tcp4_flow_key k1, struct tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && - is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && + return (rte_is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && + rte_is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && (k1.ip_src_addr == k2.ip_src_addr) && (k1.ip_dst_addr == k2.ip_dst_addr) && (k1.recv_ack == k2.recv_ack) && diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index d713e3dd6..53425f6d3 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -164,9 +164,9 @@ insert_new_flow(struct gro_vxlan_tcp4_tbl *tbl, dst = &(tbl->flows[flow_idx].key); - ether_addr_copy(&(src->inner_key.eth_saddr), + rte_ether_addr_copy(&(src->inner_key.eth_saddr), &(dst->inner_key.eth_saddr)); - ether_addr_copy(&(src->inner_key.eth_daddr), + rte_ether_addr_copy(&(src->inner_key.eth_daddr), &(dst->inner_key.eth_daddr)); dst->inner_key.ip_src_addr = src->inner_key.ip_src_addr; dst->inner_key.ip_dst_addr = src->inner_key.ip_dst_addr; @@ -176,8 +176,8 @@ insert_new_flow(struct gro_vxlan_tcp4_tbl *tbl, dst->vxlan_hdr.vx_flags = src->vxlan_hdr.vx_flags; dst->vxlan_hdr.vx_vni = src->vxlan_hdr.vx_vni; - ether_addr_copy(&(src->outer_eth_saddr), &(dst->outer_eth_saddr)); - ether_addr_copy(&(src->outer_eth_daddr), &(dst->outer_eth_daddr)); + rte_ether_addr_copy(&(src->outer_eth_saddr), &(dst->outer_eth_saddr)); + rte_ether_addr_copy(&(src->outer_eth_daddr), &(dst->outer_eth_daddr)); dst->outer_ip_src_addr = src->outer_ip_src_addr; dst->outer_ip_dst_addr = src->outer_ip_dst_addr; dst->outer_src_port = src->outer_src_port; @@ -193,8 +193,8 @@ static inline int is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, struct vxlan_tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.outer_eth_saddr, &k2.outer_eth_saddr) && - is_same_ether_addr(&k1.outer_eth_daddr, + return (rte_is_same_ether_addr(&k1.outer_eth_saddr, &k2.outer_eth_saddr) && + rte_is_same_ether_addr(&k1.outer_eth_daddr, &k2.outer_eth_daddr) && (k1.outer_ip_src_addr == k2.outer_ip_src_addr) && (k1.outer_ip_dst_addr == k2.outer_ip_dst_addr) && @@ -356,8 +356,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); - ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr)); - ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr)); + rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr)); + rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr)); key.inner_key.ip_src_addr = ipv4_hdr->src_addr; key.inner_key.ip_dst_addr = ipv4_hdr->dst_addr; key.inner_key.recv_ack = tcp_hdr->recv_ack; @@ -366,8 +366,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, key.vxlan_hdr.vx_flags = vxlan_hdr->vx_flags; key.vxlan_hdr.vx_vni = vxlan_hdr->vx_vni; - ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr)); - ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr)); + rte_ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr)); + rte_ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr)); key.outer_ip_src_addr = outer_ipv4_hdr->src_addr; key.outer_ip_dst_addr = outer_ipv4_hdr->dst_addr; key.outer_src_port = udp_hdr->src_port; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 921adb4cf..2274dc65d 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -30,7 +30,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, /* Ethernet header. */ memset(eth_hdr->d_addr.addr_bytes, 0xff, ETHER_ADDR_LEN); - ether_addr_copy(mac, ð_hdr->s_addr); + rte_ether_addr_copy(mac, ð_hdr->s_addr); eth_hdr->ether_type = htons(ETHER_TYPE_RARP); /* RARP header. */ @@ -41,8 +41,8 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, rarp->arp_plen = 4; rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); - ether_addr_copy(mac, &rarp->arp_data.arp_sha); - ether_addr_copy(mac, &rarp->arp_data.arp_tha); + rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha); + rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha); memset(&rarp->arp_data.arp_sip, 0x00, 4); memset(&rarp->arp_data.arp_tip, 0x00, 4); diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index afdbaa1a7..cc31fbd9b 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -75,7 +75,7 @@ struct rte_ether_addr { * True (1) if the given two ethernet address are the same; * False (0) otherwise. */ -static inline int is_same_ether_addr(const struct rte_ether_addr *ea1, +static inline int rte_is_same_ether_addr(const struct rte_ether_addr *ea1, const struct rte_ether_addr *ea2) { int i; @@ -95,7 +95,7 @@ static inline int is_same_ether_addr(const struct rte_ether_addr *ea1, * True (1) if the given ethernet address is filled with zeros; * false (0) otherwise. */ -static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -114,7 +114,7 @@ static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a unicast address; * false (0) otherwise. */ -static inline int is_unicast_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; } @@ -129,7 +129,7 @@ static inline int is_unicast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a multicast address; * false (0) otherwise. */ -static inline int is_multicast_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; } @@ -144,7 +144,7 @@ static inline int is_multicast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a broadcast address; * false (0) otherwise. */ -static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_broadcast_ether_addr(const struct rte_ether_addr *ea) { const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; @@ -162,7 +162,7 @@ static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a universally assigned address; * false (0) otherwise. */ -static inline int is_universal_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; } @@ -177,7 +177,7 @@ static inline int is_universal_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a locally assigned address; * false (0) otherwise. */ -static inline int is_local_admin_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; } @@ -193,9 +193,9 @@ static inline int is_local_admin_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is valid; * false (0) otherwise. */ -static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) { - return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); + return rte_is_unicast_ether_addr(ea) && (!rte_is_zero_ether_addr(ea)); } /** @@ -204,7 +204,7 @@ static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) * @param addr * A pointer to Ethernet address. */ -static inline void eth_random_addr(uint8_t *addr) +static inline void rte_eth_random_addr(uint8_t *addr) { uint64_t rand = rte_rand(); uint8_t *p = (uint8_t *)&rand; @@ -222,7 +222,7 @@ static inline void eth_random_addr(uint8_t *addr) * @param ea_to * A pointer to a ether_addr structure where to copy the Ethernet address. */ -static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, +static inline void rte_ether_addr_copy(const struct rte_ether_addr *ea_from, struct rte_ether_addr *ea_to) { #ifdef __INTEL_COMPILER @@ -252,7 +252,7 @@ static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, * A pointer to a ether_addr structure. */ static inline void -ether_format_addr(char *buf, uint16_t size, +rte_ether_format_addr(char *buf, uint16_t size, const struct rte_ether_addr *eth_addr) { snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 8841de64f..d4318ecb0 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -615,8 +615,8 @@ encap_ether_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ethertype); return 0; @@ -633,8 +633,8 @@ encap_vlan_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->vlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -657,8 +657,8 @@ encap_qinq_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); + 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); /* SVLAN */ @@ -683,8 +683,8 @@ encap_qinq_pppoe_apply(void *data, struct encap_qinq_pppoe_data *d = data; /* Ethernet */ - ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); + 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); /* SVLAN */ @@ -719,8 +719,8 @@ encap_mpls_apply(void *data, uint32_t i; /* Ethernet */ - ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ethertype); /* MPLS */ @@ -746,8 +746,8 @@ encap_pppoe_apply(void *data, struct encap_pppoe_data *d = data; /* Ethernet */ - ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ETHER_TYPE_PPPOE_SESSION); /* PPPoE and PPP*/ @@ -776,8 +776,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv4_vlan_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -815,8 +815,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv4_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* IPv4*/ @@ -850,8 +850,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv6_vlan_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -889,8 +889,8 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv6_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* IPv6*/ -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (4 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 04/14] net: add rte prefix to ether functions Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 06/14] net: add rte prefix to esp structure Olivier Matz ` (10 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit 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 <olivier.matz@6wind.com> --- 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 <rte_string_fns.h> #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:<iface_idx> */ - 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 <rte_ether.h> -#define NICVF_MAC_ADDR_SIZE ETHER_ADDR_LEN +#define NICVF_MAC_ADDR_SIZE RTE_ETHER_ADDR_LEN #include <rte_io.h> #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 <rte_mbuf.h> #include <rte_byteorder.h> -#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 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit 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 <olivier.matz@6wind.com> --- 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 <rte_string_fns.h> #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:<iface_idx> */ - 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 <rte_ether.h> -#define NICVF_MAC_ADDR_SIZE ETHER_ADDR_LEN +#define NICVF_MAC_ADDR_SIZE RTE_ETHER_ADDR_LEN #include <rte_io.h> #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 <rte_mbuf.h> #include <rte_byteorder.h> -#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 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 06/14] net: add rte prefix to esp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (5 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 07/14] net: add rte prefix to gre structure Olivier Matz ` (9 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct esp_hdr as struct rte_esp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test/test_ipsec.c | 4 ++-- examples/ipsec-secgw/esp.c | 42 +++++++++++++++++++++--------------------- examples/ipsec-secgw/sa.c | 6 +++--- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_ipsec/crypto.h | 2 +- lib/librte_ipsec/esp_inb.c | 10 +++++----- lib/librte_ipsec/esp_outb.c | 8 ++++---- lib/librte_ipsec/sa.c | 8 ++++---- lib/librte_net/rte_esp.h | 2 +- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 80a2d255f..7ad285a92 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -572,12 +572,12 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, size_t len, uint32_t spi, uint32_t seq) { struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct esp_hdr); + uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct rte_esp_hdr); uint32_t taillen = sizeof(struct esp_tail); uint32_t t_len = len + hdrlen + taillen; uint32_t padlen; - struct esp_hdr esph = { + struct rte_esp_hdr esph = { .spi = rte_cpu_to_be_32(spi), .seq = rte_cpu_to_be_32(seq) }; diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c index faa84ddd1..6b5ca3397 100644 --- a/examples/ipsec-secgw/esp.c +++ b/examples/ipsec-secgw/esp.c @@ -49,7 +49,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, } payload_len = rte_pktmbuf_pkt_len(m) - ip_hdr_len - - sizeof(struct esp_hdr) - sa->iv_len - sa->digest_len; + sizeof(struct rte_esp_hdr) - sa->iv_len - sa->digest_len; if ((payload_len & (sa->block_size - 1)) || (payload_len <= 0)) { RTE_LOG_DP(DEBUG, IPSEC_ESP, "payload %d not multiple of %u\n", @@ -61,13 +61,13 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->m_src = m; if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) { - sym_cop->aead.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + + sym_cop->aead.data.offset = ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->aead.data.length = payload_len; struct cnt_blk *icb; uint8_t *aad; - uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct esp_hdr)); + uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct rte_esp_hdr)); icb = get_cnt_blk(m); icb->salt = sa->salt; @@ -75,7 +75,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, icb->cnt = rte_cpu_to_be_32(1); aad = get_aad(m); - memcpy(aad, iv - sizeof(struct esp_hdr), 8); + memcpy(aad, iv - sizeof(struct rte_esp_hdr), 8); sym_cop->aead.aad.data = aad; sym_cop->aead.aad.phys_addr = rte_pktmbuf_iova_offset(m, aad - rte_pktmbuf_mtod(m, uint8_t *)); @@ -85,12 +85,12 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->aead.digest.phys_addr = rte_pktmbuf_iova_offset(m, rte_pktmbuf_pkt_len(m) - sa->digest_len); } else { - sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + + sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = payload_len; struct cnt_blk *icb; - uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct esp_hdr)); + uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct rte_esp_hdr)); uint8_t *iv_ptr = rte_crypto_op_ctod_offset(cop, uint8_t *, IV_OFFSET); @@ -118,7 +118,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_AUTH_SHA1_HMAC: case RTE_CRYPTO_AUTH_SHA256_HMAC: sym_cop->auth.data.offset = ip_hdr_len; - sym_cop->auth.data.length = sizeof(struct esp_hdr) + + sym_cop->auth.data.length = sizeof(struct rte_esp_hdr) + sa->iv_len + payload_len; break; default: @@ -192,7 +192,7 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, if (unlikely(sa->flags == TRANSPORT)) { ip = rte_pktmbuf_mtod(m, struct ip *); ip4 = (struct ip *)rte_pktmbuf_adj(m, - sizeof(struct esp_hdr) + sa->iv_len); + sizeof(struct rte_esp_hdr) + sa->iv_len); if (likely(ip->ip_v == IPVERSION)) { memmove(ip4, ip, ip->ip_hl * 4); ip4->ip_p = *nexthdr; @@ -206,7 +206,7 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, sizeof(struct ip6_hdr)); } } else - ipip_inbound(m, sizeof(struct esp_hdr) + sa->iv_len); + ipip_inbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len); return 0; } @@ -217,7 +217,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, { struct ip *ip4; struct ip6_hdr *ip6; - struct esp_hdr *esp = NULL; + struct rte_esp_hdr *esp = NULL; uint8_t *padding = NULL, *new_ip, nlp; struct rte_crypto_sym_op *sym_cop; int32_t i; @@ -268,7 +268,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, } /* Check maximum packet size */ - if (unlikely(ip_hdr_len + sizeof(struct esp_hdr) + sa->iv_len + + if (unlikely(ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len + pad_payload_len + sa->digest_len > IP_MAXPACKET)) { RTE_LOG(ERR, IPSEC_ESP, "ipsec packet is too big\n"); return -EINVAL; @@ -290,20 +290,20 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, switch (sa->flags) { case IP4_TUNNEL: - ip4 = ip4ip_outbound(m, sizeof(struct esp_hdr) + sa->iv_len, + ip4 = ip4ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, &sa->src, &sa->dst); - esp = (struct esp_hdr *)(ip4 + 1); + esp = (struct rte_esp_hdr *)(ip4 + 1); break; case IP6_TUNNEL: - ip6 = ip6ip_outbound(m, sizeof(struct esp_hdr) + sa->iv_len, + ip6 = ip6ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, &sa->src, &sa->dst); - esp = (struct esp_hdr *)(ip6 + 1); + esp = (struct rte_esp_hdr *)(ip6 + 1); break; case TRANSPORT: new_ip = (uint8_t *)rte_pktmbuf_prepend(m, - sizeof(struct esp_hdr) + sa->iv_len); + sizeof(struct rte_esp_hdr) + sa->iv_len); memmove(new_ip, ip4, ip_hdr_len); - esp = (struct esp_hdr *)(new_ip + ip_hdr_len); + esp = (struct rte_esp_hdr *)(new_ip + ip_hdr_len); ip4 = (struct ip *)new_ip; if (likely(ip4->ip_v == IPVERSION)) { ip4->ip_p = IPPROTO_ESP; @@ -362,7 +362,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, uint8_t *aad; sym_cop->aead.data.offset = ip_hdr_len + - sizeof(struct esp_hdr) + sa->iv_len; + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->aead.data.length = pad_payload_len; /* Fill pad_len using default sequential scheme */ @@ -392,12 +392,12 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_CIPHER_3DES_CBC: case RTE_CRYPTO_CIPHER_AES_CBC: sym_cop->cipher.data.offset = ip_hdr_len + - sizeof(struct esp_hdr); + sizeof(struct rte_esp_hdr); sym_cop->cipher.data.length = pad_payload_len + sa->iv_len; break; case RTE_CRYPTO_CIPHER_AES_CTR: sym_cop->cipher.data.offset = ip_hdr_len + - sizeof(struct esp_hdr) + sa->iv_len; + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = pad_payload_len; break; default: @@ -422,7 +422,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_AUTH_SHA1_HMAC: case RTE_CRYPTO_AUTH_SHA256_HMAC: sym_cop->auth.data.offset = ip_hdr_len; - sym_cop->auth.data.length = sizeof(struct esp_hdr) + + sym_cop->auth.data.length = sizeof(struct rte_esp_hdr) + sa->iv_len + pad_payload_len; break; default: diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index a7298a30c..b323b0163 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -1194,7 +1194,7 @@ static inline void single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, struct ipsec_sa **sa_ret) { - struct esp_hdr *esp; + struct rte_esp_hdr *esp; struct ip *ip; uint32_t *src4_addr; uint8_t *src6_addr; @@ -1204,9 +1204,9 @@ single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, ip = rte_pktmbuf_mtod(pkt, struct ip *); if (ip->ip_v == IPVERSION) - esp = (struct esp_hdr *)(ip + 1); + esp = (struct rte_esp_hdr *)(ip + 1); else - esp = (struct esp_hdr *)(((struct ip6_hdr *)ip) + 1); + esp = (struct rte_esp_hdr *)(((struct ip6_hdr *)ip) + 1); if (esp->spi == INVALID_SPI) return; diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 75c374552..58ac9f4d7 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -916,7 +916,7 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { * Matches an ESP header. */ struct rte_flow_item_esp { - struct esp_hdr hdr; /**< ESP header definition. */ + struct rte_esp_hdr hdr; /**< ESP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */ diff --git a/lib/librte_ipsec/crypto.h b/lib/librte_ipsec/crypto.h index 3e9a8f41c..6dc0b2c6c 100644 --- a/lib/librte_ipsec/crypto.h +++ b/lib/librte_ipsec/crypto.h @@ -47,7 +47,7 @@ struct aead_gcm_aad { } __attribute__((packed)); struct gcm_esph_iv { - struct esp_hdr esph; + struct rte_esp_hdr esph; uint64_t iv; } __attribute__((packed)); diff --git a/lib/librte_ipsec/esp_inb.c b/lib/librte_ipsec/esp_inb.c index 4e0e12a85..3e12ca103 100644 --- a/lib/librte_ipsec/esp_inb.c +++ b/lib/librte_ipsec/esp_inb.c @@ -68,7 +68,7 @@ inb_cop_prepare(struct rte_crypto_op *cop, algo = sa->algo_type; ivp = rte_pktmbuf_mtod_offset(mb, uint64_t *, - pofs + sizeof(struct esp_hdr)); + pofs + sizeof(struct rte_esp_hdr)); /* fill sym op fields */ sop = cop->sym; @@ -139,9 +139,9 @@ inb_pkt_prepare(const struct rte_ipsec_sa *sa, const struct replay_sqn *rsn, uint64_t sqn; uint32_t clen, icv_ofs, plen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; - esph = rte_pktmbuf_mtod_offset(mb, struct esp_hdr *, hlen); + esph = rte_pktmbuf_mtod_offset(mb, struct rte_esp_hdr *, hlen); /* * retrieve and reconstruct SQN, then check it, then @@ -295,10 +295,10 @@ static inline void * tun_process_step2(struct rte_mbuf *mb, struct rte_mbuf *ml, uint32_t hlen, uint32_t adj, uint32_t tlen, uint32_t *sqn) { - const struct esp_hdr *ph; + const struct rte_esp_hdr *ph; /* read SQN value */ - ph = rte_pktmbuf_mtod_offset(mb, const struct esp_hdr *, hlen); + ph = rte_pktmbuf_mtod_offset(mb, const struct rte_esp_hdr *, hlen); sqn[0] = ph->seq; /* cut of ICV, ESP tail and padding bytes */ diff --git a/lib/librte_ipsec/esp_outb.c b/lib/librte_ipsec/esp_outb.c index c798bc4c4..862a9982d 100644 --- a/lib/librte_ipsec/esp_outb.c +++ b/lib/librte_ipsec/esp_outb.c @@ -108,7 +108,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, { uint32_t clen, hlen, l2len, pdlen, pdofs, plen, tlen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; struct esp_tail *espt; char *ph, *pt; uint64_t *iv; @@ -156,7 +156,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, sqn_low16(sqc)); /* update spi, seqn and iv */ - esph = (struct esp_hdr *)(ph + sa->hdr_len); + esph = (struct rte_esp_hdr *)(ph + sa->hdr_len); iv = (uint64_t *)(esph + 1); copy_iv(iv, ivp, sa->iv_len); @@ -275,7 +275,7 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, uint8_t np; uint32_t clen, hlen, pdlen, pdofs, plen, tlen, uhlen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; struct esp_tail *espt; char *ph, *pt; uint64_t *iv; @@ -318,7 +318,7 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, IPPROTO_ESP); /* update spi, seqn and iv */ - esph = (struct esp_hdr *)(ph + uhlen); + esph = (struct rte_esp_hdr *)(ph + uhlen); iv = (uint64_t *)(esph + 1); copy_iv(iv, ivp, sa->iv_len); diff --git a/lib/librte_ipsec/sa.c b/lib/librte_ipsec/sa.c index 846e317fe..9cf908dd9 100644 --- a/lib/librte_ipsec/sa.c +++ b/lib/librte_ipsec/sa.c @@ -233,7 +233,7 @@ esp_inb_init(struct rte_ipsec_sa *sa) /* these params may differ with new algorithms support */ sa->ctp.auth.offset = 0; sa->ctp.auth.length = sa->icv_len - sa->sqh_len; - sa->ctp.cipher.offset = sizeof(struct esp_hdr) + sa->iv_len; + sa->ctp.cipher.offset = sizeof(struct rte_esp_hdr) + sa->iv_len; sa->ctp.cipher.length = sa->icv_len + sa->ctp.cipher.offset; } @@ -259,7 +259,7 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) /* these params may differ with new algorithms support */ sa->ctp.auth.offset = hlen; - sa->ctp.auth.length = sizeof(struct esp_hdr) + sa->iv_len + sa->sqh_len; + sa->ctp.auth.length = sizeof(struct rte_esp_hdr) + sa->iv_len + sa->sqh_len; algo_type = sa->algo_type; @@ -267,13 +267,13 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) case ALGO_TYPE_AES_GCM: case ALGO_TYPE_AES_CTR: case ALGO_TYPE_NULL: - sa->ctp.cipher.offset = hlen + sizeof(struct esp_hdr) + + sa->ctp.cipher.offset = hlen + sizeof(struct rte_esp_hdr) + sa->iv_len; sa->ctp.cipher.length = 0; break; case ALGO_TYPE_AES_CBC: case ALGO_TYPE_3DES_CBC: - sa->ctp.cipher.offset = sa->hdr_len + sizeof(struct esp_hdr); + sa->ctp.cipher.offset = sa->hdr_len + sizeof(struct rte_esp_hdr); sa->ctp.cipher.length = sa->iv_len; break; } diff --git a/lib/librte_net/rte_esp.h b/lib/librte_net/rte_esp.h index 8e1b3d2dd..c569b7906 100644 --- a/lib/librte_net/rte_esp.h +++ b/lib/librte_net/rte_esp.h @@ -20,7 +20,7 @@ extern "C" { /** * ESP Header */ -struct esp_hdr { +struct rte_esp_hdr { rte_be32_t spi; /**< Security Parameters Index */ rte_be32_t seq; /**< packet sequence number */ } __attribute__((__packed__)); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 06/14] net: add rte prefix to esp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 06/14] net: add rte prefix to esp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct esp_hdr as struct rte_esp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test/test_ipsec.c | 4 ++-- examples/ipsec-secgw/esp.c | 42 +++++++++++++++++++++--------------------- examples/ipsec-secgw/sa.c | 6 +++--- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_ipsec/crypto.h | 2 +- lib/librte_ipsec/esp_inb.c | 10 +++++----- lib/librte_ipsec/esp_outb.c | 8 ++++---- lib/librte_ipsec/sa.c | 8 ++++---- lib/librte_net/rte_esp.h | 2 +- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 80a2d255f..7ad285a92 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -572,12 +572,12 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, size_t len, uint32_t spi, uint32_t seq) { struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct esp_hdr); + uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct rte_esp_hdr); uint32_t taillen = sizeof(struct esp_tail); uint32_t t_len = len + hdrlen + taillen; uint32_t padlen; - struct esp_hdr esph = { + struct rte_esp_hdr esph = { .spi = rte_cpu_to_be_32(spi), .seq = rte_cpu_to_be_32(seq) }; diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c index faa84ddd1..6b5ca3397 100644 --- a/examples/ipsec-secgw/esp.c +++ b/examples/ipsec-secgw/esp.c @@ -49,7 +49,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, } payload_len = rte_pktmbuf_pkt_len(m) - ip_hdr_len - - sizeof(struct esp_hdr) - sa->iv_len - sa->digest_len; + sizeof(struct rte_esp_hdr) - sa->iv_len - sa->digest_len; if ((payload_len & (sa->block_size - 1)) || (payload_len <= 0)) { RTE_LOG_DP(DEBUG, IPSEC_ESP, "payload %d not multiple of %u\n", @@ -61,13 +61,13 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->m_src = m; if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) { - sym_cop->aead.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + + sym_cop->aead.data.offset = ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->aead.data.length = payload_len; struct cnt_blk *icb; uint8_t *aad; - uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct esp_hdr)); + uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct rte_esp_hdr)); icb = get_cnt_blk(m); icb->salt = sa->salt; @@ -75,7 +75,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, icb->cnt = rte_cpu_to_be_32(1); aad = get_aad(m); - memcpy(aad, iv - sizeof(struct esp_hdr), 8); + memcpy(aad, iv - sizeof(struct rte_esp_hdr), 8); sym_cop->aead.aad.data = aad; sym_cop->aead.aad.phys_addr = rte_pktmbuf_iova_offset(m, aad - rte_pktmbuf_mtod(m, uint8_t *)); @@ -85,12 +85,12 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->aead.digest.phys_addr = rte_pktmbuf_iova_offset(m, rte_pktmbuf_pkt_len(m) - sa->digest_len); } else { - sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + + sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = payload_len; struct cnt_blk *icb; - uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct esp_hdr)); + uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct rte_esp_hdr)); uint8_t *iv_ptr = rte_crypto_op_ctod_offset(cop, uint8_t *, IV_OFFSET); @@ -118,7 +118,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_AUTH_SHA1_HMAC: case RTE_CRYPTO_AUTH_SHA256_HMAC: sym_cop->auth.data.offset = ip_hdr_len; - sym_cop->auth.data.length = sizeof(struct esp_hdr) + + sym_cop->auth.data.length = sizeof(struct rte_esp_hdr) + sa->iv_len + payload_len; break; default: @@ -192,7 +192,7 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, if (unlikely(sa->flags == TRANSPORT)) { ip = rte_pktmbuf_mtod(m, struct ip *); ip4 = (struct ip *)rte_pktmbuf_adj(m, - sizeof(struct esp_hdr) + sa->iv_len); + sizeof(struct rte_esp_hdr) + sa->iv_len); if (likely(ip->ip_v == IPVERSION)) { memmove(ip4, ip, ip->ip_hl * 4); ip4->ip_p = *nexthdr; @@ -206,7 +206,7 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, sizeof(struct ip6_hdr)); } } else - ipip_inbound(m, sizeof(struct esp_hdr) + sa->iv_len); + ipip_inbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len); return 0; } @@ -217,7 +217,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, { struct ip *ip4; struct ip6_hdr *ip6; - struct esp_hdr *esp = NULL; + struct rte_esp_hdr *esp = NULL; uint8_t *padding = NULL, *new_ip, nlp; struct rte_crypto_sym_op *sym_cop; int32_t i; @@ -268,7 +268,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, } /* Check maximum packet size */ - if (unlikely(ip_hdr_len + sizeof(struct esp_hdr) + sa->iv_len + + if (unlikely(ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len + pad_payload_len + sa->digest_len > IP_MAXPACKET)) { RTE_LOG(ERR, IPSEC_ESP, "ipsec packet is too big\n"); return -EINVAL; @@ -290,20 +290,20 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, switch (sa->flags) { case IP4_TUNNEL: - ip4 = ip4ip_outbound(m, sizeof(struct esp_hdr) + sa->iv_len, + ip4 = ip4ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, &sa->src, &sa->dst); - esp = (struct esp_hdr *)(ip4 + 1); + esp = (struct rte_esp_hdr *)(ip4 + 1); break; case IP6_TUNNEL: - ip6 = ip6ip_outbound(m, sizeof(struct esp_hdr) + sa->iv_len, + ip6 = ip6ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, &sa->src, &sa->dst); - esp = (struct esp_hdr *)(ip6 + 1); + esp = (struct rte_esp_hdr *)(ip6 + 1); break; case TRANSPORT: new_ip = (uint8_t *)rte_pktmbuf_prepend(m, - sizeof(struct esp_hdr) + sa->iv_len); + sizeof(struct rte_esp_hdr) + sa->iv_len); memmove(new_ip, ip4, ip_hdr_len); - esp = (struct esp_hdr *)(new_ip + ip_hdr_len); + esp = (struct rte_esp_hdr *)(new_ip + ip_hdr_len); ip4 = (struct ip *)new_ip; if (likely(ip4->ip_v == IPVERSION)) { ip4->ip_p = IPPROTO_ESP; @@ -362,7 +362,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, uint8_t *aad; sym_cop->aead.data.offset = ip_hdr_len + - sizeof(struct esp_hdr) + sa->iv_len; + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->aead.data.length = pad_payload_len; /* Fill pad_len using default sequential scheme */ @@ -392,12 +392,12 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_CIPHER_3DES_CBC: case RTE_CRYPTO_CIPHER_AES_CBC: sym_cop->cipher.data.offset = ip_hdr_len + - sizeof(struct esp_hdr); + sizeof(struct rte_esp_hdr); sym_cop->cipher.data.length = pad_payload_len + sa->iv_len; break; case RTE_CRYPTO_CIPHER_AES_CTR: sym_cop->cipher.data.offset = ip_hdr_len + - sizeof(struct esp_hdr) + sa->iv_len; + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = pad_payload_len; break; default: @@ -422,7 +422,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_AUTH_SHA1_HMAC: case RTE_CRYPTO_AUTH_SHA256_HMAC: sym_cop->auth.data.offset = ip_hdr_len; - sym_cop->auth.data.length = sizeof(struct esp_hdr) + + sym_cop->auth.data.length = sizeof(struct rte_esp_hdr) + sa->iv_len + pad_payload_len; break; default: diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index a7298a30c..b323b0163 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -1194,7 +1194,7 @@ static inline void single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, struct ipsec_sa **sa_ret) { - struct esp_hdr *esp; + struct rte_esp_hdr *esp; struct ip *ip; uint32_t *src4_addr; uint8_t *src6_addr; @@ -1204,9 +1204,9 @@ single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, ip = rte_pktmbuf_mtod(pkt, struct ip *); if (ip->ip_v == IPVERSION) - esp = (struct esp_hdr *)(ip + 1); + esp = (struct rte_esp_hdr *)(ip + 1); else - esp = (struct esp_hdr *)(((struct ip6_hdr *)ip) + 1); + esp = (struct rte_esp_hdr *)(((struct ip6_hdr *)ip) + 1); if (esp->spi == INVALID_SPI) return; diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 75c374552..58ac9f4d7 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -916,7 +916,7 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { * Matches an ESP header. */ struct rte_flow_item_esp { - struct esp_hdr hdr; /**< ESP header definition. */ + struct rte_esp_hdr hdr; /**< ESP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */ diff --git a/lib/librte_ipsec/crypto.h b/lib/librte_ipsec/crypto.h index 3e9a8f41c..6dc0b2c6c 100644 --- a/lib/librte_ipsec/crypto.h +++ b/lib/librte_ipsec/crypto.h @@ -47,7 +47,7 @@ struct aead_gcm_aad { } __attribute__((packed)); struct gcm_esph_iv { - struct esp_hdr esph; + struct rte_esp_hdr esph; uint64_t iv; } __attribute__((packed)); diff --git a/lib/librte_ipsec/esp_inb.c b/lib/librte_ipsec/esp_inb.c index 4e0e12a85..3e12ca103 100644 --- a/lib/librte_ipsec/esp_inb.c +++ b/lib/librte_ipsec/esp_inb.c @@ -68,7 +68,7 @@ inb_cop_prepare(struct rte_crypto_op *cop, algo = sa->algo_type; ivp = rte_pktmbuf_mtod_offset(mb, uint64_t *, - pofs + sizeof(struct esp_hdr)); + pofs + sizeof(struct rte_esp_hdr)); /* fill sym op fields */ sop = cop->sym; @@ -139,9 +139,9 @@ inb_pkt_prepare(const struct rte_ipsec_sa *sa, const struct replay_sqn *rsn, uint64_t sqn; uint32_t clen, icv_ofs, plen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; - esph = rte_pktmbuf_mtod_offset(mb, struct esp_hdr *, hlen); + esph = rte_pktmbuf_mtod_offset(mb, struct rte_esp_hdr *, hlen); /* * retrieve and reconstruct SQN, then check it, then @@ -295,10 +295,10 @@ static inline void * tun_process_step2(struct rte_mbuf *mb, struct rte_mbuf *ml, uint32_t hlen, uint32_t adj, uint32_t tlen, uint32_t *sqn) { - const struct esp_hdr *ph; + const struct rte_esp_hdr *ph; /* read SQN value */ - ph = rte_pktmbuf_mtod_offset(mb, const struct esp_hdr *, hlen); + ph = rte_pktmbuf_mtod_offset(mb, const struct rte_esp_hdr *, hlen); sqn[0] = ph->seq; /* cut of ICV, ESP tail and padding bytes */ diff --git a/lib/librte_ipsec/esp_outb.c b/lib/librte_ipsec/esp_outb.c index c798bc4c4..862a9982d 100644 --- a/lib/librte_ipsec/esp_outb.c +++ b/lib/librte_ipsec/esp_outb.c @@ -108,7 +108,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, { uint32_t clen, hlen, l2len, pdlen, pdofs, plen, tlen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; struct esp_tail *espt; char *ph, *pt; uint64_t *iv; @@ -156,7 +156,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, sqn_low16(sqc)); /* update spi, seqn and iv */ - esph = (struct esp_hdr *)(ph + sa->hdr_len); + esph = (struct rte_esp_hdr *)(ph + sa->hdr_len); iv = (uint64_t *)(esph + 1); copy_iv(iv, ivp, sa->iv_len); @@ -275,7 +275,7 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, uint8_t np; uint32_t clen, hlen, pdlen, pdofs, plen, tlen, uhlen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; struct esp_tail *espt; char *ph, *pt; uint64_t *iv; @@ -318,7 +318,7 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, IPPROTO_ESP); /* update spi, seqn and iv */ - esph = (struct esp_hdr *)(ph + uhlen); + esph = (struct rte_esp_hdr *)(ph + uhlen); iv = (uint64_t *)(esph + 1); copy_iv(iv, ivp, sa->iv_len); diff --git a/lib/librte_ipsec/sa.c b/lib/librte_ipsec/sa.c index 846e317fe..9cf908dd9 100644 --- a/lib/librte_ipsec/sa.c +++ b/lib/librte_ipsec/sa.c @@ -233,7 +233,7 @@ esp_inb_init(struct rte_ipsec_sa *sa) /* these params may differ with new algorithms support */ sa->ctp.auth.offset = 0; sa->ctp.auth.length = sa->icv_len - sa->sqh_len; - sa->ctp.cipher.offset = sizeof(struct esp_hdr) + sa->iv_len; + sa->ctp.cipher.offset = sizeof(struct rte_esp_hdr) + sa->iv_len; sa->ctp.cipher.length = sa->icv_len + sa->ctp.cipher.offset; } @@ -259,7 +259,7 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) /* these params may differ with new algorithms support */ sa->ctp.auth.offset = hlen; - sa->ctp.auth.length = sizeof(struct esp_hdr) + sa->iv_len + sa->sqh_len; + sa->ctp.auth.length = sizeof(struct rte_esp_hdr) + sa->iv_len + sa->sqh_len; algo_type = sa->algo_type; @@ -267,13 +267,13 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) case ALGO_TYPE_AES_GCM: case ALGO_TYPE_AES_CTR: case ALGO_TYPE_NULL: - sa->ctp.cipher.offset = hlen + sizeof(struct esp_hdr) + + sa->ctp.cipher.offset = hlen + sizeof(struct rte_esp_hdr) + sa->iv_len; sa->ctp.cipher.length = 0; break; case ALGO_TYPE_AES_CBC: case ALGO_TYPE_3DES_CBC: - sa->ctp.cipher.offset = sa->hdr_len + sizeof(struct esp_hdr); + sa->ctp.cipher.offset = sa->hdr_len + sizeof(struct rte_esp_hdr); sa->ctp.cipher.length = sa->iv_len; break; } diff --git a/lib/librte_net/rte_esp.h b/lib/librte_net/rte_esp.h index 8e1b3d2dd..c569b7906 100644 --- a/lib/librte_net/rte_esp.h +++ b/lib/librte_net/rte_esp.h @@ -20,7 +20,7 @@ extern "C" { /** * ESP Header */ -struct esp_hdr { +struct rte_esp_hdr { rte_be32_t spi; /**< Security Parameters Index */ rte_be32_t seq; /**< packet sequence number */ } __attribute__((__packed__)); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 07/14] net: add rte prefix to gre structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (6 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 06/14] net: add rte prefix to esp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 08/14] net: add rte prefix to icmp structure Olivier Matz ` (8 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct gre_hdr as struct rte_gre_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- drivers/net/mlx5/mlx5_flow_dv.c | 4 ++-- lib/librte_net/rte_gre.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 8110e9e3e..a4c7529cf 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1057,7 +1057,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, struct udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; - struct gre_hdr *gre = NULL; + struct rte_gre_hdr *gre = NULL; size_t len; size_t temp_size = 0; @@ -1170,7 +1170,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, break; case RTE_FLOW_ITEM_TYPE_GRE: case RTE_FLOW_ITEM_TYPE_NVGRE: - gre = (struct gre_hdr *)&buf[temp_size]; + gre = (struct rte_gre_hdr *)&buf[temp_size]; if (!gre->proto) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/lib/librte_net/rte_gre.h b/lib/librte_net/rte_gre.h index 05aa9d143..b5279ede1 100644 --- a/lib/librte_net/rte_gre.h +++ b/lib/librte_net/rte_gre.h @@ -16,7 +16,7 @@ extern "C" { * GRE Header */ __extension__ -struct gre_hdr { +struct rte_gre_hdr { #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint16_t res2:4; /**< Reserved */ uint16_t s:1; /**< Sequence Number Present bit */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 5551cce17..d858ab155 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -140,8 +140,8 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, [0xa] = 12, [0xb] = 16, }; - const struct gre_hdr *gh; - struct gre_hdr gh_copy; + const struct rte_gre_hdr *gh; + struct rte_gre_hdr gh_copy; uint16_t flags; gh = rte_pktmbuf_read(m, *off, sizeof(*gh), &gh_copy); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 07/14] net: add rte prefix to gre structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 07/14] net: add rte prefix to gre structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct gre_hdr as struct rte_gre_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- drivers/net/mlx5/mlx5_flow_dv.c | 4 ++-- lib/librte_net/rte_gre.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 8110e9e3e..a4c7529cf 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1057,7 +1057,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, struct udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; - struct gre_hdr *gre = NULL; + struct rte_gre_hdr *gre = NULL; size_t len; size_t temp_size = 0; @@ -1170,7 +1170,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, break; case RTE_FLOW_ITEM_TYPE_GRE: case RTE_FLOW_ITEM_TYPE_NVGRE: - gre = (struct gre_hdr *)&buf[temp_size]; + gre = (struct rte_gre_hdr *)&buf[temp_size]; if (!gre->proto) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/lib/librte_net/rte_gre.h b/lib/librte_net/rte_gre.h index 05aa9d143..b5279ede1 100644 --- a/lib/librte_net/rte_gre.h +++ b/lib/librte_net/rte_gre.h @@ -16,7 +16,7 @@ extern "C" { * GRE Header */ __extension__ -struct gre_hdr { +struct rte_gre_hdr { #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint16_t res2:4; /**< Reserved */ uint16_t s:1; /**< Sequence Number Present bit */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 5551cce17..d858ab155 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -140,8 +140,8 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, [0xa] = 12, [0xb] = 16, }; - const struct gre_hdr *gh; - struct gre_hdr gh_copy; + const struct rte_gre_hdr *gh; + struct rte_gre_hdr gh_copy; uint16_t flags; gh = rte_pktmbuf_read(m, *off, sizeof(*gh), &gh_copy); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 08/14] net: add rte prefix to icmp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (7 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 07/14] net: add rte prefix to gre structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 09/14] net: add rte prefix to icmp defines Olivier Matz ` (7 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct icmp_hdr as struct rte_icmp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_icmp.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index e778de438..33b9e2ffd 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -279,7 +279,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; - struct icmp_hdr *icmp_h; + struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; @@ -425,7 +425,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* * Check if packet is a ICMP echo request. */ - icmp_h = (struct icmp_hdr *) ((char *)ip_h + + icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + sizeof(struct ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 58ac9f4d7..56f129bd3 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -674,7 +674,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { * Matches an ICMP header. */ struct rte_flow_item_icmp { - struct icmp_hdr hdr; /**< ICMP header definition. */ + struct rte_icmp_hdr hdr; /**< ICMP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */ diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h index 053b5f6a4..d0309537e 100644 --- a/lib/librte_net/rte_icmp.h +++ b/lib/librte_net/rte_icmp.h @@ -23,7 +23,7 @@ extern "C" { /** * ICMP Header */ -struct icmp_hdr { +struct rte_icmp_hdr { uint8_t icmp_type; /* ICMP packet type. */ uint8_t icmp_code; /* ICMP packet code. */ uint16_t icmp_cksum; /* ICMP packet checksum. */ -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 08/14] net: add rte prefix to icmp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 08/14] net: add rte prefix to icmp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct icmp_hdr as struct rte_icmp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_icmp.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index e778de438..33b9e2ffd 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -279,7 +279,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; - struct icmp_hdr *icmp_h; + struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; @@ -425,7 +425,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* * Check if packet is a ICMP echo request. */ - icmp_h = (struct icmp_hdr *) ((char *)ip_h + + icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + sizeof(struct ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 58ac9f4d7..56f129bd3 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -674,7 +674,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { * Matches an ICMP header. */ struct rte_flow_item_icmp { - struct icmp_hdr hdr; /**< ICMP header definition. */ + struct rte_icmp_hdr hdr; /**< ICMP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */ diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h index 053b5f6a4..d0309537e 100644 --- a/lib/librte_net/rte_icmp.h +++ b/lib/librte_net/rte_icmp.h @@ -23,7 +23,7 @@ extern "C" { /** * ICMP Header */ -struct icmp_hdr { +struct rte_icmp_hdr { uint8_t icmp_type; /* ICMP packet type. */ uint8_t icmp_code; /* ICMP packet code. */ uint16_t icmp_cksum; /* ICMP packet checksum. */ -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 09/14] net: add rte prefix to icmp defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (8 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 08/14] net: add rte prefix to icmp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 10/14] net: add rte prefix to ip structure Olivier Matz ` (6 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'RTE_' prefix to defines: - rename IP_ICMP_ECHO_REPLY as RTE_IP_ICMP_ECHO_REPLY. - rename IP_ICMP_ECHO_REQUEST as RTE_IP_ICMP_ECHO_REQUEST. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 10 +++++----- lib/librte_net/rte_icmp.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 33b9e2ffd..4bf3fed64 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -428,7 +428,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + sizeof(struct ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && - (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && + (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { rte_pktmbuf_free(pkt); continue; @@ -452,7 +452,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * - switch the request IP source and destination * addresses in the reply IP header, * - keep the IP header checksum unchanged. - * - set IP_ICMP_ECHO_REPLY in ICMP header. + * - set RTE_IP_ICMP_ECHO_REPLY in ICMP header. * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ @@ -475,10 +475,10 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ip_h->src_addr = ip_h->dst_addr; ip_h->dst_addr = ip_addr; } - icmp_h->icmp_type = IP_ICMP_ECHO_REPLY; + icmp_h->icmp_type = RTE_IP_ICMP_ECHO_REPLY; cksum = ~icmp_h->icmp_cksum & 0xffff; - cksum += ~htons(IP_ICMP_ECHO_REQUEST << 8) & 0xffff; - cksum += htons(IP_ICMP_ECHO_REPLY << 8); + cksum += ~htons(RTE_IP_ICMP_ECHO_REQUEST << 8) & 0xffff; + cksum += htons(RTE_IP_ICMP_ECHO_REPLY << 8); cksum = (cksum & 0xffff) + (cksum >> 16); cksum = (cksum & 0xffff) + (cksum >> 16); icmp_h->icmp_cksum = ~cksum; diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h index d0309537e..3f8100a5f 100644 --- a/lib/librte_net/rte_icmp.h +++ b/lib/librte_net/rte_icmp.h @@ -32,8 +32,8 @@ struct rte_icmp_hdr { } __attribute__((__packed__)); /* ICMP packet types */ -#define IP_ICMP_ECHO_REPLY 0 -#define IP_ICMP_ECHO_REQUEST 8 +#define RTE_IP_ICMP_ECHO_REPLY 0 +#define RTE_IP_ICMP_ECHO_REQUEST 8 #ifdef __cplusplus } -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 09/14] net: add rte prefix to icmp defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 09/14] net: add rte prefix to icmp defines Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'RTE_' prefix to defines: - rename IP_ICMP_ECHO_REPLY as RTE_IP_ICMP_ECHO_REPLY. - rename IP_ICMP_ECHO_REQUEST as RTE_IP_ICMP_ECHO_REQUEST. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 10 +++++----- lib/librte_net/rte_icmp.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 33b9e2ffd..4bf3fed64 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -428,7 +428,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + sizeof(struct ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && - (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && + (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { rte_pktmbuf_free(pkt); continue; @@ -452,7 +452,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * - switch the request IP source and destination * addresses in the reply IP header, * - keep the IP header checksum unchanged. - * - set IP_ICMP_ECHO_REPLY in ICMP header. + * - set RTE_IP_ICMP_ECHO_REPLY in ICMP header. * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ @@ -475,10 +475,10 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ip_h->src_addr = ip_h->dst_addr; ip_h->dst_addr = ip_addr; } - icmp_h->icmp_type = IP_ICMP_ECHO_REPLY; + icmp_h->icmp_type = RTE_IP_ICMP_ECHO_REPLY; cksum = ~icmp_h->icmp_cksum & 0xffff; - cksum += ~htons(IP_ICMP_ECHO_REQUEST << 8) & 0xffff; - cksum += htons(IP_ICMP_ECHO_REPLY << 8); + cksum += ~htons(RTE_IP_ICMP_ECHO_REQUEST << 8) & 0xffff; + cksum += htons(RTE_IP_ICMP_ECHO_REPLY << 8); cksum = (cksum & 0xffff) + (cksum >> 16); cksum = (cksum & 0xffff) + (cksum >> 16); icmp_h->icmp_cksum = ~cksum; diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h index d0309537e..3f8100a5f 100644 --- a/lib/librte_net/rte_icmp.h +++ b/lib/librte_net/rte_icmp.h @@ -32,8 +32,8 @@ struct rte_icmp_hdr { } __attribute__((__packed__)); /* ICMP packet types */ -#define IP_ICMP_ECHO_REPLY 0 -#define IP_ICMP_ECHO_REQUEST 8 +#define RTE_IP_ICMP_ECHO_REPLY 0 +#define RTE_IP_ICMP_ECHO_REQUEST 8 #ifdef __cplusplus } -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 10/14] net: add rte prefix to ip structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (9 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 09/14] net: add rte prefix to icmp defines Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines Olivier Matz ` (5 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct ipv4_hdr as struct rte_ipv4_hdr. - rename struct ipv6_hdr as struct rte_ipv6_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pipeline/pipeline_acl.c | 10 +- app/test-pipeline/pipeline_hash.c | 8 +- app/test-pmd/csumonly.c | 40 ++++---- app/test-pmd/flowgen.c | 6 +- app/test-pmd/icmpecho.c | 8 +- app/test-pmd/macfwd.c | 2 +- app/test-pmd/macswap_common.h | 2 +- app/test-pmd/txonly.c | 16 +-- app/test-pmd/util.c | 12 +-- app/test/packet_burst_generator.c | 44 ++++----- app/test/packet_burst_generator.h | 6 +- app/test/test_flow_classify.c | 16 +-- app/test/test_ipsec.c | 4 +- app/test/test_link_bonding.c | 8 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_pmd_perf.c | 2 +- app/test/test_sched.c | 4 +- app/test/test_thash.c | 2 +- .../prog_guide/packet_classif_access_ctrl.rst | 12 +-- doc/guides/sample_app_ug/flow_classify.rst | 10 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- doc/guides/sample_app_ug/l3_forward.rst | 12 +-- doc/guides/sample_app_ug/server_node_efd.rst | 8 +- drivers/net/bonding/rte_eth_bond_pmd.c | 16 +-- drivers/net/dpaa/dpaa_rxtx.c | 8 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/ena/ena_ethdev.c | 4 +- drivers/net/enic/enic_clsf.c | 16 +-- drivers/net/enic/enic_flow.c | 30 +++--- drivers/net/i40e/i40e_fdir.c | 36 +++---- drivers/net/mlx5/mlx5_flow.c | 6 +- drivers/net/mlx5/mlx5_flow_dv.c | 8 +- drivers/net/mlx5/mlx5_flow_tcf.c | 12 +-- drivers/net/mvpp2/mrvl_flow.c | 2 +- drivers/net/qede/qede_filter.c | 14 +-- drivers/net/qede/qede_rxtx.c | 12 +-- drivers/net/sfc/sfc_tso.h | 4 +- drivers/net/softnic/rte_eth_softnic_pipeline.c | 32 +++--- drivers/net/tap/rte_eth_tap.c | 10 +- drivers/net/virtio/virtio_rxtx.c | 8 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 18 ++-- examples/bond/main.c | 4 +- examples/flow_classify/flow_classify.c | 10 +- examples/ip_fragmentation/main.c | 12 +-- examples/ip_pipeline/pipeline.c | 32 +++--- examples/ip_reassembly/main.c | 12 +-- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/ipsec-secgw/sa.c | 6 +- examples/ipv4_multicast/main.c | 4 +- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 80 +++++++-------- examples/l3fwd-power/main.c | 28 +++--- examples/l3fwd-vf/main.c | 18 ++-- examples/l3fwd/l3fwd.h | 6 +- examples/l3fwd/l3fwd_altivec.h | 10 +- examples/l3fwd/l3fwd_common.h | 4 +- examples/l3fwd/l3fwd_em.c | 14 +-- examples/l3fwd/l3fwd_em.h | 8 +- examples/l3fwd/l3fwd_em_hlm.h | 8 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 8 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 8 +- examples/l3fwd/l3fwd_em_sequential.h | 8 +- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/l3fwd/l3fwd_lpm.h | 8 +- examples/l3fwd/l3fwd_lpm_altivec.h | 10 +- examples/l3fwd/l3fwd_lpm_neon.h | 10 +- examples/l3fwd/l3fwd_lpm_sse.h | 10 +- examples/l3fwd/l3fwd_neon.h | 10 +- examples/l3fwd/l3fwd_sse.h | 10 +- examples/load_balancer/runtime.c | 4 +- examples/performance-thread/l3fwd-thread/main.c | 110 ++++++++++----------- examples/server_node_efd/node/node.c | 4 +- examples/server_node_efd/server/main.c | 4 +- examples/tep_termination/vxlan.c | 32 +++--- examples/tep_termination/vxlan.h | 2 +- examples/tep_termination/vxlan_setup.c | 4 +- examples/vhost/main.c | 2 +- lib/librte_ethdev/rte_flow.h | 4 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 16 +-- lib/librte_gro/gro_tcp4.c | 8 +- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 12 +-- lib/librte_gso/gso_common.h | 4 +- lib/librte_gso/gso_tcp4.c | 8 +- lib/librte_gso/gso_tunnel_tcp4.c | 10 +- lib/librte_gso/gso_udp4.c | 8 +- lib/librte_gso/rte_gso.h | 4 +- lib/librte_hash/rte_thash.h | 2 +- lib/librte_ip_frag/rte_ip_frag.h | 8 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 26 ++--- lib/librte_ip_frag/rte_ipv4_reassembly.c | 6 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 ++--- lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- lib/librte_ipsec/iph.h | 8 +- lib/librte_net/rte_ip.h | 22 ++--- lib/librte_net/rte_net.c | 18 ++-- lib/librte_net/rte_net.h | 10 +- lib/librte_pipeline/rte_table_action.c | 50 +++++----- lib/librte_port/rte_port_ras.c | 4 +- lib/librte_vhost/virtio_net.c | 10 +- 100 files changed, 636 insertions(+), 636 deletions(-) diff --git a/app/test-pipeline/pipeline_acl.c b/app/test-pipeline/pipeline_acl.c index 8853d4376..ad939008a 100644 --- a/app/test-pipeline/pipeline_acl.c +++ b/app/test-pipeline/pipeline_acl.c @@ -40,7 +40,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -48,7 +48,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -56,21 +56,21 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr), + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index 3e4a0a1bb..25fb2e0da 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -426,8 +426,8 @@ app_main_loop_rx_metadata(void) { for (j = 0; j < n_mbufs; j++) { struct rte_mbuf *m; uint8_t *m_data, *key; - struct ipv4_hdr *ip_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ip_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t ip_dst; uint8_t *ipv6_dst; uint32_t *signature, *k32; @@ -440,14 +440,14 @@ app_main_loop_rx_metadata(void) { APP_METADATA_OFFSET(32)); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip_hdr = (struct ipv4_hdr *) + ip_hdr = (struct rte_ipv4_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 7080ff5d9..eff2b4f7c 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -100,7 +100,7 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) /* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) +parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; @@ -119,11 +119,11 @@ parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) /* Parse an IPv6 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) +parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ @@ -144,8 +144,8 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) static void parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; @@ -159,11 +159,11 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) switch (info->ethertype) { case _htons(RTE_ETHER_TYPE_IPv4): - ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv4(ipv4_hdr, info); break; case _htons(RTE_ETHER_TYPE_IPv6): - ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len); + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv6(ipv6_hdr, info); break; default: @@ -209,8 +209,8 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); @@ -229,7 +229,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)vxlan_gpe_hdr + + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ipv4(ipv4_hdr, info); @@ -243,7 +243,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)vxlan_gpe_hdr + + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); @@ -272,8 +272,8 @@ static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; gre_len += sizeof(struct simple_gre_hdr); @@ -292,7 +292,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)gre_hdr + gre_len); parse_ipv4(ipv4_hdr, info); info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); @@ -305,7 +305,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len); + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)gre_hdr + gre_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); @@ -332,8 +332,8 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) static void parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr = encap_ip; - struct ipv6_hdr *ipv6_hdr = encap_ip; + struct rte_ipv4_hdr *ipv4_hdr = encap_ip; + struct rte_ipv6_hdr *ipv6_hdr = encap_ip; uint8_t ip_version; ip_version = (ipv4_hdr->version_ihl & 0xf0) >> 4; @@ -362,7 +362,7 @@ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { - struct ipv4_hdr *ipv4_hdr = l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -453,8 +453,8 @@ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, uint64_t tx_offloads, int tso_enabled) { - struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; - struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; struct udp_hdr *udp_hdr; uint64_t ol_flags = 0; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 00acbaf70..45a5e13e0 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -120,7 +120,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mempool *mbp; struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags = 0; @@ -176,7 +176,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); /* Initialize IP header. */ - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); memset(ip_hdr, 0, sizeof(*ip_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -206,7 +206,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkts_burst[nb_pkt] = pkt; next_flow = (next_flow + 1) % cfg_n_flows; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 4bf3fed64..146293175 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -243,7 +243,7 @@ ipv4_addr_dump(const char *what, uint32_t be_ipv4_addr) } static uint16_t -ipv4_hdr_cksum(struct ipv4_hdr *ip_h) +ipv4_hdr_cksum(struct rte_ipv4_hdr *ip_h) { uint16_t *v16_h; uint32_t ip_cksum; @@ -278,7 +278,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_ether_hdr *eth_h; struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; - struct ipv4_hdr *ip_h; + struct rte_ipv4_hdr *ip_h; struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; @@ -413,7 +413,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_pktmbuf_free(pkt); continue; } - ip_h = (struct ipv4_hdr *) ((char *)eth_h + l2_len); + ip_h = (struct rte_ipv4_hdr *) ((char *)eth_h + l2_len); if (verbose_level > 0) { ipv4_addr_dump(" IPV4: src=", ip_h->src_addr); ipv4_addr_dump(" dst=", ip_h->dst_addr); @@ -426,7 +426,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * Check if packet is a ICMP echo request. */ icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f15149252..d2ebb1105 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -99,7 +99,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; } diff --git a/app/test-pmd/macswap_common.h b/app/test-pmd/macswap_common.h index 56f86baad..7e9a3590a 100644 --- a/app/test-pmd/macswap_common.h +++ b/app/test-pmd/macswap_common.h @@ -40,7 +40,7 @@ mbuf_field_set(struct rte_mbuf *mb, uint64_t ol_flags) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); } #endif /* _MACSWAP_COMMON_H_ */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index d5a46e8fc..f7f023ff6 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -51,7 +51,7 @@ #define IP_HDRLEN 0x05 /* default IP header length == five 32-bits words. */ #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) -static struct ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ +static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ @@ -93,7 +93,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } static void -setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, +setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, struct udp_hdr *udp_hdr, uint16_t pkt_data_len) { @@ -113,7 +113,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; ip_hdr->fragment_offset = 0; @@ -175,7 +175,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkt_len = pkt->data_len; pkt_seg = pkt; @@ -193,11 +193,11 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, sizeof(struct rte_ether_hdr)); if (txonly_multi_flow) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t addr; ip_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* * Generate multiple flows by varying IP src addr. This @@ -211,7 +211,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, } copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); /* * Complete first mbuf of packet and append it to the * burst of packets to be transmitted. @@ -346,7 +346,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) uint16_t pkt_data_len; pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 105c56090..b8e5548ca 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -103,8 +103,8 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (sw_packet_type & RTE_PTYPE_INNER_L4_MASK) printf(" - inner_l4_len=%d", hdr_lens.inner_l4_len); if (is_encapsulation) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; @@ -116,15 +116,15 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { - l3_len = sizeof(struct ipv4_hdr); + l3_len = sizeof(struct rte_ipv4_hdr); ipv4_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, l2_len); l4_proto = ipv4_hdr->next_proto_id; } else { - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); ipv6_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv6_hdr *, + struct rte_ipv6_hdr *, l2_len); l4_proto = ipv6_hdr->proto; } diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index feee9e121..886b5f8ac 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -137,7 +137,7 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, } uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len) { ip_hdr->vtc_flow = 0; @@ -148,11 +148,11 @@ initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, rte_memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); rte_memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); - return (uint16_t) (pkt_data_len + sizeof(struct ipv6_hdr)); + return (uint16_t) (pkt_data_len + sizeof(struct rte_ipv6_hdr)); } uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -162,7 +162,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -200,7 +200,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, } uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto) { uint16_t pkt_len; @@ -210,7 +210,7 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -300,13 +300,13 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), pkt, eth_hdr_size); copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), pkt, eth_hdr_size); copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); } /* @@ -319,10 +319,10 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; @@ -379,45 +379,45 @@ generate_packet_burst_proto(struct rte_mempool *mp, copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; default: break; } } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; default: break; @@ -434,10 +434,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 8489212d0..93efee1f5 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -46,15 +46,15 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto); int diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 3f06f3005..96e371691 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -40,7 +40,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -50,7 +50,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -60,7 +60,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -73,7 +73,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -83,7 +83,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -490,7 +490,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); @@ -527,7 +527,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); @@ -564,7 +564,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 7ad285a92..2cad4096c 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -534,7 +534,7 @@ const char null_encrypted_data[] = "Network Security People Have A Strange Sense Of Humor unlike Other " "People who have a normal sense of humour"; -struct ipv4_hdr ipv4_outer = { +struct rte_ipv4_hdr ipv4_outer = { .version_ihl = IPVERSION << 4 | sizeof(ipv4_outer) / IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, @@ -572,7 +572,7 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, size_t len, uint32_t spi, uint32_t seq) { struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct rte_esp_hdr); + uint32_t hdrlen = sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_esp_hdr); uint32_t taillen = sizeof(struct esp_tail); uint32_t t_len = len + hdrlen + taillen; uint32_t padlen; diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 2490d5dd2..924de81ae 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -78,14 +78,14 @@ struct link_bonding_unittest_params { /* Packet Headers */ struct rte_ether_hdr *pkt_eth_hdr; - struct ipv4_hdr *pkt_ipv4_hdr; - struct ipv6_hdr *pkt_ipv6_hdr; + struct rte_ipv4_hdr *pkt_ipv4_hdr; + struct rte_ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; }; -static struct ipv4_hdr pkt_ipv4_hdr; -static struct ipv6_hdr pkt_ipv6_hdr; +static struct rte_ipv4_hdr pkt_ipv4_hdr; +static struct rte_ipv6_hdr pkt_ipv6_hdr; static struct udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 6295b1874..fba629d43 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -734,8 +734,8 @@ generate_packets(struct rte_ether_addr *src_mac, struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { - struct ipv4_hdr v4; - struct ipv6_hdr v6; + struct rte_ipv4_hdr v4; + struct rte_ipv6_hdr v6; } pkt_ip_hdr; int retval; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 4b973ffc4..0d1c1b1ab 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -183,7 +183,7 @@ init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 58f42a2d8..4781c2307 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -80,14 +80,14 @@ prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr; struct rte_vlan_hdr *vlan1, *vlan2; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; /* Simulate a classifier */ eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); vlan1 = (struct rte_vlan_hdr *)(ð_hdr->ether_type ); vlan2 = (struct rte_vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct rte_vlan_hdr)); eth_hdr = (struct rte_ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct rte_vlan_hdr)); - ip_hdr = (struct ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); + ip_hdr = (struct rte_ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); vlan2->vlan_tci = rte_cpu_to_be_16(PIPE); diff --git a/app/test/test_thash.c b/app/test/test_thash.c index 61754a947..bf332c9e9 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -110,7 +110,7 @@ test_thash(void) union rte_thash_tuple tuple; uint32_t rss_l3, rss_l3l4; uint8_t rss_key_be[RTE_DIM(default_rss_key)]; - struct ipv6_hdr ipv6_hdr; + struct rte_ipv6_hdr ipv6_hdr; /* Convert RSS key*/ rte_convert_rss_key((uint32_t *)&default_rss_key, diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 395b3ec47..6887e4dc6 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -154,7 +154,7 @@ To define classification for the IPv6 2-tuple: <protocol, IPv6 source address> o .. code-block:: c - struct struct ipv6_hdr { + struct struct rte_ipv6_hdr { uint32_t vtc_flow; /* IP version, traffic class & flow label. */ uint16_t payload_len; /* IP packet length - includes sizeof(ip_header). */ uint8_t proto; /* Protocol, next header. */ @@ -173,7 +173,7 @@ The following array of field definitions can be used: .size = sizeof (uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof (struct ipv6_hdr, proto), + .offset = offsetof (struct rte_ipv6_hdr, proto), }, { @@ -181,7 +181,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof (struct ipv6_hdr, src_addr[0]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[0]), }, { @@ -189,7 +189,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof (struct ipv6_hdr, src_addr[4]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[4]), }, { @@ -197,7 +197,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof (struct ipv6_hdr, src_addr[8]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[8]), }, { @@ -205,7 +205,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof (struct ipv6_hdr, src_addr[12]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[12]), }, }; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 762c3844e..46703acbf 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -92,7 +92,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -102,7 +102,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -112,7 +112,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -125,7 +125,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -135,7 +135,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index a4cb4377f..46c920433 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index 58c4aae92..bf6c5ea52 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -242,7 +242,7 @@ The get_ipv4_dst_port() function is shown below: int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); m128i data = _mm_loadu_si128(( m128i*)(ipv4_hdr)); @@ -270,10 +270,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -306,7 +306,7 @@ for LPM-based lookups is done by the get_ipv4_dst_port() function below: .. code-block:: c static inline uint16_t - get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) + get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint8_t next_hop; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index f7dab9e98..12208f425 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -191,12 +191,12 @@ which tells the node where the packet has to be distributed. efd_value_t data[EFD_BURST_MAX]; const void *key_ptrs[EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; @@ -348,7 +348,7 @@ flow is not handled by the node. static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -356,7 +356,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 58c23a970..c7fcd9b8e 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -587,7 +587,7 @@ static void mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_h, uint16_t port, uint32_t __attribute__((unused)) *burstnumber) { - struct ipv4_hdr *ipv4_h; + struct rte_ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB struct rte_arp_hdr *arp_h; char dst_ip[16]; @@ -604,7 +604,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_ #endif if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset); + ipv4_h = (struct rte_ipv4_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String); #ifdef RTE_LIBRTE_BOND_DEBUG_ALB ipv4_addr_to_dot(ipv4_h->dst_addr, dst_ip, MaxIPv4String); @@ -751,13 +751,13 @@ ether_hash(struct rte_ether_hdr *eth_hdr) } static inline uint32_t -ipv4_hash(struct ipv4_hdr *ipv4_hdr) +ipv4_hash(struct rte_ipv4_hdr *ipv4_hdr) { return ipv4_hdr->src_addr ^ ipv4_hdr->dst_addr; } static inline uint32_t -ipv6_hash(struct ipv6_hdr *ipv6_hdr) +ipv6_hash(struct rte_ipv6_hdr *ipv6_hdr) { unaligned_uint32_t *word_src_addr = (unaligned_uint32_t *)&(ipv6_hdr->src_addr[0]); @@ -808,12 +808,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(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv4_hash(ipv4_hdr); } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); } @@ -847,7 +847,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = 0; if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); size_t ip_hdr_offset; @@ -874,7 +874,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, } } } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index ff061df25..63243a79a 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -200,22 +200,22 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; DPAA_DP_LOG(DEBUG, "Calculating checksum for mbuf: %p", mbuf); if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4_EXT)) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; ipv4_hdr->hdr_checksum = 0; ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } else if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6_EXT)) - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index e09cc8d49..f59215894 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -222,7 +222,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, /* setup IPCS* fields */ ctx.lower_setup.ip_fields.ipcss = (uint8_t)l2len; ctx.lower_setup.ip_fields.ipcso = (uint8_t)(l2len + - offsetof(struct ipv4_hdr, hdr_checksum)); + offsetof(struct rte_ipv4_hdr, hdr_checksum)); /* * When doing checksum or TCP segmentation with IPv6 headers, diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 62986b6d6..469d7aaf6 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2136,7 +2136,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint32_t i; struct rte_mbuf *m; struct ena_ring *tx_ring = (struct ena_ring *)(tx_queue); - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint64_t ol_flags; uint16_t frag_field; @@ -2153,7 +2153,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (unlikely(m->l2_len == 0)) m->l2_len = sizeof(struct rte_ether_hdr); - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 48c8e6264..6bdc5a09a 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -183,9 +183,9 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) { - struct ipv4_hdr ip4_mask, ip4_val; - memset(&ip4_mask, 0, sizeof(struct ipv4_hdr)); - memset(&ip4_val, 0, sizeof(struct ipv4_hdr)); + struct rte_ipv4_hdr ip4_mask, ip4_val; + memset(&ip4_mask, 0, sizeof(struct rte_ipv4_hdr)); + memset(&ip4_val, 0, sizeof(struct rte_ipv4_hdr)); if (input->flow.ip4_flow.tos) { ip4_mask.type_of_service = masks->ipv4_mask.tos; @@ -213,7 +213,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV4, FILTER_GENERIC_1_L3, - &ip4_mask, &ip4_val, sizeof(struct ipv4_hdr)); + &ip4_mask, &ip4_val, sizeof(struct rte_ipv4_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { @@ -272,9 +272,9 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) { - struct ipv6_hdr ipv6_mask, ipv6_val; - memset(&ipv6_mask, 0, sizeof(struct ipv6_hdr)); - memset(&ipv6_val, 0, sizeof(struct ipv6_hdr)); + struct rte_ipv6_hdr ipv6_mask, ipv6_val; + memset(&ipv6_mask, 0, sizeof(struct rte_ipv6_hdr)); + memset(&ipv6_val, 0, sizeof(struct rte_ipv6_hdr)); if (input->flow.ipv6_flow.proto) { ipv6_mask.proto = masks->ipv6_mask.proto; @@ -302,7 +302,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV6, FILTER_GENERIC_1_L3, - &ipv6_mask, &ipv6_val, sizeof(struct ipv6_hdr)); + &ipv6_mask, &ipv6_val, sizeof(struct rte_ipv6_hdr)); } } diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 4996fdf8a..b1a9bcbde 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -410,7 +410,7 @@ enic_copy_item_ipv4_v1(struct copy_item_args *arg) const struct rte_flow_item_ipv4 *spec = item->spec; const struct rte_flow_item_ipv4 *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct ipv4_hdr supported_mask = { + struct rte_ipv4_hdr supported_mask = { .src_addr = 0xffffffff, .dst_addr = 0xffffffff, }; @@ -605,9 +605,9 @@ enic_copy_item_inner_ipv4_v2(struct copy_item_args *arg) if (!mask) mask = &rte_flow_item_ipv4_mask; /* Append ipv4 header to L5 and set ether type = ipv4 */ - arg->l3_proto_off = *off + offsetof(struct ipv4_hdr, next_proto_id); + arg->l3_proto_off = *off + offsetof(struct rte_ipv4_hdr, next_proto_id); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ipv4_hdr), + arg->item->spec, mask, sizeof(struct rte_ipv4_hdr), arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4), 2); } @@ -621,9 +621,9 @@ enic_copy_item_inner_ipv6_v2(struct copy_item_args *arg) if (!mask) mask = &rte_flow_item_ipv6_mask; /* Append ipv6 header to L5 and set ether type = ipv6 */ - arg->l3_proto_off = *off + offsetof(struct ipv6_hdr, proto); + arg->l3_proto_off = *off + offsetof(struct rte_ipv6_hdr, proto); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ipv6_hdr), + arg->item->spec, mask, sizeof(struct rte_ipv6_hdr), arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6), 2); } @@ -758,9 +758,9 @@ enic_copy_item_ipv4_v2(struct copy_item_args *arg) mask = &rte_flow_item_ipv4_mask; memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); return 0; } @@ -787,9 +787,9 @@ enic_copy_item_ipv6_v2(struct copy_item_args *arg) mask = &rte_flow_item_ipv6_mask; memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); return 0; } @@ -869,16 +869,16 @@ enic_copy_item_sctp_v2(struct copy_item_args *arg) * the protocol number in the IP pattern. */ if (gp->val_flags & FILTER_GENERIC_1_IPV4) { - struct ipv4_hdr *ip; - ip = (struct ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; + struct rte_ipv4_hdr *ip; + ip = (struct rte_ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; ip_proto_mask = &ip->next_proto_id; - ip = (struct ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; + ip = (struct rte_ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; ip_proto = &ip->next_proto_id; } else if (gp->val_flags & FILTER_GENERIC_1_IPV6) { - struct ipv6_hdr *ip; - ip = (struct ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; + struct rte_ipv6_hdr *ip; + ip = (struct rte_ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; ip_proto_mask = &ip->proto; - ip = (struct ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; + ip = (struct rte_ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; ip_proto = &ip->proto; } else { /* Need IPv4/IPv6 pattern first */ diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4aaf27f7c..b20f30fb4 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -686,8 +686,8 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; static const uint8_t next_proto[] = { [RTE_ETH_FLOW_FRAG_IPV4] = IPPROTO_IP, [RTE_ETH_FLOW_NONFRAG_IPV4_TCP] = IPPROTO_TCP, @@ -723,7 +723,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: case RTE_ETH_FLOW_FRAG_IPV4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -743,14 +743,14 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, */ ip->src_addr = fdir_input->flow.ip4_flow.dst_ip; ip->dst_addr = fdir_input->flow.ip4_flow.src_ip; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: case RTE_ETH_FLOW_FRAG_IPV6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -776,7 +776,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, rte_memcpy(&(ip6->dst_addr), &(fdir_input->flow.ipv6_flow.src_ip), IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); break; default: PMD_DRV_LOG(ERR, "unknown flow type %u.", @@ -960,8 +960,8 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; bool is_customized_pctype = fdir_input->flow_ext.customized_pctype; static const uint8_t next_proto[] = { @@ -1007,7 +1007,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, pctype == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV4 || is_customized_pctype) { - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -1034,13 +1034,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) ip->next_proto_id = IPPROTO_UDP; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV6) { - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -1066,7 +1066,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); } else { PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype); @@ -1093,8 +1093,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, struct tcp_hdr *tcp; struct sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; - struct ipv4_hdr *gtp_ipv4; - struct ipv6_hdr *gtp_ipv6; + struct rte_ipv4_hdr *gtp_ipv4; + struct rte_ipv6_hdr *gtp_ipv6; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -1232,7 +1232,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv4 = (struct ipv4_hdr *) + gtp_ipv4 = (struct rte_ipv4_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv4->version_ihl = @@ -1242,11 +1242,11 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, rte_cpu_to_be_16( I40E_FDIR_INNER_IP_DEFAULT_LEN); payload = (unsigned char *)gtp_ipv4 + - sizeof(struct ipv4_hdr); + sizeof(struct rte_ipv4_hdr); } else if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv6 = (struct ipv6_hdr *) + gtp_ipv6 = (struct rte_ipv6_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv6->vtc_flow = @@ -1260,7 +1260,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, gtp_ipv6->hop_limits = I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS; payload = (unsigned char *)gtp_ipv6 + - sizeof(struct ipv6_hdr); + sizeof(struct rte_ipv6_hdr); } else payload = (unsigned char *)gtp + sizeof(struct rte_flow_item_gtp); diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 9dc492ad2..43a5dd4cb 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2538,13 +2538,13 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: - attributes->l3.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = input->flow.ip4_flow.src_ip, .dst_addr = input->flow.ip4_flow.dst_ip, .time_to_live = input->flow.ip4_flow.ttl, .type_of_service = input->flow.ip4_flow.tos, }; - attributes->l3_mask.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3_mask.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = mask->ipv4_mask.src_ip, .dst_addr = mask->ipv4_mask.dst_ip, .time_to_live = mask->ipv4_mask.ttl, @@ -2560,7 +2560,7 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: - attributes->l3.ipv6.hdr = (struct ipv6_hdr){ + attributes->l3.ipv6.hdr = (struct rte_ipv6_hdr){ .hop_limits = input->flow.ipv6_flow.hop_limits, .proto = input->flow.ipv6_flow.proto, }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index a4c7529cf..d2a725469 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1052,8 +1052,8 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, { struct rte_ether_hdr *eth = NULL; struct rte_vlan_hdr *vlan = NULL; - struct ipv4_hdr *ipv4 = NULL; - struct ipv6_hdr *ipv6 = NULL; + struct rte_ipv4_hdr *ipv4 = NULL; + struct rte_ipv6_hdr *ipv6 = NULL; struct udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; @@ -1089,7 +1089,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_VLAN); break; case RTE_FLOW_ITEM_TYPE_IPV4: - ipv4 = (struct ipv4_hdr *)&buf[temp_size]; + ipv4 = (struct rte_ipv4_hdr *)&buf[temp_size]; if (!vlan && !eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1107,7 +1107,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv4->time_to_live = MLX5_ENCAP_IPV4_TTL_DEF; break; case RTE_FLOW_ITEM_TYPE_IPV6: - ipv6 = (struct ipv6_hdr *)&buf[temp_size]; + ipv6 = (struct rte_ipv6_hdr *)&buf[temp_size]; if (!vlan && !eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 595c13e1f..dd5a090af 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -732,12 +732,12 @@ flow_tcf_pedit_key_set_dec_ttl(const struct rte_flow_action *actions, if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV4) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP4; p_parser->keys[idx].off = - offsetof(struct ipv4_hdr, time_to_live); + offsetof(struct rte_ipv4_hdr, time_to_live); } if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP6; p_parser->keys[idx].off = - offsetof(struct ipv6_hdr, hop_limits); + offsetof(struct rte_ipv6_hdr, hop_limits); } if (actions->type == RTE_FLOW_ACTION_TYPE_DEC_TTL) { p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_ADD; @@ -801,8 +801,8 @@ flow_tcf_pedit_key_set_ipv6_addr(const struct rte_flow_action *actions, int keys = NUM_OF_PEDIT_KEYS(IPV6_ADDR_LEN); int off_base = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC ? - offsetof(struct ipv6_hdr, src_addr) : - offsetof(struct ipv6_hdr, dst_addr); + offsetof(struct rte_ipv6_hdr, src_addr) : + offsetof(struct rte_ipv6_hdr, dst_addr); const struct rte_flow_action_set_ipv6 *conf = (const struct rte_flow_action_set_ipv6 *)actions->conf; @@ -836,8 +836,8 @@ flow_tcf_pedit_key_set_ipv4_addr(const struct rte_flow_action *actions, p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_SET; p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC ? - offsetof(struct ipv4_hdr, src_addr) : - offsetof(struct ipv4_hdr, dst_addr); + offsetof(struct rte_ipv4_hdr, src_addr) : + offsetof(struct rte_ipv4_hdr, dst_addr); p_parser->keys[idx].mask = ~UINT32_MAX; p_parser->keys[idx].val = ((const struct rte_flow_action_set_ipv4 *) diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index 738986575..381b54e29 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -1170,7 +1170,7 @@ mrvl_parse_ip6(const struct rte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_ipv6 *spec = NULL, *mask = NULL; - struct ipv6_hdr zero; + struct rte_ipv6_hdr zero; uint32_t flow_mask; int ret; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 12c83f46d..34299b993 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -457,8 +457,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); uint16_t *ether_type; uint8_t *raw_pkt; - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; struct tcp_hdr *tcp; uint16_t len; @@ -474,14 +474,14 @@ 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 RTE_ETHER_TYPE_IPv4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; ip->version_ihl = QEDE_FDIR_IP_DEFAULT_VERSION_IHL; - ip->total_length = sizeof(struct ipv4_hdr); + ip->total_length = sizeof(struct rte_ipv4_hdr); ip->next_proto_id = arfs->tuple.ip_proto; ip->time_to_live = QEDE_FDIR_IPV4_DEF_TTL; ip->dst_addr = arfs->tuple.dst_ipv4; ip->src_addr = arfs->tuple.src_ipv4; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); params->ipv4 = true; raw_pkt = (uint8_t *)buff; @@ -507,7 +507,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, } break; case RTE_ETHER_TYPE_IPv6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; ip6->proto = arfs->tuple.ip_proto; ip6->vtc_flow = rte_cpu_to_be_32(QEDE_FDIR_IPV6_DEFAULT_VTC_FLOW); @@ -516,7 +516,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, IPV6_ADDR_LEN); rte_memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); params->ipv6 = true; raw_pkt = (uint8_t *)buff; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 235f78ae3..a07700167 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -951,8 +951,8 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; @@ -972,14 +972,14 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) if (ethertype == RTE_ETHER_TYPE_IPv4) { packet_type |= RTE_PTYPE_L3_IPV4; - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, len); + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_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 == RTE_ETHER_TYPE_IPv6) { packet_type |= RTE_PTYPE_L3_IPV6; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, len); + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, len); if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) @@ -1141,7 +1141,7 @@ static inline uint32_t qede_rx_cqe_to_pkt_type(uint16_t flags) static inline uint8_t qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) { - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; uint16_t pkt_csum; uint16_t calc_csum; uint16_t val; @@ -1152,7 +1152,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) if (unlikely(val)) { m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; diff --git a/drivers/net/sfc/sfc_tso.h b/drivers/net/sfc/sfc_tso.h index 8ecefdfd2..ef257519a 100644 --- a/drivers/net/sfc/sfc_tso.h +++ b/drivers/net/sfc/sfc_tso.h @@ -29,10 +29,10 @@ extern "C" { static inline uint16_t sfc_tso_ip4_get_ipid(const uint8_t *pkt_hdrp, size_t ip_hdr_off) { - const struct ipv4_hdr *ip_hdrp; + const struct rte_ipv4_hdr *ip_hdrp; uint16_t ipid; - ip_hdrp = (const struct ipv4_hdr *)(pkt_hdrp + ip_hdr_off); + ip_hdrp = (const struct rte_ipv4_hdr *)(pkt_hdrp + ip_hdr_off); rte_memcpy(&ipid, &ip_hdrp->packet_id, sizeof(ipid)); return rte_be_to_cpu_16(ipid); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 308fd1534..e0e5856a4 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -660,7 +660,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -669,7 +669,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -678,7 +678,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -687,7 +687,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -697,7 +697,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -709,7 +709,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -718,7 +718,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -726,7 +726,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -734,7 +734,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -742,7 +742,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -751,7 +751,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -759,7 +759,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -767,7 +767,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -775,7 +775,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -784,7 +784,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -794,7 +794,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index bb0aee42d..2465d9c2c 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -272,12 +272,12 @@ tap_verify_csum(struct rte_mbuf *mbuf) else if (l2 == RTE_PTYPE_L2_ETHER_QINQ) l2_len += 8; /* Don't verify checksum for packets with discontinuous L2 header */ - if (unlikely(l2_len + sizeof(struct ipv4_hdr) > + if (unlikely(l2_len + sizeof(struct rte_ipv4_hdr) > rte_pktmbuf_data_len(mbuf))) return; l3_hdr = rte_pktmbuf_mtod_offset(mbuf, void *, l2_len); if (l3 == RTE_PTYPE_L3_IPV4 || l3 == RTE_PTYPE_L3_IPV4_EXT) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; /* ihl contains the number of 4-byte words in the header */ l3_len = 4 * (iph->version_ihl & 0xf); @@ -295,9 +295,9 @@ tap_verify_csum(struct rte_mbuf *mbuf) PKT_RX_IP_CKSUM_BAD : PKT_RX_IP_CKSUM_GOOD; } else if (l3 == RTE_PTYPE_L3_IPV6) { - struct ipv6_hdr *iph = l3_hdr; + struct rte_ipv6_hdr *iph = l3_hdr; - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); /* check that the total length reported by header is not * greater than the total received size */ @@ -496,7 +496,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, void *l3_hdr = packet + l2_len; if (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4)) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; uint16_t cksum; iph->hdr_checksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 12283cd4c..2b1080155 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -479,13 +479,13 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) /* common case: header is not fragmented */ if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + m->l4_len)) { - struct ipv4_hdr *iph; - struct ipv6_hdr *ip6h; + struct rte_ipv4_hdr *iph; + struct rte_ipv6_hdr *ip6h; struct tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; - iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + iph = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); th = RTE_PTR_ADD(iph, m->l3_len); if ((iph->version_ihl >> 4) == 4) { iph->hdr_checksum = 0; @@ -494,7 +494,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) - m->l3_len); } else { - ip6h = (struct ipv6_hdr *)iph; + ip6h = (struct rte_ipv6_hdr *)iph; ip_paylen = ip6h->payload_len; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index a2c047ec6..7749458e4 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -667,8 +667,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm) { uint32_t hlen, slen; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; char *ptr; @@ -679,20 +679,20 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { - if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) - return hw->mtu - sizeof(struct ipv4_hdr) + if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) + return hw->mtu - sizeof(struct rte_ipv4_hdr) - sizeof(struct tcp_hdr); - ipv4_hdr = (struct ipv4_hdr *)(ptr + hlen); + ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { - if (unlikely(slen < hlen + sizeof(struct ipv6_hdr))) - return hw->mtu - sizeof(struct ipv6_hdr) - + if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) + return hw->mtu - sizeof(struct rte_ipv6_hdr) - sizeof(struct tcp_hdr); - ipv6_hdr = (struct ipv6_hdr *)(ptr + hlen); - hlen += sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); + hlen += sizeof(struct rte_ipv6_hdr); if (unlikely(ipv6_hdr->proto != IPPROTO_TCP)) { int frag; diff --git a/examples/bond/main.c b/examples/bond/main.c index 04102b7ed..cea37e02c 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -340,7 +340,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; uint16_t rx_cnt; @@ -405,7 +405,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[2]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index dfb7db1c9..c75a410f4 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -99,7 +99,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -109,7 +109,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -119,7 +119,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -132,7 +132,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -142,7 +142,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index b34a2228f..9c8a0a9b9 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -65,8 +65,8 @@ /* * Default payload in bytes for the IPv6 packet. */ -#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct ipv4_hdr)) -#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct ipv6_hdr)) +#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct rte_ipv4_hdr)) +#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct rte_ipv6_hdr)) /* * Max number of fragments per packet expected - defined by config file. @@ -259,10 +259,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, /* if this is an IPv4 packet */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv4_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv4_hdr *); ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); /* Find destination port */ @@ -294,12 +294,12 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, } } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if this is an IPv6 packet */ - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; ipv6 = 1; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv6_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv6_hdr *); /* Find destination port */ if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index 78d590d77..9cc7e32d8 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -636,7 +636,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -645,7 +645,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -654,7 +654,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -663,7 +663,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -673,7 +673,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -685,7 +685,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -694,7 +694,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -702,7 +702,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -710,7 +710,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -718,7 +718,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -727,7 +727,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -735,7 +735,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -743,7 +743,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -751,7 +751,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -760,7 +760,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -770,7 +770,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index c2a1f9228..00a95e07a 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -324,10 +324,10 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, /* if packet is IPv4 */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); /* if it is a fragmented packet, then try to reassemble. */ if (rte_ipv4_frag_pkt_is_fragmented(ip_hdr)) { @@ -351,7 +351,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); } } ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); @@ -366,9 +366,9 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if packet is IPv6 */ struct ipv6_extension_fragment *frag_hdr; - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(ip_hdr); @@ -389,7 +389,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); } } diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 05c187c4c..3302ce944 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -340,7 +340,7 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, /* calculate IPv4 cksum in SW */ if ((pkt->ol_flags & PKT_TX_IP_CKSUM) == 0) - ip->ip_sum = rte_ipv4_cksum((struct ipv4_hdr *)ip); + ip->ip_sum = rte_ipv4_cksum((struct rte_ipv4_hdr *)ip); ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); } else { diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index b323b0163..1d0020567 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -967,7 +967,7 @@ get_spi_proto(uint32_t spi, enum rte_security_ipsec_sa_direction dir) static int fill_ipsec_sa_prm(struct rte_ipsec_sa_prm *prm, const struct ipsec_sa *ss, - const struct ipv4_hdr *v4, struct ipv6_hdr *v6) + const struct rte_ipv4_hdr *v4, struct rte_ipv6_hdr *v6) { int32_t rc; @@ -1038,7 +1038,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) { int rc; struct rte_ipsec_sa_prm prm; - struct ipv4_hdr v4 = { + struct rte_ipv4_hdr v4 = { .version_ihl = IPVERSION << 4 | sizeof(v4) / IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, @@ -1046,7 +1046,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) .src_addr = lsa->src.ip.ip4, .dst_addr = lsa->dst.ip.ip4, }; - struct ipv6_hdr v6 = { + struct rte_ipv6_hdr v6 = { .vtc_flow = htonl(IP6_VERSION << 28), .proto = IPPROTO_ESP, }; diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index cc9a30c4c..259c0d19e 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -296,7 +296,7 @@ static inline void mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) { struct rte_mbuf *mc; - struct ipv4_hdr *iphdr; + struct rte_ipv4_hdr *iphdr; uint32_t dest_addr, port_mask, port_num, use_clone; int32_t hash; uint16_t port; @@ -306,7 +306,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 973a371bf..06f5d1db1 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -388,7 +388,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct l2fwd_crypto_params *cparams) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; @@ -401,7 +401,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ipdata_offset = sizeof(struct rte_ether_hdr); - ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + + ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index ab8ba046b..b0e933e03 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -146,7 +146,7 @@ static struct rte_mempool *pktmbuf_pool[NB_SOCKETS]; /***********************start of ACL part******************************/ #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len); +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len); #endif static inline void send_single_packet(struct rte_mbuf *m, uint16_t port); @@ -174,8 +174,8 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *d = (unsigned char)(ip & 0xff);\ } while (0) #define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) -#define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) -#define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) +#define OFF_IPV42PROTO (offsetof(struct rte_ipv4_hdr, next_proto_id)) +#define OFF_IPV62PROTO (offsetof(struct rte_ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ rte_pktmbuf_mtod_offset((m), uint8_t *, OFF_ETHHEAD + OFF_IPV42PROTO) #define MBUF_IPV6_2PROTO(m) \ @@ -252,32 +252,32 @@ struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_SRC, - .offset = offsetof(struct ipv4_hdr, src_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, src_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_DST, - .offset = offsetof(struct ipv4_hdr, dst_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id) + + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id) + sizeof(uint16_t), }, }; @@ -314,80 +314,80 @@ struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = { .size = sizeof(uint32_t), .field_index = SRC1_FIELD_IPV6, .input_index = SRC1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC2_FIELD_IPV6, .input_index = SRC2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC3_FIELD_IPV6, .input_index = SRC3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC4_FIELD_IPV6, .input_index = SRC4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST1_FIELD_IPV6, .input_index = DST1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) + - offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST2_FIELD_IPV6, .input_index = DST2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST3_FIELD_IPV6, .input_index = DST3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST4_FIELD_IPV6, .input_index = DST4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint16_t), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint16_t), }, }; @@ -542,8 +542,8 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) { uint32_t offset = sig & ~ACL_DENY_SIGNATURE; unsigned char a, b, c, d; - struct ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv4_hdr *, + struct rte_ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); @@ -566,8 +566,8 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) { unsigned i; uint32_t offset = sig & ~ACL_DENY_SIGNATURE; - struct ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv6_hdr *, + struct rte_ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); printf("Packet Src"); @@ -620,11 +620,11 @@ static inline void prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, int index) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = pkts_in[index]; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ @@ -1281,14 +1281,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -1313,7 +1313,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 2725bb40b..91f144605 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -466,14 +466,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -498,7 +498,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -523,7 +523,7 @@ print_ipv6_key(struct ipv6_5tuple key) } static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -538,14 +538,14 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -562,7 +562,7 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, } static inline uint16_t -get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, +get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; @@ -578,14 +578,14 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -604,7 +604,7 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint32_t next_hop; @@ -662,7 +662,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; @@ -671,7 +671,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -706,10 +706,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; ipv6_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d9b636806..ebb2378dd 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -314,14 +314,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -346,7 +346,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -362,7 +362,7 @@ print_key(struct ipv4_5tuple key) } static inline uint16_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -377,14 +377,14 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -402,7 +402,7 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint32_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { uint32_t next_hop; @@ -418,13 +418,13 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 1893f8c3a..293fb1fa2 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -130,14 +130,14 @@ send_single_packet(struct lcore_conf *qconf, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -162,7 +162,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 0c68aa01c..fc7996f88 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,13 +68,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -129,7 +129,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); /* dynamically vec_sel te and ve for MASK_ETH (0x3f) */ diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h index 0f4fcb427..7d83ff641 100644 --- a/examples/l3fwd/l3fwd_common.h +++ b/examples/l3fwd/l3fwd_common.h @@ -14,7 +14,7 @@ #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -28,7 +28,7 @@ * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index b56b08646..fb55e196d 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -252,7 +252,7 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv4_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); /* * Get 5 tuple: dst port, src port, dst IP address, @@ -273,7 +273,7 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv6_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct rte_ipv6_hdr, payload_len); void *data0 = ipv6_hdr; void *data1 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t); void *data2 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t) + sizeof(xmm_t); @@ -566,17 +566,17 @@ em_parse_ptype(struct rte_mbuf *m) uint16_t ether_type; void *l3; int hdr_len; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; 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(RTE_ETHER_TYPE_IPv4)) { - ipv4_hdr = (struct ipv4_hdr *)l3; + ipv4_hdr = (struct rte_ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; - if (hdr_len == sizeof(struct ipv4_hdr)) { + if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; @@ -585,7 +585,7 @@ em_parse_ptype(struct rte_mbuf *m) } else packet_type |= RTE_PTYPE_L3_IPV4_EXT; } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { - ipv6_hdr = (struct ipv6_hdr *)l3; + ipv6_hdr = (struct rte_ipv6_hdr *)l3; if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 4a7336350..62ae1bf30 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -10,7 +10,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -21,7 +21,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -52,9 +52,9 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 5afe77591..4476a91f3 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -80,8 +80,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint16_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -91,7 +91,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -106,7 +106,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 3ee2304b5..3aaf71428 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); } @@ -26,17 +26,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 8)); + offsetof(struct rte_ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 16)); + offsetof(struct rte_ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); key->xmm[1] = tmpdata1; diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 8156bbb90..7964a9277 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); } @@ -26,18 +26,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 6e7096c01..8307c20dd 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -25,8 +25,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint8_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -36,7 +36,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -51,7 +51,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 96143d871..881b0c7c0 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -82,7 +82,7 @@ lpm_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm *)lookup_struct; return (uint16_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -94,7 +94,7 @@ lpm_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm6 *)lookup_struct; return (uint16_t) ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } @@ -102,21 +102,21 @@ static __rte_always_inline uint16_t lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { - struct ipv6_hdr *ipv6_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -135,7 +135,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -146,7 +146,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, ipv6_hdr->dst_addr, &next_hop) == 0) diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 323f853ee..05faa5426 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -10,14 +10,14 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -48,9 +48,9 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index b36e991ac..7c6814252 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -17,30 +17,30 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], vector unsigned int *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index a3e42cfa7..d6c0ba64a 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -18,27 +18,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], int32x4_t *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 4603e0749..3f637a23d 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -15,27 +15,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index af2dc47ac..712c3a704 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -113,7 +113,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); ve = vcopyq_laneq_u32(ve, 3, te, 3); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index 3349f2747..5919f48b9 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -109,7 +109,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); te = _mm_blend_epi16(te, ve, MASK_ETH); diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index c4e6b4ac8..ff76c8d5b 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -495,7 +495,7 @@ app_lcore_worker( for (j = 0; j < bsz_rd; j ++) { struct rte_mbuf *pkt; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst, pos; uint32_t port; @@ -508,7 +508,7 @@ app_lcore_worker( pkt = lp->mbuf_in.array[j]; ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 3d2ceea2f..da5c66203 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -751,14 +751,14 @@ send_packetsx4(uint16_t port, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -783,7 +783,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -802,7 +802,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); __m128i data = _mm_loadu_si128((__m128i *)(ipv4_hdr)); /* Get 5 tuple: dst port, src port, dst IP address, src IP address and protocol */ @@ -819,7 +819,7 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, int ret = 0; union ipv6_5tuple_host key; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct rte_ipv6_hdr, payload_len); __m128i data0 = _mm_loadu_si128((__m128i *)(ipv6_hdr)); __m128i data1 = _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr) + sizeof(__m128i))); @@ -849,7 +849,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -860,7 +860,7 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } #endif @@ -885,7 +885,7 @@ static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { struct rte_ether_hdr *eth_hdr[8]; - struct ipv4_hdr *ipv4_hdr[8]; + struct rte_ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; @@ -901,21 +901,21 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ - ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, + ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, + ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, + ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, + ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, + ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, + ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, + ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, + ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -968,28 +968,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -1095,13 +1095,13 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); key->xmm[1] = tmpdata1; @@ -1116,7 +1116,7 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; - __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; + __attribute__((unused)) struct rte_ipv6_hdr *ipv6_hdr[8]; eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); @@ -1128,21 +1128,21 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ - ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, + ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, + ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, + ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, + ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, + ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, + ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, + ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, + ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); @@ -1229,14 +1229,14 @@ static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -1267,9 +1267,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, @@ -1300,7 +1300,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -1314,7 +1314,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; @@ -1345,7 +1345,7 @@ static __rte_always_inline uint16_t get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -1356,7 +1356,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct, @@ -1372,13 +1372,13 @@ static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; dst_ipv4 = rte_be_to_cpu_32(dst_ipv4); @@ -1402,27 +1402,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1503,13 +1503,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 8bec351ec..44216f999 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -266,7 +266,7 @@ transmit_packet(struct rte_mbuf *buf) static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -274,7 +274,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index a086c5a77..3e5295433 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -247,12 +247,12 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], efd_value_t data[RTE_EFD_BURST_MAX]; const void *key_ptrs[RTE_EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[RTE_EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 48a46d536..8088d9412 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -31,8 +31,8 @@ static void parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint16_t ethertype; info->outer_l2_len = sizeof(struct rte_ether_hdr); @@ -46,15 +46,15 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, switch (ethertype) { case RTE_ETHER_TYPE_IPv4: - ipv4_hdr = (struct ipv4_hdr *) + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv4_hdr); + info->outer_l3_len = sizeof(struct rte_ipv4_hdr); *l4_proto = ipv4_hdr->next_proto_id; break; case RTE_ETHER_TYPE_IPv6: - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv6_hdr); + info->outer_l3_len = sizeof(struct rte_ipv6_hdr); *l4_proto = ipv6_hdr->proto; break; default: @@ -73,8 +73,8 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i void *l3_hdr = NULL; uint8_t l4_proto; uint16_t ethertype; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -92,15 +92,15 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i l3_hdr = (char *)eth_hdr + info->l2_len; if (ethertype == RTE_ETHER_TYPE_IPv4) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_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); + info->l3_len = sizeof(struct rte_ipv4_hdr); l4_proto = ipv4_hdr->next_proto_id; } else if (ethertype == RTE_ETHER_TYPE_IPv6) { - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; + info->l3_len = sizeof(struct rte_ipv6_hdr); l4_proto = ipv6_hdr->proto; ol_flags |= PKT_TX_IPV6; } else @@ -176,10 +176,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); - struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; + struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; @@ -192,7 +192,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - sizeof(struct rte_ether_hdr)); @@ -210,7 +210,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) } m->outer_l2_len = sizeof(struct rte_ether_hdr); - m->outer_l3_len = sizeof(struct ipv4_hdr); + m->outer_l3_len = sizeof(struct rte_ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index 780ae73cc..689aea451 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -16,7 +16,7 @@ #define VXLAN_HF_VNI 0x08000000 #define DEFAULT_VXLAN_PORT 4789 -extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +extern struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 0b6b2d86e..b2c4155ee 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -48,7 +48,7 @@ /* VXLAN device */ struct vxlan_conf vxdev; -struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ @@ -229,7 +229,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) int i, ret; struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; struct rte_eth_tunnel_filter_conf tunnel_filter_conf; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index cbd8e248d..ce14b100a 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -864,7 +864,7 @@ get_psd_sum(void *l3_hdr, uint64_t ol_flags) static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; - struct ipv4_hdr *ipv4_hdr = NULL; + struct rte_ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 56f129bd3..0bf55a62f 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -629,7 +629,7 @@ static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { * Note: IPv4 options are handled by dedicated pattern items. */ struct rte_flow_item_ipv4 { - struct ipv4_hdr hdr; /**< IPv4 header definition. */ + struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ @@ -651,7 +651,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { * RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ struct rte_flow_item_ipv6 { - struct ipv6_hdr hdr; /**< IPv6 header definition. */ + struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index 11d422573..bf9f98959 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -611,8 +611,8 @@ rxa_calc_wrr_sequence(struct rte_event_eth_rx_adapter *rx_adapter, } static inline void -rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, - struct ipv6_hdr **ipv6_hdr) +rxa_mtoip(struct rte_mbuf *m, struct rte_ipv4_hdr **ipv4_hdr, + struct rte_ipv6_hdr **ipv6_hdr) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); struct rte_vlan_hdr *vlan_hdr; @@ -622,21 +622,21 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, switch (eth_hdr->ether_type) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_VLAN): vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(vlan_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(vlan_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(vlan_hdr + 1); break; default: break; @@ -656,8 +656,8 @@ rxa_do_softrss(struct rte_mbuf *m, const uint8_t *rss_key_be) void *tuple; struct rte_ipv4_tuple ipv4_tuple; struct rte_ipv6_tuple ipv6_tuple; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; rxa_mtoip(m, &ipv4_hdr, &ipv6_hdr); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 99c9c7d91..c37b4ef3e 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -180,10 +180,10 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, static inline void update_header(struct gro_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = item->firstseg; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - pkt->l2_len); @@ -195,7 +195,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; @@ -216,7 +216,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, return -1; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index ce3471a4d..0a42a1ae8 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -269,11 +269,11 @@ check_seq_option(struct gro_tcp4_item *item, uint8_t is_atomic) { struct rte_mbuf *pkt_orig = item->firstseg; - struct ipv4_hdr *iph_orig; + struct rte_ipv4_hdr *iph_orig; struct tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + + iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 53425f6d3..a9bdf1d72 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -262,14 +262,14 @@ merge_two_vxlan_tcp4_packets(struct gro_vxlan_tcp4_item *item, static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; /* Update the outer IPv4 header. */ len = pkt->pkt_len - pkt->outer_l2_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->outer_l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); @@ -280,7 +280,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the inner IPv4 header. */ len -= pkt->l2_len; - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); } @@ -290,7 +290,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; - struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; + struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; @@ -314,7 +314,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, return -1; outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + + outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); @@ -322,7 +322,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sizeof(struct udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index b6ff1b886..5f2adc833 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -98,9 +98,9 @@ update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, static inline void update_ipv4_header(struct rte_mbuf *pkt, uint16_t l3_offset, uint16_t id) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l3_offset); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - l3_offset); ipv4_hdr->packet_id = rte_cpu_to_be_16(id); diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index fbd95f8f6..ad0cce6f9 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -9,14 +9,14 @@ static void update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; uint16_t l4_offset = l3_offset + pkt->l3_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -40,13 +40,13 @@ gso_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index d39b46863..f5a19bc43 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -9,7 +9,7 @@ static void update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; @@ -23,12 +23,12 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, tcp_offset = inner_ipv4_offset + pkt->l3_len; /* Outer IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + outer_ipv4_offset); outer_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); /* Inner IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -60,12 +60,12 @@ gso_tunnel_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *inner_ipv4_hdr; + struct rte_ipv4_hdr *inner_ipv4_hdr; uint16_t pyld_unit_size, hdr_offset, frag_off; int ret = 1; hdr_offset = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len; - inner_ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + inner_ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + hdr_offset); /* * Don't process the packet whose MF bit or offset in the inner diff --git a/lib/librte_gso/gso_udp4.c b/lib/librte_gso/gso_udp4.c index 927dee121..93e6f8e0d 100644 --- a/lib/librte_gso/gso_udp4.c +++ b/lib/librte_gso/gso_udp4.c @@ -11,7 +11,7 @@ static inline void update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t frag_offset = 0, is_mf; uint16_t l2_hdrlen = pkt->l2_len, l3_hdrlen = pkt->l3_len; uint16_t tail_idx = nb_segs - 1, length, i; @@ -22,7 +22,7 @@ update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, * length. */ for (i = 0; i < nb_segs; i++) { - ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct rte_ipv4_hdr *, l2_hdrlen); length = segs[i]->pkt_len - l2_hdrlen; ipv4_hdr->total_length = rte_cpu_to_be_16(length); @@ -42,13 +42,13 @@ gso_udp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 433f2c8bb..ee879968c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,11 +19,11 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h index 1b33f4813..b27bf24d3 100644 --- a/lib/librte_hash/rte_thash.h +++ b/lib/librte_hash/rte_thash.h @@ -139,7 +139,7 @@ rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len) * Pointer to rte_ipv6_tuple structure */ static inline void -rte_thash_load_v6_addrs(const struct ipv6_hdr *orig, union rte_thash_tuple *targ) +rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig, union rte_thash_tuple *targ) { #ifdef RTE_ARCH_X86 __m128i ipv6 = _mm_loadu_si128((const __m128i *)orig->src_addr); diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 04fd9df52..60c0300e8 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -219,7 +219,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr); /** @@ -234,7 +234,7 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * present. */ static inline struct ipv6_extension_fragment * -rte_ipv6_frag_get_ipv6_fragment_header(struct ipv6_hdr *hdr) +rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr) { if (hdr->proto == IPPROTO_FRAGMENT) { return (struct ipv6_extension_fragment *) ++hdr; @@ -293,7 +293,7 @@ int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr); + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr); /** * Check if the IPv4 packet is fragmented @@ -304,7 +304,7 @@ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * 1 if fragmented, 0 if not fragmented */ static inline int -rte_ipv4_frag_pkt_is_fragmented(const struct ipv4_hdr * hdr) { +rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index a96fb03e4..2c781724a 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -21,8 +21,8 @@ #define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) -static inline void __fill_ipv4hdr_frag(struct ipv4_hdr *dst, - const struct ipv4_hdr *src, uint16_t len, uint16_t fofs, +static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, + const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); @@ -70,7 +70,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv4_hdr *in_hdr; + struct rte_ipv4_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, flag_offset, frag_size; @@ -80,10 +80,10 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, * Ensure the IP payload length of all fragments is aligned to a * multiple of 8 bytes as per RFC791 section 2.3. */ - frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct ipv4_hdr)), + frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct rte_ipv4_hdr)), IPV4_HDR_FO_ALIGN); - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv4_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv4_hdr *); flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset); /* If Don't Fragment flag is set */ @@ -92,11 +92,11 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Check that pkts_out is big enough to hold all fragments */ if (unlikely(frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv4_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof (struct rte_ipv4_hdr)))) return -EINVAL; in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv4_hdr); + in_seg_data_pos = sizeof(struct rte_ipv4_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -104,7 +104,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv4_hdr *out_hdr; + struct rte_ipv4_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -114,8 +114,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv4_hdr); - out_pkt->pkt_len = sizeof(struct ipv4_hdr); + out_pkt->data_len = sizeof(struct rte_ipv4_hdr); + out_pkt->pkt_len = sizeof(struct rte_ipv4_hdr); frag_bytes_remaining = frag_size; out_seg_prev = out_pkt; @@ -164,17 +164,17 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv4_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv4_hdr *); __fill_ipv4hdr_frag(out_hdr, in_hdr, (uint16_t)out_pkt->pkt_len, flag_offset, fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv4_hdr)); + out_pkt->pkt_len - sizeof(struct rte_ipv4_hdr)); out_pkt->ol_flags |= PKT_TX_IP_CKSUM; - out_pkt->l3_len = sizeof(struct ipv4_hdr); + out_pkt->l3_len = sizeof(struct rte_ipv4_hdr); /* Write the fragment to the output list */ pkts_out[out_pkt_pos] = out_pkt; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 1029b7abc..97da607ed 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -14,7 +14,7 @@ struct rte_mbuf * ipv4_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; uint32_t curr_idx = 0; @@ -70,7 +70,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv4 header for the reassembled packet */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); @@ -100,7 +100,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv4_hdr *ip_hdr) + struct rte_ipv4_hdr *ip_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c index b9437eb11..875f86faa 100644 --- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c @@ -18,8 +18,8 @@ */ static inline void -__fill_ipv6hdr_frag(struct ipv6_hdr *dst, - const struct ipv6_hdr *src, uint16_t len, uint16_t fofs, +__fill_ipv6hdr_frag(struct rte_ipv6_hdr *dst, + const struct rte_ipv6_hdr *src, uint16_t len, uint16_t fofs, uint32_t mf) { struct ipv6_extension_fragment *fh; @@ -73,7 +73,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv6_hdr *in_hdr; + struct rte_ipv6_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, frag_size; @@ -83,18 +83,18 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, * Ensure the IP payload length of all fragments (except the * the last fragment) are a multiple of 8 bytes per RFC2460. */ - frag_size = RTE_ALIGN_FLOOR(mtu_size - sizeof(struct ipv6_hdr), + frag_size = RTE_ALIGN_FLOOR(mtu_size - sizeof(struct rte_ipv6_hdr), RTE_IPV6_EHDR_FO_ALIGN); /* Check that pkts_out is big enough to hold all fragments */ if (unlikely (frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof (struct rte_ipv6_hdr)))) return -EINVAL; - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv6_hdr *); in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv6_hdr); + in_seg_data_pos = sizeof(struct rte_ipv6_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -102,7 +102,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv6_hdr *out_hdr; + struct rte_ipv6_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -112,8 +112,8 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); - out_pkt->pkt_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->data_len = sizeof(struct rte_ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->pkt_len = sizeof(struct rte_ipv6_hdr) + sizeof(struct ipv6_extension_fragment); frag_bytes_remaining = frag_size; out_seg_prev = out_pkt; @@ -163,14 +163,14 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv6_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv6_hdr *); __fill_ipv6hdr_frag(out_hdr, in_hdr, - (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr), + (uint16_t) out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr), fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv6_hdr) + out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr) - sizeof(struct ipv6_extension_fragment)); /* Write the fragment to the output list */ diff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c index 855e3f740..169b01a5d 100644 --- a/lib/librte_ip_frag/rte_ipv6_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c @@ -32,7 +32,7 @@ ip_frag_memmove(char *dst, char *src, int len) struct rte_mbuf * ipv6_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; struct ipv6_extension_fragment *frag_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; @@ -93,7 +93,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv6 header for the reassembled datagram */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, m->l2_len); ip_hdr->payload_len = rte_cpu_to_be_16(payload_len); @@ -139,7 +139,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) + struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_ipsec/iph.h b/lib/librte_ipsec/iph.h index 58930cf18..a0ca41d51 100644 --- a/lib/librte_ipsec/iph.h +++ b/lib/librte_ipsec/iph.h @@ -40,8 +40,8 @@ static inline int update_trs_l3hdr(const struct rte_ipsec_sa *sa, void *p, uint32_t plen, uint32_t l2len, uint32_t l3len, uint8_t proto) { - struct ipv4_hdr *v4h; - struct ipv6_hdr *v6h; + struct rte_ipv4_hdr *v4h; + struct rte_ipv6_hdr *v6h; int32_t rc; if ((sa->type & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4) { @@ -67,8 +67,8 @@ static inline void update_tun_l3hdr(const struct rte_ipsec_sa *sa, void *p, uint32_t plen, uint32_t l2len, rte_be16_t pid) { - struct ipv4_hdr *v4h; - struct ipv6_hdr *v6h; + struct rte_ipv4_hdr *v4h; + struct rte_ipv6_hdr *v6h; if (sa->type & RTE_IPSEC_SATP_MODE_TUNLV4) { v4h = p; diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index f9b909090..a1431ee90 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -28,7 +28,7 @@ extern "C" { /** * IPv4 Header */ -struct ipv4_hdr { +struct rte_ipv4_hdr { uint8_t version_ihl; /**< version and header length */ uint8_t type_of_service; /**< type of service */ uint16_t total_length; /**< length of packet */ @@ -249,10 +249,10 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len, * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) +rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr) { uint16_t cksum; - cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr)); + cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr)); return (cksum == 0xffff) ? cksum : (uint16_t)~cksum; } @@ -275,7 +275,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) +rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags) { struct ipv4_psd_header { uint32_t src_addr; /* IP address of source host. */ @@ -294,7 +294,7 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) } else { psd_hdr.len = rte_cpu_to_be_16( (uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr))); + - sizeof(struct rte_ipv4_hdr))); } return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr)); } @@ -314,16 +314,16 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) * or 0 on error */ static inline uint16_t -rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) +rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l3_len, l4_len; l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length); - if (l3_len < sizeof(struct ipv4_hdr)) + if (l3_len < sizeof(struct rte_ipv4_hdr)) return 0; - l4_len = l3_len - sizeof(struct ipv4_hdr); + l4_len = l3_len - sizeof(struct rte_ipv4_hdr); cksum = rte_raw_cksum(l4_hdr, l4_len); cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0); @@ -339,7 +339,7 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) /** * IPv6 Header */ -struct ipv6_hdr { +struct rte_ipv6_hdr { uint32_t vtc_flow; /**< IP version, traffic class & flow label. */ uint16_t payload_len; /**< IP packet length - includes sizeof(ip_header). */ uint8_t proto; /**< Protocol, next header. */ @@ -371,7 +371,7 @@ struct ipv6_hdr { * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) +rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags) { uint32_t sum; struct { @@ -407,7 +407,7 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr) +rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l4_len; diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index d858ab155..b01cacb9c 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -173,7 +173,7 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, /* get the ipv4 header length */ static uint8_t -ip4_hlen(const struct ipv4_hdr *hdr) +ip4_hlen(const struct rte_ipv4_hdr *hdr) { return (hdr->version_ihl & 0xf) * 4; } @@ -300,8 +300,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -323,8 +323,8 @@ 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(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); @@ -432,8 +432,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -455,8 +455,8 @@ 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(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 16970711b..5c9a37a94 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -112,8 +112,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, static inline int rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -144,7 +144,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) #endif if (ol_flags & PKT_TX_IPV4) { - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, inner_l3_offset); if (ol_flags & PKT_TX_IP_CKSUM) @@ -158,7 +158,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, @@ -175,7 +175,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 224045e8a..682df6cc4 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -491,7 +491,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -499,14 +499,14 @@ struct encap_vxlan_ipv4_data { struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -514,7 +514,7 @@ struct encap_vxlan_ipv6_data { struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -999,7 +999,7 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -1029,7 +1029,7 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -1334,7 +1334,7 @@ nat_ipv6_tcp_udp_checksum_update(uint16_t cksum0, } static __rte_always_inline void -pkt_ipv4_work_nat(struct ipv4_hdr *ip, +pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, struct nat_ipv4_data *data, struct rte_table_action_nat_config *cfg) { @@ -1420,7 +1420,7 @@ pkt_ipv4_work_nat(struct ipv4_hdr *ip, } static __rte_always_inline void -pkt_ipv6_work_nat(struct ipv6_hdr *ip, +pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, struct nat_ipv6_data *data, struct rte_table_action_nat_config *cfg) { @@ -1528,7 +1528,7 @@ ttl_apply(void *data, } static __rte_always_inline uint64_t -pkt_ipv4_work_ttl(struct ipv4_hdr *ip, +pkt_ipv4_work_ttl(struct rte_ipv4_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -1549,7 +1549,7 @@ pkt_ipv4_work_ttl(struct ipv4_hdr *ip, } static __rte_always_inline uint64_t -pkt_ipv6_work_ttl(struct ipv6_hdr *ip, +pkt_ipv6_work_ttl(struct rte_ipv6_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -2885,16 +2885,16 @@ pkt_work(struct rte_mbuf *mbuf, uint16_t total_length; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr = ip; + struct rte_ipv4_hdr *hdr = ip; dscp = hdr->type_of_service >> 2; total_length = rte_ntohs(hdr->total_length); } else { - struct ipv6_hdr *hdr = ip; + struct rte_ipv6_hdr *hdr = ip; dscp = (rte_ntohl(hdr->vtc_flow) & 0x0F600000) >> 18; total_length = - rte_ntohs(hdr->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr->payload_len) + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { @@ -3033,10 +3033,10 @@ pkt4_work(struct rte_mbuf **mbufs, uint16_t total_length0, total_length1, total_length2, total_length3; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr0 = ip0; - struct ipv4_hdr *hdr1 = ip1; - struct ipv4_hdr *hdr2 = ip2; - struct ipv4_hdr *hdr3 = ip3; + struct rte_ipv4_hdr *hdr0 = ip0; + struct rte_ipv4_hdr *hdr1 = ip1; + struct rte_ipv4_hdr *hdr2 = ip2; + struct rte_ipv4_hdr *hdr3 = ip3; dscp0 = hdr0->type_of_service >> 2; dscp1 = hdr1->type_of_service >> 2; @@ -3048,10 +3048,10 @@ pkt4_work(struct rte_mbuf **mbufs, total_length2 = rte_ntohs(hdr2->total_length); total_length3 = rte_ntohs(hdr3->total_length); } else { - struct ipv6_hdr *hdr0 = ip0; - struct ipv6_hdr *hdr1 = ip1; - struct ipv6_hdr *hdr2 = ip2; - struct ipv6_hdr *hdr3 = ip3; + struct rte_ipv6_hdr *hdr0 = ip0; + struct rte_ipv6_hdr *hdr1 = ip1; + struct rte_ipv6_hdr *hdr2 = ip2; + struct rte_ipv6_hdr *hdr3 = ip3; dscp0 = (rte_ntohl(hdr0->vtc_flow) & 0x0F600000) >> 18; dscp1 = (rte_ntohl(hdr1->vtc_flow) & 0x0F600000) >> 18; @@ -3059,13 +3059,13 @@ pkt4_work(struct rte_mbuf **mbufs, dscp3 = (rte_ntohl(hdr3->vtc_flow) & 0x0F600000) >> 18; total_length0 = - rte_ntohs(hdr0->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr0->payload_len) + sizeof(struct rte_ipv6_hdr); total_length1 = - rte_ntohs(hdr1->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr1->payload_len) + sizeof(struct rte_ipv6_hdr); total_length2 = - rte_ntohs(hdr2->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr2->payload_len) + sizeof(struct rte_ipv6_hdr); total_length3 = - rte_ntohs(hdr3->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr3->payload_len) + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index c8b2e19bf..2e807e805 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -151,7 +151,7 @@ static void process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv4_hdr *); + struct rte_ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct rte_ipv4_hdr *); /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); @@ -182,7 +182,7 @@ static void process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv6_hdr *); + struct rte_ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct rte_ipv6_hdr *); struct ipv6_extension_fragment *frag_hdr; uint16_t frag_data = 0; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index e8f3edc07..2960a5c8a 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -238,9 +238,9 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) /* IP cksum verification cannot be bypassed, then calculate here */ if (m_buf->ol_flags & PKT_TX_IP_CKSUM) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct rte_ipv4_hdr *, m_buf->l2_len); ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } @@ -966,8 +966,8 @@ virtio_net_with_host_offload(struct virtio_net *dev) static void parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; struct rte_ether_hdr *eth_hdr; uint16_t ethertype; @@ -997,7 +997,7 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) case RTE_ETHER_TYPE_IPv6: ipv6_hdr = l3_hdr; *l4_proto = ipv6_hdr->proto; - m->l3_len = sizeof(struct ipv6_hdr); + m->l3_len = sizeof(struct rte_ipv6_hdr); *l4_hdr = (char *)l3_hdr + m->l3_len; m->ol_flags |= PKT_TX_IPV6; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 10/14] net: add rte prefix to ip structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 10/14] net: add rte prefix to ip structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct ipv4_hdr as struct rte_ipv4_hdr. - rename struct ipv6_hdr as struct rte_ipv6_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pipeline/pipeline_acl.c | 10 +- app/test-pipeline/pipeline_hash.c | 8 +- app/test-pmd/csumonly.c | 40 ++++---- app/test-pmd/flowgen.c | 6 +- app/test-pmd/icmpecho.c | 8 +- app/test-pmd/macfwd.c | 2 +- app/test-pmd/macswap_common.h | 2 +- app/test-pmd/txonly.c | 16 +-- app/test-pmd/util.c | 12 +-- app/test/packet_burst_generator.c | 44 ++++----- app/test/packet_burst_generator.h | 6 +- app/test/test_flow_classify.c | 16 +-- app/test/test_ipsec.c | 4 +- app/test/test_link_bonding.c | 8 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_pmd_perf.c | 2 +- app/test/test_sched.c | 4 +- app/test/test_thash.c | 2 +- .../prog_guide/packet_classif_access_ctrl.rst | 12 +-- doc/guides/sample_app_ug/flow_classify.rst | 10 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- doc/guides/sample_app_ug/l3_forward.rst | 12 +-- doc/guides/sample_app_ug/server_node_efd.rst | 8 +- drivers/net/bonding/rte_eth_bond_pmd.c | 16 +-- drivers/net/dpaa/dpaa_rxtx.c | 8 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/ena/ena_ethdev.c | 4 +- drivers/net/enic/enic_clsf.c | 16 +-- drivers/net/enic/enic_flow.c | 30 +++--- drivers/net/i40e/i40e_fdir.c | 36 +++---- drivers/net/mlx5/mlx5_flow.c | 6 +- drivers/net/mlx5/mlx5_flow_dv.c | 8 +- drivers/net/mlx5/mlx5_flow_tcf.c | 12 +-- drivers/net/mvpp2/mrvl_flow.c | 2 +- drivers/net/qede/qede_filter.c | 14 +-- drivers/net/qede/qede_rxtx.c | 12 +-- drivers/net/sfc/sfc_tso.h | 4 +- drivers/net/softnic/rte_eth_softnic_pipeline.c | 32 +++--- drivers/net/tap/rte_eth_tap.c | 10 +- drivers/net/virtio/virtio_rxtx.c | 8 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 18 ++-- examples/bond/main.c | 4 +- examples/flow_classify/flow_classify.c | 10 +- examples/ip_fragmentation/main.c | 12 +-- examples/ip_pipeline/pipeline.c | 32 +++--- examples/ip_reassembly/main.c | 12 +-- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/ipsec-secgw/sa.c | 6 +- examples/ipv4_multicast/main.c | 4 +- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 80 +++++++-------- examples/l3fwd-power/main.c | 28 +++--- examples/l3fwd-vf/main.c | 18 ++-- examples/l3fwd/l3fwd.h | 6 +- examples/l3fwd/l3fwd_altivec.h | 10 +- examples/l3fwd/l3fwd_common.h | 4 +- examples/l3fwd/l3fwd_em.c | 14 +-- examples/l3fwd/l3fwd_em.h | 8 +- examples/l3fwd/l3fwd_em_hlm.h | 8 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 8 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 8 +- examples/l3fwd/l3fwd_em_sequential.h | 8 +- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/l3fwd/l3fwd_lpm.h | 8 +- examples/l3fwd/l3fwd_lpm_altivec.h | 10 +- examples/l3fwd/l3fwd_lpm_neon.h | 10 +- examples/l3fwd/l3fwd_lpm_sse.h | 10 +- examples/l3fwd/l3fwd_neon.h | 10 +- examples/l3fwd/l3fwd_sse.h | 10 +- examples/load_balancer/runtime.c | 4 +- examples/performance-thread/l3fwd-thread/main.c | 110 ++++++++++----------- examples/server_node_efd/node/node.c | 4 +- examples/server_node_efd/server/main.c | 4 +- examples/tep_termination/vxlan.c | 32 +++--- examples/tep_termination/vxlan.h | 2 +- examples/tep_termination/vxlan_setup.c | 4 +- examples/vhost/main.c | 2 +- lib/librte_ethdev/rte_flow.h | 4 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 16 +-- lib/librte_gro/gro_tcp4.c | 8 +- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 12 +-- lib/librte_gso/gso_common.h | 4 +- lib/librte_gso/gso_tcp4.c | 8 +- lib/librte_gso/gso_tunnel_tcp4.c | 10 +- lib/librte_gso/gso_udp4.c | 8 +- lib/librte_gso/rte_gso.h | 4 +- lib/librte_hash/rte_thash.h | 2 +- lib/librte_ip_frag/rte_ip_frag.h | 8 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 26 ++--- lib/librte_ip_frag/rte_ipv4_reassembly.c | 6 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 26 ++--- lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- lib/librte_ipsec/iph.h | 8 +- lib/librte_net/rte_ip.h | 22 ++--- lib/librte_net/rte_net.c | 18 ++-- lib/librte_net/rte_net.h | 10 +- lib/librte_pipeline/rte_table_action.c | 50 +++++----- lib/librte_port/rte_port_ras.c | 4 +- lib/librte_vhost/virtio_net.c | 10 +- 100 files changed, 636 insertions(+), 636 deletions(-) diff --git a/app/test-pipeline/pipeline_acl.c b/app/test-pipeline/pipeline_acl.c index 8853d4376..ad939008a 100644 --- a/app/test-pipeline/pipeline_acl.c +++ b/app/test-pipeline/pipeline_acl.c @@ -40,7 +40,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -48,7 +48,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -56,21 +56,21 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr), + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index 3e4a0a1bb..25fb2e0da 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -426,8 +426,8 @@ app_main_loop_rx_metadata(void) { for (j = 0; j < n_mbufs; j++) { struct rte_mbuf *m; uint8_t *m_data, *key; - struct ipv4_hdr *ip_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ip_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t ip_dst; uint8_t *ipv6_dst; uint32_t *signature, *k32; @@ -440,14 +440,14 @@ app_main_loop_rx_metadata(void) { APP_METADATA_OFFSET(32)); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip_hdr = (struct ipv4_hdr *) + ip_hdr = (struct rte_ipv4_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 7080ff5d9..eff2b4f7c 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -100,7 +100,7 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) /* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) +parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; @@ -119,11 +119,11 @@ parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) /* Parse an IPv6 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) +parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ @@ -144,8 +144,8 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) static void parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; @@ -159,11 +159,11 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) switch (info->ethertype) { case _htons(RTE_ETHER_TYPE_IPv4): - ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv4(ipv4_hdr, info); break; case _htons(RTE_ETHER_TYPE_IPv6): - ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len); + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->l2_len); parse_ipv6(ipv6_hdr, info); break; default: @@ -209,8 +209,8 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); @@ -229,7 +229,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)vxlan_gpe_hdr + + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ipv4(ipv4_hdr, info); @@ -243,7 +243,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)vxlan_gpe_hdr + + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); @@ -272,8 +272,8 @@ static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; gre_len += sizeof(struct simple_gre_hdr); @@ -292,7 +292,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)gre_hdr + gre_len); parse_ipv4(ipv4_hdr, info); info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); @@ -305,7 +305,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len); + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)gre_hdr + gre_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); @@ -332,8 +332,8 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) static void parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr = encap_ip; - struct ipv6_hdr *ipv6_hdr = encap_ip; + struct rte_ipv4_hdr *ipv4_hdr = encap_ip; + struct rte_ipv6_hdr *ipv6_hdr = encap_ip; uint8_t ip_version; ip_version = (ipv4_hdr->version_ihl & 0xf0) >> 4; @@ -362,7 +362,7 @@ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { - struct ipv4_hdr *ipv4_hdr = l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -453,8 +453,8 @@ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, uint64_t tx_offloads, int tso_enabled) { - struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; - struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; struct udp_hdr *udp_hdr; uint64_t ol_flags = 0; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 00acbaf70..45a5e13e0 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -120,7 +120,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mempool *mbp; struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags = 0; @@ -176,7 +176,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); /* Initialize IP header. */ - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); memset(ip_hdr, 0, sizeof(*ip_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -206,7 +206,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkts_burst[nb_pkt] = pkt; next_flow = (next_flow + 1) % cfg_n_flows; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 4bf3fed64..146293175 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -243,7 +243,7 @@ ipv4_addr_dump(const char *what, uint32_t be_ipv4_addr) } static uint16_t -ipv4_hdr_cksum(struct ipv4_hdr *ip_h) +ipv4_hdr_cksum(struct rte_ipv4_hdr *ip_h) { uint16_t *v16_h; uint32_t ip_cksum; @@ -278,7 +278,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_ether_hdr *eth_h; struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; - struct ipv4_hdr *ip_h; + struct rte_ipv4_hdr *ip_h; struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; @@ -413,7 +413,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_pktmbuf_free(pkt); continue; } - ip_h = (struct ipv4_hdr *) ((char *)eth_h + l2_len); + ip_h = (struct rte_ipv4_hdr *) ((char *)eth_h + l2_len); if (verbose_level > 0) { ipv4_addr_dump(" IPV4: src=", ip_h->src_addr); ipv4_addr_dump(" dst=", ip_h->dst_addr); @@ -426,7 +426,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * Check if packet is a ICMP echo request. */ icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f15149252..d2ebb1105 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -99,7 +99,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; } diff --git a/app/test-pmd/macswap_common.h b/app/test-pmd/macswap_common.h index 56f86baad..7e9a3590a 100644 --- a/app/test-pmd/macswap_common.h +++ b/app/test-pmd/macswap_common.h @@ -40,7 +40,7 @@ mbuf_field_set(struct rte_mbuf *mb, uint64_t ol_flags) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); } #endif /* _MACSWAP_COMMON_H_ */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index d5a46e8fc..f7f023ff6 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -51,7 +51,7 @@ #define IP_HDRLEN 0x05 /* default IP header length == five 32-bits words. */ #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) -static struct ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ +static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ @@ -93,7 +93,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } static void -setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, +setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, struct udp_hdr *udp_hdr, uint16_t pkt_data_len) { @@ -113,7 +113,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; ip_hdr->fragment_offset = 0; @@ -175,7 +175,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkt_len = pkt->data_len; pkt_seg = pkt; @@ -193,11 +193,11 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, sizeof(struct rte_ether_hdr)); if (txonly_multi_flow) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t addr; ip_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* * Generate multiple flows by varying IP src addr. This @@ -211,7 +211,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, } copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); /* * Complete first mbuf of packet and append it to the * burst of packets to be transmitted. @@ -346,7 +346,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) uint16_t pkt_data_len; pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 105c56090..b8e5548ca 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -103,8 +103,8 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (sw_packet_type & RTE_PTYPE_INNER_L4_MASK) printf(" - inner_l4_len=%d", hdr_lens.inner_l4_len); if (is_encapsulation) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; @@ -116,15 +116,15 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { - l3_len = sizeof(struct ipv4_hdr); + l3_len = sizeof(struct rte_ipv4_hdr); ipv4_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, l2_len); l4_proto = ipv4_hdr->next_proto_id; } else { - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); ipv6_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv6_hdr *, + struct rte_ipv6_hdr *, l2_len); l4_proto = ipv6_hdr->proto; } diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index feee9e121..886b5f8ac 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -137,7 +137,7 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, } uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len) { ip_hdr->vtc_flow = 0; @@ -148,11 +148,11 @@ initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, rte_memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); rte_memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); - return (uint16_t) (pkt_data_len + sizeof(struct ipv6_hdr)); + return (uint16_t) (pkt_data_len + sizeof(struct rte_ipv6_hdr)); } uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -162,7 +162,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -200,7 +200,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, } uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto) { uint16_t pkt_len; @@ -210,7 +210,7 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -300,13 +300,13 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), pkt, eth_hdr_size); copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), pkt, eth_hdr_size); copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); } /* @@ -319,10 +319,10 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; @@ -379,45 +379,45 @@ generate_packet_burst_proto(struct rte_mempool *mp, copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; default: break; } } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; default: break; @@ -434,10 +434,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 8489212d0..93efee1f5 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -46,15 +46,15 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto); int diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 3f06f3005..96e371691 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -40,7 +40,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -50,7 +50,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -60,7 +60,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -73,7 +73,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -83,7 +83,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -490,7 +490,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); @@ -527,7 +527,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); @@ -564,7 +564,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 7ad285a92..2cad4096c 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -534,7 +534,7 @@ const char null_encrypted_data[] = "Network Security People Have A Strange Sense Of Humor unlike Other " "People who have a normal sense of humour"; -struct ipv4_hdr ipv4_outer = { +struct rte_ipv4_hdr ipv4_outer = { .version_ihl = IPVERSION << 4 | sizeof(ipv4_outer) / IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, @@ -572,7 +572,7 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, size_t len, uint32_t spi, uint32_t seq) { struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct rte_esp_hdr); + uint32_t hdrlen = sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_esp_hdr); uint32_t taillen = sizeof(struct esp_tail); uint32_t t_len = len + hdrlen + taillen; uint32_t padlen; diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 2490d5dd2..924de81ae 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -78,14 +78,14 @@ struct link_bonding_unittest_params { /* Packet Headers */ struct rte_ether_hdr *pkt_eth_hdr; - struct ipv4_hdr *pkt_ipv4_hdr; - struct ipv6_hdr *pkt_ipv6_hdr; + struct rte_ipv4_hdr *pkt_ipv4_hdr; + struct rte_ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; }; -static struct ipv4_hdr pkt_ipv4_hdr; -static struct ipv6_hdr pkt_ipv6_hdr; +static struct rte_ipv4_hdr pkt_ipv4_hdr; +static struct rte_ipv6_hdr pkt_ipv6_hdr; static struct udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 6295b1874..fba629d43 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -734,8 +734,8 @@ generate_packets(struct rte_ether_addr *src_mac, struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { - struct ipv4_hdr v4; - struct ipv6_hdr v6; + struct rte_ipv4_hdr v4; + struct rte_ipv6_hdr v6; } pkt_ip_hdr; int retval; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 4b973ffc4..0d1c1b1ab 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -183,7 +183,7 @@ init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 58f42a2d8..4781c2307 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -80,14 +80,14 @@ prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr; struct rte_vlan_hdr *vlan1, *vlan2; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; /* Simulate a classifier */ eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); vlan1 = (struct rte_vlan_hdr *)(ð_hdr->ether_type ); vlan2 = (struct rte_vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct rte_vlan_hdr)); eth_hdr = (struct rte_ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct rte_vlan_hdr)); - ip_hdr = (struct ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); + ip_hdr = (struct rte_ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); vlan2->vlan_tci = rte_cpu_to_be_16(PIPE); diff --git a/app/test/test_thash.c b/app/test/test_thash.c index 61754a947..bf332c9e9 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -110,7 +110,7 @@ test_thash(void) union rte_thash_tuple tuple; uint32_t rss_l3, rss_l3l4; uint8_t rss_key_be[RTE_DIM(default_rss_key)]; - struct ipv6_hdr ipv6_hdr; + struct rte_ipv6_hdr ipv6_hdr; /* Convert RSS key*/ rte_convert_rss_key((uint32_t *)&default_rss_key, diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 395b3ec47..6887e4dc6 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -154,7 +154,7 @@ To define classification for the IPv6 2-tuple: <protocol, IPv6 source address> o .. code-block:: c - struct struct ipv6_hdr { + struct struct rte_ipv6_hdr { uint32_t vtc_flow; /* IP version, traffic class & flow label. */ uint16_t payload_len; /* IP packet length - includes sizeof(ip_header). */ uint8_t proto; /* Protocol, next header. */ @@ -173,7 +173,7 @@ The following array of field definitions can be used: .size = sizeof (uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof (struct ipv6_hdr, proto), + .offset = offsetof (struct rte_ipv6_hdr, proto), }, { @@ -181,7 +181,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof (struct ipv6_hdr, src_addr[0]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[0]), }, { @@ -189,7 +189,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof (struct ipv6_hdr, src_addr[4]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[4]), }, { @@ -197,7 +197,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof (struct ipv6_hdr, src_addr[8]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[8]), }, { @@ -205,7 +205,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof (struct ipv6_hdr, src_addr[12]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[12]), }, }; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 762c3844e..46703acbf 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -92,7 +92,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -102,7 +102,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -112,7 +112,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -125,7 +125,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -135,7 +135,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index a4cb4377f..46c920433 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index 58c4aae92..bf6c5ea52 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -242,7 +242,7 @@ The get_ipv4_dst_port() function is shown below: int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); m128i data = _mm_loadu_si128(( m128i*)(ipv4_hdr)); @@ -270,10 +270,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -306,7 +306,7 @@ for LPM-based lookups is done by the get_ipv4_dst_port() function below: .. code-block:: c static inline uint16_t - get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) + get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint8_t next_hop; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index f7dab9e98..12208f425 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -191,12 +191,12 @@ which tells the node where the packet has to be distributed. efd_value_t data[EFD_BURST_MAX]; const void *key_ptrs[EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; @@ -348,7 +348,7 @@ flow is not handled by the node. static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -356,7 +356,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 58c23a970..c7fcd9b8e 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -587,7 +587,7 @@ static void mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_h, uint16_t port, uint32_t __attribute__((unused)) *burstnumber) { - struct ipv4_hdr *ipv4_h; + struct rte_ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB struct rte_arp_hdr *arp_h; char dst_ip[16]; @@ -604,7 +604,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_ #endif if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset); + ipv4_h = (struct rte_ipv4_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String); #ifdef RTE_LIBRTE_BOND_DEBUG_ALB ipv4_addr_to_dot(ipv4_h->dst_addr, dst_ip, MaxIPv4String); @@ -751,13 +751,13 @@ ether_hash(struct rte_ether_hdr *eth_hdr) } static inline uint32_t -ipv4_hash(struct ipv4_hdr *ipv4_hdr) +ipv4_hash(struct rte_ipv4_hdr *ipv4_hdr) { return ipv4_hdr->src_addr ^ ipv4_hdr->dst_addr; } static inline uint32_t -ipv6_hash(struct ipv6_hdr *ipv6_hdr) +ipv6_hash(struct rte_ipv6_hdr *ipv6_hdr) { unaligned_uint32_t *word_src_addr = (unaligned_uint32_t *)&(ipv6_hdr->src_addr[0]); @@ -808,12 +808,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(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv4_hash(ipv4_hdr); } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); } @@ -847,7 +847,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = 0; if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); size_t ip_hdr_offset; @@ -874,7 +874,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, } } } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index ff061df25..63243a79a 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -200,22 +200,22 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; DPAA_DP_LOG(DEBUG, "Calculating checksum for mbuf: %p", mbuf); if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4_EXT)) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; ipv4_hdr->hdr_checksum = 0; ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } else if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6_EXT)) - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index e09cc8d49..f59215894 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -222,7 +222,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, /* setup IPCS* fields */ ctx.lower_setup.ip_fields.ipcss = (uint8_t)l2len; ctx.lower_setup.ip_fields.ipcso = (uint8_t)(l2len + - offsetof(struct ipv4_hdr, hdr_checksum)); + offsetof(struct rte_ipv4_hdr, hdr_checksum)); /* * When doing checksum or TCP segmentation with IPv6 headers, diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 62986b6d6..469d7aaf6 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2136,7 +2136,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint32_t i; struct rte_mbuf *m; struct ena_ring *tx_ring = (struct ena_ring *)(tx_queue); - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint64_t ol_flags; uint16_t frag_field; @@ -2153,7 +2153,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (unlikely(m->l2_len == 0)) m->l2_len = sizeof(struct rte_ether_hdr); - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 48c8e6264..6bdc5a09a 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -183,9 +183,9 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) { - struct ipv4_hdr ip4_mask, ip4_val; - memset(&ip4_mask, 0, sizeof(struct ipv4_hdr)); - memset(&ip4_val, 0, sizeof(struct ipv4_hdr)); + struct rte_ipv4_hdr ip4_mask, ip4_val; + memset(&ip4_mask, 0, sizeof(struct rte_ipv4_hdr)); + memset(&ip4_val, 0, sizeof(struct rte_ipv4_hdr)); if (input->flow.ip4_flow.tos) { ip4_mask.type_of_service = masks->ipv4_mask.tos; @@ -213,7 +213,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV4, FILTER_GENERIC_1_L3, - &ip4_mask, &ip4_val, sizeof(struct ipv4_hdr)); + &ip4_mask, &ip4_val, sizeof(struct rte_ipv4_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { @@ -272,9 +272,9 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) { - struct ipv6_hdr ipv6_mask, ipv6_val; - memset(&ipv6_mask, 0, sizeof(struct ipv6_hdr)); - memset(&ipv6_val, 0, sizeof(struct ipv6_hdr)); + struct rte_ipv6_hdr ipv6_mask, ipv6_val; + memset(&ipv6_mask, 0, sizeof(struct rte_ipv6_hdr)); + memset(&ipv6_val, 0, sizeof(struct rte_ipv6_hdr)); if (input->flow.ipv6_flow.proto) { ipv6_mask.proto = masks->ipv6_mask.proto; @@ -302,7 +302,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV6, FILTER_GENERIC_1_L3, - &ipv6_mask, &ipv6_val, sizeof(struct ipv6_hdr)); + &ipv6_mask, &ipv6_val, sizeof(struct rte_ipv6_hdr)); } } diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 4996fdf8a..b1a9bcbde 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -410,7 +410,7 @@ enic_copy_item_ipv4_v1(struct copy_item_args *arg) const struct rte_flow_item_ipv4 *spec = item->spec; const struct rte_flow_item_ipv4 *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct ipv4_hdr supported_mask = { + struct rte_ipv4_hdr supported_mask = { .src_addr = 0xffffffff, .dst_addr = 0xffffffff, }; @@ -605,9 +605,9 @@ enic_copy_item_inner_ipv4_v2(struct copy_item_args *arg) if (!mask) mask = &rte_flow_item_ipv4_mask; /* Append ipv4 header to L5 and set ether type = ipv4 */ - arg->l3_proto_off = *off + offsetof(struct ipv4_hdr, next_proto_id); + arg->l3_proto_off = *off + offsetof(struct rte_ipv4_hdr, next_proto_id); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ipv4_hdr), + arg->item->spec, mask, sizeof(struct rte_ipv4_hdr), arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4), 2); } @@ -621,9 +621,9 @@ enic_copy_item_inner_ipv6_v2(struct copy_item_args *arg) if (!mask) mask = &rte_flow_item_ipv6_mask; /* Append ipv6 header to L5 and set ether type = ipv6 */ - arg->l3_proto_off = *off + offsetof(struct ipv6_hdr, proto); + arg->l3_proto_off = *off + offsetof(struct rte_ipv6_hdr, proto); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ipv6_hdr), + arg->item->spec, mask, sizeof(struct rte_ipv6_hdr), arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6), 2); } @@ -758,9 +758,9 @@ enic_copy_item_ipv4_v2(struct copy_item_args *arg) mask = &rte_flow_item_ipv4_mask; memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); return 0; } @@ -787,9 +787,9 @@ enic_copy_item_ipv6_v2(struct copy_item_args *arg) mask = &rte_flow_item_ipv6_mask; memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); return 0; } @@ -869,16 +869,16 @@ enic_copy_item_sctp_v2(struct copy_item_args *arg) * the protocol number in the IP pattern. */ if (gp->val_flags & FILTER_GENERIC_1_IPV4) { - struct ipv4_hdr *ip; - ip = (struct ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; + struct rte_ipv4_hdr *ip; + ip = (struct rte_ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; ip_proto_mask = &ip->next_proto_id; - ip = (struct ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; + ip = (struct rte_ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; ip_proto = &ip->next_proto_id; } else if (gp->val_flags & FILTER_GENERIC_1_IPV6) { - struct ipv6_hdr *ip; - ip = (struct ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; + struct rte_ipv6_hdr *ip; + ip = (struct rte_ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; ip_proto_mask = &ip->proto; - ip = (struct ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; + ip = (struct rte_ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; ip_proto = &ip->proto; } else { /* Need IPv4/IPv6 pattern first */ diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4aaf27f7c..b20f30fb4 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -686,8 +686,8 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; static const uint8_t next_proto[] = { [RTE_ETH_FLOW_FRAG_IPV4] = IPPROTO_IP, [RTE_ETH_FLOW_NONFRAG_IPV4_TCP] = IPPROTO_TCP, @@ -723,7 +723,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: case RTE_ETH_FLOW_FRAG_IPV4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -743,14 +743,14 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, */ ip->src_addr = fdir_input->flow.ip4_flow.dst_ip; ip->dst_addr = fdir_input->flow.ip4_flow.src_ip; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: case RTE_ETH_FLOW_FRAG_IPV6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -776,7 +776,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, rte_memcpy(&(ip6->dst_addr), &(fdir_input->flow.ipv6_flow.src_ip), IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); break; default: PMD_DRV_LOG(ERR, "unknown flow type %u.", @@ -960,8 +960,8 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; bool is_customized_pctype = fdir_input->flow_ext.customized_pctype; static const uint8_t next_proto[] = { @@ -1007,7 +1007,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, pctype == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV4 || is_customized_pctype) { - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -1034,13 +1034,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) ip->next_proto_id = IPPROTO_UDP; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV6) { - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -1066,7 +1066,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); } else { PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype); @@ -1093,8 +1093,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, struct tcp_hdr *tcp; struct sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; - struct ipv4_hdr *gtp_ipv4; - struct ipv6_hdr *gtp_ipv6; + struct rte_ipv4_hdr *gtp_ipv4; + struct rte_ipv6_hdr *gtp_ipv6; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -1232,7 +1232,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv4 = (struct ipv4_hdr *) + gtp_ipv4 = (struct rte_ipv4_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv4->version_ihl = @@ -1242,11 +1242,11 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, rte_cpu_to_be_16( I40E_FDIR_INNER_IP_DEFAULT_LEN); payload = (unsigned char *)gtp_ipv4 + - sizeof(struct ipv4_hdr); + sizeof(struct rte_ipv4_hdr); } else if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv6 = (struct ipv6_hdr *) + gtp_ipv6 = (struct rte_ipv6_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv6->vtc_flow = @@ -1260,7 +1260,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, gtp_ipv6->hop_limits = I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS; payload = (unsigned char *)gtp_ipv6 + - sizeof(struct ipv6_hdr); + sizeof(struct rte_ipv6_hdr); } else payload = (unsigned char *)gtp + sizeof(struct rte_flow_item_gtp); diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 9dc492ad2..43a5dd4cb 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2538,13 +2538,13 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: - attributes->l3.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = input->flow.ip4_flow.src_ip, .dst_addr = input->flow.ip4_flow.dst_ip, .time_to_live = input->flow.ip4_flow.ttl, .type_of_service = input->flow.ip4_flow.tos, }; - attributes->l3_mask.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3_mask.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = mask->ipv4_mask.src_ip, .dst_addr = mask->ipv4_mask.dst_ip, .time_to_live = mask->ipv4_mask.ttl, @@ -2560,7 +2560,7 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: - attributes->l3.ipv6.hdr = (struct ipv6_hdr){ + attributes->l3.ipv6.hdr = (struct rte_ipv6_hdr){ .hop_limits = input->flow.ipv6_flow.hop_limits, .proto = input->flow.ipv6_flow.proto, }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index a4c7529cf..d2a725469 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1052,8 +1052,8 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, { struct rte_ether_hdr *eth = NULL; struct rte_vlan_hdr *vlan = NULL; - struct ipv4_hdr *ipv4 = NULL; - struct ipv6_hdr *ipv6 = NULL; + struct rte_ipv4_hdr *ipv4 = NULL; + struct rte_ipv6_hdr *ipv6 = NULL; struct udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; @@ -1089,7 +1089,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_VLAN); break; case RTE_FLOW_ITEM_TYPE_IPV4: - ipv4 = (struct ipv4_hdr *)&buf[temp_size]; + ipv4 = (struct rte_ipv4_hdr *)&buf[temp_size]; if (!vlan && !eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1107,7 +1107,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv4->time_to_live = MLX5_ENCAP_IPV4_TTL_DEF; break; case RTE_FLOW_ITEM_TYPE_IPV6: - ipv6 = (struct ipv6_hdr *)&buf[temp_size]; + ipv6 = (struct rte_ipv6_hdr *)&buf[temp_size]; if (!vlan && !eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 595c13e1f..dd5a090af 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -732,12 +732,12 @@ flow_tcf_pedit_key_set_dec_ttl(const struct rte_flow_action *actions, if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV4) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP4; p_parser->keys[idx].off = - offsetof(struct ipv4_hdr, time_to_live); + offsetof(struct rte_ipv4_hdr, time_to_live); } if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP6; p_parser->keys[idx].off = - offsetof(struct ipv6_hdr, hop_limits); + offsetof(struct rte_ipv6_hdr, hop_limits); } if (actions->type == RTE_FLOW_ACTION_TYPE_DEC_TTL) { p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_ADD; @@ -801,8 +801,8 @@ flow_tcf_pedit_key_set_ipv6_addr(const struct rte_flow_action *actions, int keys = NUM_OF_PEDIT_KEYS(IPV6_ADDR_LEN); int off_base = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC ? - offsetof(struct ipv6_hdr, src_addr) : - offsetof(struct ipv6_hdr, dst_addr); + offsetof(struct rte_ipv6_hdr, src_addr) : + offsetof(struct rte_ipv6_hdr, dst_addr); const struct rte_flow_action_set_ipv6 *conf = (const struct rte_flow_action_set_ipv6 *)actions->conf; @@ -836,8 +836,8 @@ flow_tcf_pedit_key_set_ipv4_addr(const struct rte_flow_action *actions, p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_SET; p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC ? - offsetof(struct ipv4_hdr, src_addr) : - offsetof(struct ipv4_hdr, dst_addr); + offsetof(struct rte_ipv4_hdr, src_addr) : + offsetof(struct rte_ipv4_hdr, dst_addr); p_parser->keys[idx].mask = ~UINT32_MAX; p_parser->keys[idx].val = ((const struct rte_flow_action_set_ipv4 *) diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index 738986575..381b54e29 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -1170,7 +1170,7 @@ mrvl_parse_ip6(const struct rte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_ipv6 *spec = NULL, *mask = NULL; - struct ipv6_hdr zero; + struct rte_ipv6_hdr zero; uint32_t flow_mask; int ret; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 12c83f46d..34299b993 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -457,8 +457,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); uint16_t *ether_type; uint8_t *raw_pkt; - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; struct tcp_hdr *tcp; uint16_t len; @@ -474,14 +474,14 @@ 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 RTE_ETHER_TYPE_IPv4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; ip->version_ihl = QEDE_FDIR_IP_DEFAULT_VERSION_IHL; - ip->total_length = sizeof(struct ipv4_hdr); + ip->total_length = sizeof(struct rte_ipv4_hdr); ip->next_proto_id = arfs->tuple.ip_proto; ip->time_to_live = QEDE_FDIR_IPV4_DEF_TTL; ip->dst_addr = arfs->tuple.dst_ipv4; ip->src_addr = arfs->tuple.src_ipv4; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); params->ipv4 = true; raw_pkt = (uint8_t *)buff; @@ -507,7 +507,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, } break; case RTE_ETHER_TYPE_IPv6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; ip6->proto = arfs->tuple.ip_proto; ip6->vtc_flow = rte_cpu_to_be_32(QEDE_FDIR_IPV6_DEFAULT_VTC_FLOW); @@ -516,7 +516,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, IPV6_ADDR_LEN); rte_memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); params->ipv6 = true; raw_pkt = (uint8_t *)buff; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 235f78ae3..a07700167 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -951,8 +951,8 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; @@ -972,14 +972,14 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) if (ethertype == RTE_ETHER_TYPE_IPv4) { packet_type |= RTE_PTYPE_L3_IPV4; - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, len); + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_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 == RTE_ETHER_TYPE_IPv6) { packet_type |= RTE_PTYPE_L3_IPV6; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, len); + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, len); if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) @@ -1141,7 +1141,7 @@ static inline uint32_t qede_rx_cqe_to_pkt_type(uint16_t flags) static inline uint8_t qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) { - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; uint16_t pkt_csum; uint16_t calc_csum; uint16_t val; @@ -1152,7 +1152,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) if (unlikely(val)) { m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; diff --git a/drivers/net/sfc/sfc_tso.h b/drivers/net/sfc/sfc_tso.h index 8ecefdfd2..ef257519a 100644 --- a/drivers/net/sfc/sfc_tso.h +++ b/drivers/net/sfc/sfc_tso.h @@ -29,10 +29,10 @@ extern "C" { static inline uint16_t sfc_tso_ip4_get_ipid(const uint8_t *pkt_hdrp, size_t ip_hdr_off) { - const struct ipv4_hdr *ip_hdrp; + const struct rte_ipv4_hdr *ip_hdrp; uint16_t ipid; - ip_hdrp = (const struct ipv4_hdr *)(pkt_hdrp + ip_hdr_off); + ip_hdrp = (const struct rte_ipv4_hdr *)(pkt_hdrp + ip_hdr_off); rte_memcpy(&ipid, &ip_hdrp->packet_id, sizeof(ipid)); return rte_be_to_cpu_16(ipid); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 308fd1534..e0e5856a4 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -660,7 +660,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -669,7 +669,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -678,7 +678,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -687,7 +687,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -697,7 +697,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -709,7 +709,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -718,7 +718,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -726,7 +726,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -734,7 +734,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -742,7 +742,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -751,7 +751,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -759,7 +759,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -767,7 +767,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -775,7 +775,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -784,7 +784,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -794,7 +794,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index bb0aee42d..2465d9c2c 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -272,12 +272,12 @@ tap_verify_csum(struct rte_mbuf *mbuf) else if (l2 == RTE_PTYPE_L2_ETHER_QINQ) l2_len += 8; /* Don't verify checksum for packets with discontinuous L2 header */ - if (unlikely(l2_len + sizeof(struct ipv4_hdr) > + if (unlikely(l2_len + sizeof(struct rte_ipv4_hdr) > rte_pktmbuf_data_len(mbuf))) return; l3_hdr = rte_pktmbuf_mtod_offset(mbuf, void *, l2_len); if (l3 == RTE_PTYPE_L3_IPV4 || l3 == RTE_PTYPE_L3_IPV4_EXT) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; /* ihl contains the number of 4-byte words in the header */ l3_len = 4 * (iph->version_ihl & 0xf); @@ -295,9 +295,9 @@ tap_verify_csum(struct rte_mbuf *mbuf) PKT_RX_IP_CKSUM_BAD : PKT_RX_IP_CKSUM_GOOD; } else if (l3 == RTE_PTYPE_L3_IPV6) { - struct ipv6_hdr *iph = l3_hdr; + struct rte_ipv6_hdr *iph = l3_hdr; - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); /* check that the total length reported by header is not * greater than the total received size */ @@ -496,7 +496,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, void *l3_hdr = packet + l2_len; if (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4)) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; uint16_t cksum; iph->hdr_checksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 12283cd4c..2b1080155 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -479,13 +479,13 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) /* common case: header is not fragmented */ if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + m->l4_len)) { - struct ipv4_hdr *iph; - struct ipv6_hdr *ip6h; + struct rte_ipv4_hdr *iph; + struct rte_ipv6_hdr *ip6h; struct tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; - iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + iph = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); th = RTE_PTR_ADD(iph, m->l3_len); if ((iph->version_ihl >> 4) == 4) { iph->hdr_checksum = 0; @@ -494,7 +494,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) - m->l3_len); } else { - ip6h = (struct ipv6_hdr *)iph; + ip6h = (struct rte_ipv6_hdr *)iph; ip_paylen = ip6h->payload_len; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index a2c047ec6..7749458e4 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -667,8 +667,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm) { uint32_t hlen, slen; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; char *ptr; @@ -679,20 +679,20 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { - if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) - return hw->mtu - sizeof(struct ipv4_hdr) + if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) + return hw->mtu - sizeof(struct rte_ipv4_hdr) - sizeof(struct tcp_hdr); - ipv4_hdr = (struct ipv4_hdr *)(ptr + hlen); + ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { - if (unlikely(slen < hlen + sizeof(struct ipv6_hdr))) - return hw->mtu - sizeof(struct ipv6_hdr) - + if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) + return hw->mtu - sizeof(struct rte_ipv6_hdr) - sizeof(struct tcp_hdr); - ipv6_hdr = (struct ipv6_hdr *)(ptr + hlen); - hlen += sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); + hlen += sizeof(struct rte_ipv6_hdr); if (unlikely(ipv6_hdr->proto != IPPROTO_TCP)) { int frag; diff --git a/examples/bond/main.c b/examples/bond/main.c index 04102b7ed..cea37e02c 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -340,7 +340,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; uint16_t rx_cnt; @@ -405,7 +405,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[2]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index dfb7db1c9..c75a410f4 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -99,7 +99,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -109,7 +109,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -119,7 +119,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -132,7 +132,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -142,7 +142,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index b34a2228f..9c8a0a9b9 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -65,8 +65,8 @@ /* * Default payload in bytes for the IPv6 packet. */ -#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct ipv4_hdr)) -#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct ipv6_hdr)) +#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct rte_ipv4_hdr)) +#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct rte_ipv6_hdr)) /* * Max number of fragments per packet expected - defined by config file. @@ -259,10 +259,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, /* if this is an IPv4 packet */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv4_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv4_hdr *); ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); /* Find destination port */ @@ -294,12 +294,12 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, } } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if this is an IPv6 packet */ - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; ipv6 = 1; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv6_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv6_hdr *); /* Find destination port */ if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index 78d590d77..9cc7e32d8 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -636,7 +636,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -645,7 +645,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -654,7 +654,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -663,7 +663,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -673,7 +673,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -685,7 +685,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -694,7 +694,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -702,7 +702,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -710,7 +710,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -718,7 +718,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -727,7 +727,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -735,7 +735,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -743,7 +743,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -751,7 +751,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -760,7 +760,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -770,7 +770,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index c2a1f9228..00a95e07a 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -324,10 +324,10 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, /* if packet is IPv4 */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); /* if it is a fragmented packet, then try to reassemble. */ if (rte_ipv4_frag_pkt_is_fragmented(ip_hdr)) { @@ -351,7 +351,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); } } ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); @@ -366,9 +366,9 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if packet is IPv6 */ struct ipv6_extension_fragment *frag_hdr; - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(ip_hdr); @@ -389,7 +389,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); } } diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 05c187c4c..3302ce944 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -340,7 +340,7 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, /* calculate IPv4 cksum in SW */ if ((pkt->ol_flags & PKT_TX_IP_CKSUM) == 0) - ip->ip_sum = rte_ipv4_cksum((struct ipv4_hdr *)ip); + ip->ip_sum = rte_ipv4_cksum((struct rte_ipv4_hdr *)ip); ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); } else { diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index b323b0163..1d0020567 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -967,7 +967,7 @@ get_spi_proto(uint32_t spi, enum rte_security_ipsec_sa_direction dir) static int fill_ipsec_sa_prm(struct rte_ipsec_sa_prm *prm, const struct ipsec_sa *ss, - const struct ipv4_hdr *v4, struct ipv6_hdr *v6) + const struct rte_ipv4_hdr *v4, struct rte_ipv6_hdr *v6) { int32_t rc; @@ -1038,7 +1038,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) { int rc; struct rte_ipsec_sa_prm prm; - struct ipv4_hdr v4 = { + struct rte_ipv4_hdr v4 = { .version_ihl = IPVERSION << 4 | sizeof(v4) / IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, @@ -1046,7 +1046,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) .src_addr = lsa->src.ip.ip4, .dst_addr = lsa->dst.ip.ip4, }; - struct ipv6_hdr v6 = { + struct rte_ipv6_hdr v6 = { .vtc_flow = htonl(IP6_VERSION << 28), .proto = IPPROTO_ESP, }; diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index cc9a30c4c..259c0d19e 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -296,7 +296,7 @@ static inline void mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) { struct rte_mbuf *mc; - struct ipv4_hdr *iphdr; + struct rte_ipv4_hdr *iphdr; uint32_t dest_addr, port_mask, port_num, use_clone; int32_t hash; uint16_t port; @@ -306,7 +306,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 973a371bf..06f5d1db1 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -388,7 +388,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct l2fwd_crypto_params *cparams) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; @@ -401,7 +401,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ipdata_offset = sizeof(struct rte_ether_hdr); - ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + + ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index ab8ba046b..b0e933e03 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -146,7 +146,7 @@ static struct rte_mempool *pktmbuf_pool[NB_SOCKETS]; /***********************start of ACL part******************************/ #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len); +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len); #endif static inline void send_single_packet(struct rte_mbuf *m, uint16_t port); @@ -174,8 +174,8 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *d = (unsigned char)(ip & 0xff);\ } while (0) #define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) -#define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) -#define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) +#define OFF_IPV42PROTO (offsetof(struct rte_ipv4_hdr, next_proto_id)) +#define OFF_IPV62PROTO (offsetof(struct rte_ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ rte_pktmbuf_mtod_offset((m), uint8_t *, OFF_ETHHEAD + OFF_IPV42PROTO) #define MBUF_IPV6_2PROTO(m) \ @@ -252,32 +252,32 @@ struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_SRC, - .offset = offsetof(struct ipv4_hdr, src_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, src_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_DST, - .offset = offsetof(struct ipv4_hdr, dst_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id) + + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id) + sizeof(uint16_t), }, }; @@ -314,80 +314,80 @@ struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = { .size = sizeof(uint32_t), .field_index = SRC1_FIELD_IPV6, .input_index = SRC1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC2_FIELD_IPV6, .input_index = SRC2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC3_FIELD_IPV6, .input_index = SRC3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC4_FIELD_IPV6, .input_index = SRC4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST1_FIELD_IPV6, .input_index = DST1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) + - offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST2_FIELD_IPV6, .input_index = DST2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST3_FIELD_IPV6, .input_index = DST3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST4_FIELD_IPV6, .input_index = DST4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint16_t), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint16_t), }, }; @@ -542,8 +542,8 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) { uint32_t offset = sig & ~ACL_DENY_SIGNATURE; unsigned char a, b, c, d; - struct ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv4_hdr *, + struct rte_ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); @@ -566,8 +566,8 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) { unsigned i; uint32_t offset = sig & ~ACL_DENY_SIGNATURE; - struct ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv6_hdr *, + struct rte_ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); printf("Packet Src"); @@ -620,11 +620,11 @@ static inline void prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, int index) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = pkts_in[index]; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ @@ -1281,14 +1281,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -1313,7 +1313,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 2725bb40b..91f144605 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -466,14 +466,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -498,7 +498,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -523,7 +523,7 @@ print_ipv6_key(struct ipv6_5tuple key) } static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -538,14 +538,14 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -562,7 +562,7 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, } static inline uint16_t -get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, +get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; @@ -578,14 +578,14 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -604,7 +604,7 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint32_t next_hop; @@ -662,7 +662,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; @@ -671,7 +671,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -706,10 +706,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; ipv6_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d9b636806..ebb2378dd 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -314,14 +314,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -346,7 +346,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -362,7 +362,7 @@ print_key(struct ipv4_5tuple key) } static inline uint16_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -377,14 +377,14 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -402,7 +402,7 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint32_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { uint32_t next_hop; @@ -418,13 +418,13 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 1893f8c3a..293fb1fa2 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -130,14 +130,14 @@ send_single_packet(struct lcore_conf *qconf, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -162,7 +162,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 0c68aa01c..fc7996f88 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,13 +68,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -129,7 +129,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); /* dynamically vec_sel te and ve for MASK_ETH (0x3f) */ diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h index 0f4fcb427..7d83ff641 100644 --- a/examples/l3fwd/l3fwd_common.h +++ b/examples/l3fwd/l3fwd_common.h @@ -14,7 +14,7 @@ #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -28,7 +28,7 @@ * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index b56b08646..fb55e196d 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -252,7 +252,7 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv4_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); /* * Get 5 tuple: dst port, src port, dst IP address, @@ -273,7 +273,7 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv6_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct rte_ipv6_hdr, payload_len); void *data0 = ipv6_hdr; void *data1 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t); void *data2 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t) + sizeof(xmm_t); @@ -566,17 +566,17 @@ em_parse_ptype(struct rte_mbuf *m) uint16_t ether_type; void *l3; int hdr_len; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; 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(RTE_ETHER_TYPE_IPv4)) { - ipv4_hdr = (struct ipv4_hdr *)l3; + ipv4_hdr = (struct rte_ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; - if (hdr_len == sizeof(struct ipv4_hdr)) { + if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; @@ -585,7 +585,7 @@ em_parse_ptype(struct rte_mbuf *m) } else packet_type |= RTE_PTYPE_L3_IPV4_EXT; } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { - ipv6_hdr = (struct ipv6_hdr *)l3; + ipv6_hdr = (struct rte_ipv6_hdr *)l3; if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 4a7336350..62ae1bf30 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -10,7 +10,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -21,7 +21,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -52,9 +52,9 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 5afe77591..4476a91f3 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -80,8 +80,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint16_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -91,7 +91,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -106,7 +106,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 3ee2304b5..3aaf71428 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); } @@ -26,17 +26,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 8)); + offsetof(struct rte_ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 16)); + offsetof(struct rte_ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); key->xmm[1] = tmpdata1; diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 8156bbb90..7964a9277 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); } @@ -26,18 +26,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 6e7096c01..8307c20dd 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -25,8 +25,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint8_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -36,7 +36,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -51,7 +51,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 96143d871..881b0c7c0 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -82,7 +82,7 @@ lpm_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm *)lookup_struct; return (uint16_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -94,7 +94,7 @@ lpm_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm6 *)lookup_struct; return (uint16_t) ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } @@ -102,21 +102,21 @@ static __rte_always_inline uint16_t lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { - struct ipv6_hdr *ipv6_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -135,7 +135,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -146,7 +146,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, ipv6_hdr->dst_addr, &next_hop) == 0) diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 323f853ee..05faa5426 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -10,14 +10,14 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -48,9 +48,9 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index b36e991ac..7c6814252 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -17,30 +17,30 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], vector unsigned int *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index a3e42cfa7..d6c0ba64a 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -18,27 +18,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], int32x4_t *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 4603e0749..3f637a23d 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -15,27 +15,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index af2dc47ac..712c3a704 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -113,7 +113,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); ve = vcopyq_laneq_u32(ve, 3, te, 3); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index 3349f2747..5919f48b9 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -109,7 +109,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); te = _mm_blend_epi16(te, ve, MASK_ETH); diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index c4e6b4ac8..ff76c8d5b 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -495,7 +495,7 @@ app_lcore_worker( for (j = 0; j < bsz_rd; j ++) { struct rte_mbuf *pkt; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst, pos; uint32_t port; @@ -508,7 +508,7 @@ app_lcore_worker( pkt = lp->mbuf_in.array[j]; ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 3d2ceea2f..da5c66203 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -751,14 +751,14 @@ send_packetsx4(uint16_t port, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -783,7 +783,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -802,7 +802,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); __m128i data = _mm_loadu_si128((__m128i *)(ipv4_hdr)); /* Get 5 tuple: dst port, src port, dst IP address, src IP address and protocol */ @@ -819,7 +819,7 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, int ret = 0; union ipv6_5tuple_host key; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct rte_ipv6_hdr, payload_len); __m128i data0 = _mm_loadu_si128((__m128i *)(ipv6_hdr)); __m128i data1 = _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr) + sizeof(__m128i))); @@ -849,7 +849,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -860,7 +860,7 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } #endif @@ -885,7 +885,7 @@ static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { struct rte_ether_hdr *eth_hdr[8]; - struct ipv4_hdr *ipv4_hdr[8]; + struct rte_ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; @@ -901,21 +901,21 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ - ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, + ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, + ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, + ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, + ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, + ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, + ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, + ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, + ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -968,28 +968,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -1095,13 +1095,13 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); key->xmm[1] = tmpdata1; @@ -1116,7 +1116,7 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; - __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; + __attribute__((unused)) struct rte_ipv6_hdr *ipv6_hdr[8]; eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); @@ -1128,21 +1128,21 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ - ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, + ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, + ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, + ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, + ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, + ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, + ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, + ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, + ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); @@ -1229,14 +1229,14 @@ static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -1267,9 +1267,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, @@ -1300,7 +1300,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -1314,7 +1314,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; @@ -1345,7 +1345,7 @@ static __rte_always_inline uint16_t get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -1356,7 +1356,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct, @@ -1372,13 +1372,13 @@ static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; dst_ipv4 = rte_be_to_cpu_32(dst_ipv4); @@ -1402,27 +1402,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1503,13 +1503,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 8bec351ec..44216f999 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -266,7 +266,7 @@ transmit_packet(struct rte_mbuf *buf) static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -274,7 +274,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index a086c5a77..3e5295433 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -247,12 +247,12 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], efd_value_t data[RTE_EFD_BURST_MAX]; const void *key_ptrs[RTE_EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[RTE_EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 48a46d536..8088d9412 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -31,8 +31,8 @@ static void parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint16_t ethertype; info->outer_l2_len = sizeof(struct rte_ether_hdr); @@ -46,15 +46,15 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, switch (ethertype) { case RTE_ETHER_TYPE_IPv4: - ipv4_hdr = (struct ipv4_hdr *) + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv4_hdr); + info->outer_l3_len = sizeof(struct rte_ipv4_hdr); *l4_proto = ipv4_hdr->next_proto_id; break; case RTE_ETHER_TYPE_IPv6: - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv6_hdr); + info->outer_l3_len = sizeof(struct rte_ipv6_hdr); *l4_proto = ipv6_hdr->proto; break; default: @@ -73,8 +73,8 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i void *l3_hdr = NULL; uint8_t l4_proto; uint16_t ethertype; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -92,15 +92,15 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i l3_hdr = (char *)eth_hdr + info->l2_len; if (ethertype == RTE_ETHER_TYPE_IPv4) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_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); + info->l3_len = sizeof(struct rte_ipv4_hdr); l4_proto = ipv4_hdr->next_proto_id; } else if (ethertype == RTE_ETHER_TYPE_IPv6) { - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; + info->l3_len = sizeof(struct rte_ipv6_hdr); l4_proto = ipv6_hdr->proto; ol_flags |= PKT_TX_IPV6; } else @@ -176,10 +176,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); - struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; + struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; @@ -192,7 +192,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - sizeof(struct rte_ether_hdr)); @@ -210,7 +210,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) } m->outer_l2_len = sizeof(struct rte_ether_hdr); - m->outer_l3_len = sizeof(struct ipv4_hdr); + m->outer_l3_len = sizeof(struct rte_ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index 780ae73cc..689aea451 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -16,7 +16,7 @@ #define VXLAN_HF_VNI 0x08000000 #define DEFAULT_VXLAN_PORT 4789 -extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +extern struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 0b6b2d86e..b2c4155ee 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -48,7 +48,7 @@ /* VXLAN device */ struct vxlan_conf vxdev; -struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ @@ -229,7 +229,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) int i, ret; struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; struct rte_eth_tunnel_filter_conf tunnel_filter_conf; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index cbd8e248d..ce14b100a 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -864,7 +864,7 @@ get_psd_sum(void *l3_hdr, uint64_t ol_flags) static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; - struct ipv4_hdr *ipv4_hdr = NULL; + struct rte_ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 56f129bd3..0bf55a62f 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -629,7 +629,7 @@ static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { * Note: IPv4 options are handled by dedicated pattern items. */ struct rte_flow_item_ipv4 { - struct ipv4_hdr hdr; /**< IPv4 header definition. */ + struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ @@ -651,7 +651,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { * RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ struct rte_flow_item_ipv6 { - struct ipv6_hdr hdr; /**< IPv6 header definition. */ + struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index 11d422573..bf9f98959 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -611,8 +611,8 @@ rxa_calc_wrr_sequence(struct rte_event_eth_rx_adapter *rx_adapter, } static inline void -rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, - struct ipv6_hdr **ipv6_hdr) +rxa_mtoip(struct rte_mbuf *m, struct rte_ipv4_hdr **ipv4_hdr, + struct rte_ipv6_hdr **ipv6_hdr) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); struct rte_vlan_hdr *vlan_hdr; @@ -622,21 +622,21 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, switch (eth_hdr->ether_type) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_VLAN): vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(vlan_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(vlan_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(vlan_hdr + 1); break; default: break; @@ -656,8 +656,8 @@ rxa_do_softrss(struct rte_mbuf *m, const uint8_t *rss_key_be) void *tuple; struct rte_ipv4_tuple ipv4_tuple; struct rte_ipv6_tuple ipv6_tuple; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; rxa_mtoip(m, &ipv4_hdr, &ipv6_hdr); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 99c9c7d91..c37b4ef3e 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -180,10 +180,10 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, static inline void update_header(struct gro_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = item->firstseg; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - pkt->l2_len); @@ -195,7 +195,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; @@ -216,7 +216,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, return -1; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index ce3471a4d..0a42a1ae8 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -269,11 +269,11 @@ check_seq_option(struct gro_tcp4_item *item, uint8_t is_atomic) { struct rte_mbuf *pkt_orig = item->firstseg; - struct ipv4_hdr *iph_orig; + struct rte_ipv4_hdr *iph_orig; struct tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + + iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 53425f6d3..a9bdf1d72 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -262,14 +262,14 @@ merge_two_vxlan_tcp4_packets(struct gro_vxlan_tcp4_item *item, static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; /* Update the outer IPv4 header. */ len = pkt->pkt_len - pkt->outer_l2_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->outer_l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); @@ -280,7 +280,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the inner IPv4 header. */ len -= pkt->l2_len; - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); } @@ -290,7 +290,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; - struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; + struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; @@ -314,7 +314,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, return -1; outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + + outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); @@ -322,7 +322,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sizeof(struct udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index b6ff1b886..5f2adc833 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -98,9 +98,9 @@ update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, static inline void update_ipv4_header(struct rte_mbuf *pkt, uint16_t l3_offset, uint16_t id) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l3_offset); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - l3_offset); ipv4_hdr->packet_id = rte_cpu_to_be_16(id); diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index fbd95f8f6..ad0cce6f9 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -9,14 +9,14 @@ static void update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; uint16_t l4_offset = l3_offset + pkt->l3_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -40,13 +40,13 @@ gso_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index d39b46863..f5a19bc43 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -9,7 +9,7 @@ static void update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; @@ -23,12 +23,12 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, tcp_offset = inner_ipv4_offset + pkt->l3_len; /* Outer IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + outer_ipv4_offset); outer_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); /* Inner IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -60,12 +60,12 @@ gso_tunnel_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *inner_ipv4_hdr; + struct rte_ipv4_hdr *inner_ipv4_hdr; uint16_t pyld_unit_size, hdr_offset, frag_off; int ret = 1; hdr_offset = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len; - inner_ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + inner_ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + hdr_offset); /* * Don't process the packet whose MF bit or offset in the inner diff --git a/lib/librte_gso/gso_udp4.c b/lib/librte_gso/gso_udp4.c index 927dee121..93e6f8e0d 100644 --- a/lib/librte_gso/gso_udp4.c +++ b/lib/librte_gso/gso_udp4.c @@ -11,7 +11,7 @@ static inline void update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t frag_offset = 0, is_mf; uint16_t l2_hdrlen = pkt->l2_len, l3_hdrlen = pkt->l3_len; uint16_t tail_idx = nb_segs - 1, length, i; @@ -22,7 +22,7 @@ update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, * length. */ for (i = 0; i < nb_segs; i++) { - ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct rte_ipv4_hdr *, l2_hdrlen); length = segs[i]->pkt_len - l2_hdrlen; ipv4_hdr->total_length = rte_cpu_to_be_16(length); @@ -42,13 +42,13 @@ gso_udp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 433f2c8bb..ee879968c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,11 +19,11 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h index 1b33f4813..b27bf24d3 100644 --- a/lib/librte_hash/rte_thash.h +++ b/lib/librte_hash/rte_thash.h @@ -139,7 +139,7 @@ rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len) * Pointer to rte_ipv6_tuple structure */ static inline void -rte_thash_load_v6_addrs(const struct ipv6_hdr *orig, union rte_thash_tuple *targ) +rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig, union rte_thash_tuple *targ) { #ifdef RTE_ARCH_X86 __m128i ipv6 = _mm_loadu_si128((const __m128i *)orig->src_addr); diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 04fd9df52..60c0300e8 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -219,7 +219,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr); /** @@ -234,7 +234,7 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * present. */ static inline struct ipv6_extension_fragment * -rte_ipv6_frag_get_ipv6_fragment_header(struct ipv6_hdr *hdr) +rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr) { if (hdr->proto == IPPROTO_FRAGMENT) { return (struct ipv6_extension_fragment *) ++hdr; @@ -293,7 +293,7 @@ int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr); + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr); /** * Check if the IPv4 packet is fragmented @@ -304,7 +304,7 @@ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * 1 if fragmented, 0 if not fragmented */ static inline int -rte_ipv4_frag_pkt_is_fragmented(const struct ipv4_hdr * hdr) { +rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index a96fb03e4..2c781724a 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -21,8 +21,8 @@ #define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) -static inline void __fill_ipv4hdr_frag(struct ipv4_hdr *dst, - const struct ipv4_hdr *src, uint16_t len, uint16_t fofs, +static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, + const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); @@ -70,7 +70,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv4_hdr *in_hdr; + struct rte_ipv4_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, flag_offset, frag_size; @@ -80,10 +80,10 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, * Ensure the IP payload length of all fragments is aligned to a * multiple of 8 bytes as per RFC791 section 2.3. */ - frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct ipv4_hdr)), + frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct rte_ipv4_hdr)), IPV4_HDR_FO_ALIGN); - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv4_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv4_hdr *); flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset); /* If Don't Fragment flag is set */ @@ -92,11 +92,11 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Check that pkts_out is big enough to hold all fragments */ if (unlikely(frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv4_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof (struct rte_ipv4_hdr)))) return -EINVAL; in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv4_hdr); + in_seg_data_pos = sizeof(struct rte_ipv4_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -104,7 +104,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv4_hdr *out_hdr; + struct rte_ipv4_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -114,8 +114,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv4_hdr); - out_pkt->pkt_len = sizeof(struct ipv4_hdr); + out_pkt->data_len = sizeof(struct rte_ipv4_hdr); + out_pkt->pkt_len = sizeof(struct rte_ipv4_hdr); frag_bytes_remaining = frag_size; out_seg_prev = out_pkt; @@ -164,17 +164,17 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv4_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv4_hdr *); __fill_ipv4hdr_frag(out_hdr, in_hdr, (uint16_t)out_pkt->pkt_len, flag_offset, fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv4_hdr)); + out_pkt->pkt_len - sizeof(struct rte_ipv4_hdr)); out_pkt->ol_flags |= PKT_TX_IP_CKSUM; - out_pkt->l3_len = sizeof(struct ipv4_hdr); + out_pkt->l3_len = sizeof(struct rte_ipv4_hdr); /* Write the fragment to the output list */ pkts_out[out_pkt_pos] = out_pkt; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 1029b7abc..97da607ed 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -14,7 +14,7 @@ struct rte_mbuf * ipv4_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; uint32_t curr_idx = 0; @@ -70,7 +70,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv4 header for the reassembled packet */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); @@ -100,7 +100,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv4_hdr *ip_hdr) + struct rte_ipv4_hdr *ip_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c index b9437eb11..875f86faa 100644 --- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c @@ -18,8 +18,8 @@ */ static inline void -__fill_ipv6hdr_frag(struct ipv6_hdr *dst, - const struct ipv6_hdr *src, uint16_t len, uint16_t fofs, +__fill_ipv6hdr_frag(struct rte_ipv6_hdr *dst, + const struct rte_ipv6_hdr *src, uint16_t len, uint16_t fofs, uint32_t mf) { struct ipv6_extension_fragment *fh; @@ -73,7 +73,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv6_hdr *in_hdr; + struct rte_ipv6_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, frag_size; @@ -83,18 +83,18 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, * Ensure the IP payload length of all fragments (except the * the last fragment) are a multiple of 8 bytes per RFC2460. */ - frag_size = RTE_ALIGN_FLOOR(mtu_size - sizeof(struct ipv6_hdr), + frag_size = RTE_ALIGN_FLOOR(mtu_size - sizeof(struct rte_ipv6_hdr), RTE_IPV6_EHDR_FO_ALIGN); /* Check that pkts_out is big enough to hold all fragments */ if (unlikely (frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof (struct rte_ipv6_hdr)))) return -EINVAL; - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv6_hdr *); in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv6_hdr); + in_seg_data_pos = sizeof(struct rte_ipv6_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -102,7 +102,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv6_hdr *out_hdr; + struct rte_ipv6_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -112,8 +112,8 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); - out_pkt->pkt_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->data_len = sizeof(struct rte_ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->pkt_len = sizeof(struct rte_ipv6_hdr) + sizeof(struct ipv6_extension_fragment); frag_bytes_remaining = frag_size; out_seg_prev = out_pkt; @@ -163,14 +163,14 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv6_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv6_hdr *); __fill_ipv6hdr_frag(out_hdr, in_hdr, - (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr), + (uint16_t) out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr), fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv6_hdr) + out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr) - sizeof(struct ipv6_extension_fragment)); /* Write the fragment to the output list */ diff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c index 855e3f740..169b01a5d 100644 --- a/lib/librte_ip_frag/rte_ipv6_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c @@ -32,7 +32,7 @@ ip_frag_memmove(char *dst, char *src, int len) struct rte_mbuf * ipv6_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; struct ipv6_extension_fragment *frag_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; @@ -93,7 +93,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv6 header for the reassembled datagram */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, m->l2_len); ip_hdr->payload_len = rte_cpu_to_be_16(payload_len); @@ -139,7 +139,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) + struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_ipsec/iph.h b/lib/librte_ipsec/iph.h index 58930cf18..a0ca41d51 100644 --- a/lib/librte_ipsec/iph.h +++ b/lib/librte_ipsec/iph.h @@ -40,8 +40,8 @@ static inline int update_trs_l3hdr(const struct rte_ipsec_sa *sa, void *p, uint32_t plen, uint32_t l2len, uint32_t l3len, uint8_t proto) { - struct ipv4_hdr *v4h; - struct ipv6_hdr *v6h; + struct rte_ipv4_hdr *v4h; + struct rte_ipv6_hdr *v6h; int32_t rc; if ((sa->type & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4) { @@ -67,8 +67,8 @@ static inline void update_tun_l3hdr(const struct rte_ipsec_sa *sa, void *p, uint32_t plen, uint32_t l2len, rte_be16_t pid) { - struct ipv4_hdr *v4h; - struct ipv6_hdr *v6h; + struct rte_ipv4_hdr *v4h; + struct rte_ipv6_hdr *v6h; if (sa->type & RTE_IPSEC_SATP_MODE_TUNLV4) { v4h = p; diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index f9b909090..a1431ee90 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -28,7 +28,7 @@ extern "C" { /** * IPv4 Header */ -struct ipv4_hdr { +struct rte_ipv4_hdr { uint8_t version_ihl; /**< version and header length */ uint8_t type_of_service; /**< type of service */ uint16_t total_length; /**< length of packet */ @@ -249,10 +249,10 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len, * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) +rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr) { uint16_t cksum; - cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr)); + cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr)); return (cksum == 0xffff) ? cksum : (uint16_t)~cksum; } @@ -275,7 +275,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) +rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags) { struct ipv4_psd_header { uint32_t src_addr; /* IP address of source host. */ @@ -294,7 +294,7 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) } else { psd_hdr.len = rte_cpu_to_be_16( (uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr))); + - sizeof(struct rte_ipv4_hdr))); } return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr)); } @@ -314,16 +314,16 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) * or 0 on error */ static inline uint16_t -rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) +rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l3_len, l4_len; l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length); - if (l3_len < sizeof(struct ipv4_hdr)) + if (l3_len < sizeof(struct rte_ipv4_hdr)) return 0; - l4_len = l3_len - sizeof(struct ipv4_hdr); + l4_len = l3_len - sizeof(struct rte_ipv4_hdr); cksum = rte_raw_cksum(l4_hdr, l4_len); cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0); @@ -339,7 +339,7 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) /** * IPv6 Header */ -struct ipv6_hdr { +struct rte_ipv6_hdr { uint32_t vtc_flow; /**< IP version, traffic class & flow label. */ uint16_t payload_len; /**< IP packet length - includes sizeof(ip_header). */ uint8_t proto; /**< Protocol, next header. */ @@ -371,7 +371,7 @@ struct ipv6_hdr { * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) +rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags) { uint32_t sum; struct { @@ -407,7 +407,7 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr) +rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l4_len; diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index d858ab155..b01cacb9c 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -173,7 +173,7 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, /* get the ipv4 header length */ static uint8_t -ip4_hlen(const struct ipv4_hdr *hdr) +ip4_hlen(const struct rte_ipv4_hdr *hdr) { return (hdr->version_ihl & 0xf) * 4; } @@ -300,8 +300,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -323,8 +323,8 @@ 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(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); @@ -432,8 +432,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -455,8 +455,8 @@ 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(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 16970711b..5c9a37a94 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -112,8 +112,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, static inline int rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -144,7 +144,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) #endif if (ol_flags & PKT_TX_IPV4) { - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, inner_l3_offset); if (ol_flags & PKT_TX_IP_CKSUM) @@ -158,7 +158,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, @@ -175,7 +175,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 224045e8a..682df6cc4 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -491,7 +491,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -499,14 +499,14 @@ struct encap_vxlan_ipv4_data { struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -514,7 +514,7 @@ struct encap_vxlan_ipv6_data { struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -999,7 +999,7 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -1029,7 +1029,7 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -1334,7 +1334,7 @@ nat_ipv6_tcp_udp_checksum_update(uint16_t cksum0, } static __rte_always_inline void -pkt_ipv4_work_nat(struct ipv4_hdr *ip, +pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, struct nat_ipv4_data *data, struct rte_table_action_nat_config *cfg) { @@ -1420,7 +1420,7 @@ pkt_ipv4_work_nat(struct ipv4_hdr *ip, } static __rte_always_inline void -pkt_ipv6_work_nat(struct ipv6_hdr *ip, +pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, struct nat_ipv6_data *data, struct rte_table_action_nat_config *cfg) { @@ -1528,7 +1528,7 @@ ttl_apply(void *data, } static __rte_always_inline uint64_t -pkt_ipv4_work_ttl(struct ipv4_hdr *ip, +pkt_ipv4_work_ttl(struct rte_ipv4_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -1549,7 +1549,7 @@ pkt_ipv4_work_ttl(struct ipv4_hdr *ip, } static __rte_always_inline uint64_t -pkt_ipv6_work_ttl(struct ipv6_hdr *ip, +pkt_ipv6_work_ttl(struct rte_ipv6_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -2885,16 +2885,16 @@ pkt_work(struct rte_mbuf *mbuf, uint16_t total_length; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr = ip; + struct rte_ipv4_hdr *hdr = ip; dscp = hdr->type_of_service >> 2; total_length = rte_ntohs(hdr->total_length); } else { - struct ipv6_hdr *hdr = ip; + struct rte_ipv6_hdr *hdr = ip; dscp = (rte_ntohl(hdr->vtc_flow) & 0x0F600000) >> 18; total_length = - rte_ntohs(hdr->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr->payload_len) + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { @@ -3033,10 +3033,10 @@ pkt4_work(struct rte_mbuf **mbufs, uint16_t total_length0, total_length1, total_length2, total_length3; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr0 = ip0; - struct ipv4_hdr *hdr1 = ip1; - struct ipv4_hdr *hdr2 = ip2; - struct ipv4_hdr *hdr3 = ip3; + struct rte_ipv4_hdr *hdr0 = ip0; + struct rte_ipv4_hdr *hdr1 = ip1; + struct rte_ipv4_hdr *hdr2 = ip2; + struct rte_ipv4_hdr *hdr3 = ip3; dscp0 = hdr0->type_of_service >> 2; dscp1 = hdr1->type_of_service >> 2; @@ -3048,10 +3048,10 @@ pkt4_work(struct rte_mbuf **mbufs, total_length2 = rte_ntohs(hdr2->total_length); total_length3 = rte_ntohs(hdr3->total_length); } else { - struct ipv6_hdr *hdr0 = ip0; - struct ipv6_hdr *hdr1 = ip1; - struct ipv6_hdr *hdr2 = ip2; - struct ipv6_hdr *hdr3 = ip3; + struct rte_ipv6_hdr *hdr0 = ip0; + struct rte_ipv6_hdr *hdr1 = ip1; + struct rte_ipv6_hdr *hdr2 = ip2; + struct rte_ipv6_hdr *hdr3 = ip3; dscp0 = (rte_ntohl(hdr0->vtc_flow) & 0x0F600000) >> 18; dscp1 = (rte_ntohl(hdr1->vtc_flow) & 0x0F600000) >> 18; @@ -3059,13 +3059,13 @@ pkt4_work(struct rte_mbuf **mbufs, dscp3 = (rte_ntohl(hdr3->vtc_flow) & 0x0F600000) >> 18; total_length0 = - rte_ntohs(hdr0->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr0->payload_len) + sizeof(struct rte_ipv6_hdr); total_length1 = - rte_ntohs(hdr1->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr1->payload_len) + sizeof(struct rte_ipv6_hdr); total_length2 = - rte_ntohs(hdr2->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr2->payload_len) + sizeof(struct rte_ipv6_hdr); total_length3 = - rte_ntohs(hdr3->payload_len) + sizeof(struct ipv6_hdr); + rte_ntohs(hdr3->payload_len) + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index c8b2e19bf..2e807e805 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -151,7 +151,7 @@ static void process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv4_hdr *); + struct rte_ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct rte_ipv4_hdr *); /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); @@ -182,7 +182,7 @@ static void process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv6_hdr *); + struct rte_ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct rte_ipv6_hdr *); struct ipv6_extension_fragment *frag_hdr; uint16_t frag_data = 0; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index e8f3edc07..2960a5c8a 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -238,9 +238,9 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) /* IP cksum verification cannot be bypassed, then calculate here */ if (m_buf->ol_flags & PKT_TX_IP_CKSUM) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct rte_ipv4_hdr *, m_buf->l2_len); ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } @@ -966,8 +966,8 @@ virtio_net_with_host_offload(struct virtio_net *dev) static void parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; struct rte_ether_hdr *eth_hdr; uint16_t ethertype; @@ -997,7 +997,7 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) case RTE_ETHER_TYPE_IPv6: ipv6_hdr = l3_hdr; *l4_proto = ipv6_hdr->proto; - m->l3_len = sizeof(struct ipv6_hdr); + m->l3_len = sizeof(struct rte_ipv6_hdr); *l4_hdr = (char *)l3_hdr + m->l3_len; m->ol_flags |= PKT_TX_IPV6; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (10 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 10/14] net: add rte prefix to ip structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-22 16:05 ` Stephen Hemminger 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 12/14] net: add rte prefix to sctp structure Olivier Matz ` (4 subsequent siblings) 16 siblings, 2 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'RTE_' prefix to defines: - rename IPv4( as RTE_IPv4(. - rename IPV4_MAX_PKT_LEN as RTE_IPV4_MAX_PKT_LEN. - rename IPV4_HDR_IHL_MASK as RTE_IPV4_HDR_IHL_MASK. - rename IPV4_IHL_MULTIPLIER as RTE_IPV4_IHL_MULTIPLIER. - rename IPV4_HDR_DF_SHIFT as RTE_IPV4_HDR_DF_SHIFT. - rename IPV4_HDR_MF_SHIFT as RTE_IPV4_HDR_MF_SHIFT. - rename IPV4_HDR_FO_SHIFT as RTE_IPV4_HDR_FO_SHIFT. - rename IPV4_HDR_DF_FLAG as RTE_IPV4_HDR_DF_FLAG. - rename IPV4_HDR_MF_FLAG as RTE_IPV4_HDR_MF_FLAG. - rename IPV4_HDR_OFFSET_MASK as RTE_IPV4_HDR_OFFSET_MASK. - rename IPV4_HDR_OFFSET_UNITS as RTE_IPV4_HDR_OFFSET_UNITS. - rename IPV4_ANY as RTE_IPV4_ANY. - rename IPV4_LOOPBACK as RTE_IPV4_LOOPBACK. - rename IPV4_BROADCAST as RTE_IPV4_BROADCAST. - rename IPV4_ALLHOSTS_GROUP as RTE_IPV4_ALLHOSTS_GROUP. - rename IPV4_ALLRTRS_GROUP as RTE_IPV4_ALLRTRS_GROUP. - rename IPV4_MAX_LOCAL_GROUP as RTE_IPV4_MAX_LOCAL_GROUP. - rename IPV4_MIN_MCAST as RTE_IPV4_MIN_MCAST. - rename IPV4_MAX_MCAST as RTE_IPV4_MAX_MCAST. - rename IS_IPV4_MCAST as RTE_IS_IPV4_MCAST. - rename IPV6_HDR_FL_SHIFT as RTE_IPV6_HDR_FL_SHIFT. - rename IPV6_HDR_TC_SHIFT as RTE_IPV6_HDR_TC_SHIFT. - rename IPV6_HDR_FL_MASK as RTE_IPV6_HDR_FL_MASK. - rename IPV6_HDR_TC_MASK as RTE_IPV6_HDR_TC_MASK. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-acl/main.c | 2 +- app/test-pmd/cmdline_flow.c | 4 +- app/test-pmd/flowgen.c | 4 +- app/test-pmd/testpmd.c | 8 +- app/test/test_acl.c | 8 +- app/test/test_acl.h | 122 ++++++++++----------- app/test/test_efd.c | 20 ++-- app/test/test_flow_classify.c | 8 +- app/test/test_hash.c | 20 ++-- app/test/test_ipsec.c | 6 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_lpm.c | 76 ++++++------- app/test/test_lpm_perf.c | 10 +- app/test/test_member.c | 20 ++-- app/test/test_sched.c | 2 +- app/test/test_table_acl.c | 8 +- app/test/test_thash.c | 10 +- .../prog_guide/packet_classif_access_ctrl.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +-- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +-- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 4 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/i40e/i40e_flow.c | 4 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow_tcf.c | 16 +-- drivers/net/mlx5/mlx5_flow_verbs.c | 16 +-- drivers/net/tap/tap_bpf_program.c | 6 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 +- examples/flow_classify/flow_classify.c | 2 +- examples/ip_fragmentation/main.c | 16 +-- examples/ip_reassembly/main.c | 16 +-- examples/ipsec-secgw/sa.c | 4 +- examples/ipv4_multicast/main.c | 32 +++--- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 24 ++-- examples/l3fwd-vf/main.c | 24 ++-- examples/l3fwd/l3fwd_em.c | 20 ++-- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/performance-thread/l3fwd-thread/main.c | 32 +++--- lib/librte_gro/gro_tcp4.c | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 4 +- lib/librte_gso/gso_common.h | 4 +- lib/librte_ip_frag/rte_ip_frag.h | 4 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 16 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 8 +- lib/librte_net/rte_ip.h | 50 ++++----- lib/librte_net/rte_net.c | 6 +- lib/librte_port/rte_port_ras.c | 4 +- 50 files changed, 358 insertions(+), 358 deletions(-) diff --git a/app/test-acl/main.c b/app/test-acl/main.c index b80179417..eb6294396 100644 --- a/app/test-acl/main.c +++ b/app/test-acl/main.c @@ -625,7 +625,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index b1b9b26fd..2251e2d0a 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3522,12 +3522,12 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token, memcpy(&ipv6_mask_tos, &rte_flow_item_ipv6_mask, sizeof(ipv6_mask_tos)); ipv6_mask_tos.hdr.vtc_flow |= - RTE_BE32(0xfful << IPV6_HDR_TC_SHIFT); + RTE_BE32(0xfful << RTE_IPV6_HDR_TC_SHIFT); ipv6_mask_tos.hdr.hop_limits = 0xff; action_vxlan_encap_data->item_ipv6.hdr.vtc_flow |= rte_cpu_to_be_32 ((uint32_t)vxlan_encap_conf.ip_tos << - IPV6_HDR_TC_SHIFT); + RTE_IPV6_HDR_TC_SHIFT); action_vxlan_encap_data->item_ipv6.hdr.hop_limits = vxlan_encap_conf.ip_ttl; action_vxlan_encap_data->items[2].mask = diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 45a5e13e0..46fd6e41f 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -72,8 +72,8 @@ /* hardcoded configuration (for now) */ static unsigned cfg_n_flows = 1024; -static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); -static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); +static uint32_t cfg_ip_src = RTE_IPv4(10, 254, 0, 0); +static uint32_t cfg_ip_dst = RTE_IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; static struct rte_ether_addr cfg_ether_src = diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index b18e2685f..fb2e0f1ce 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -476,8 +476,8 @@ struct vxlan_encap_conf vxlan_encap_conf = { .vni = "\x00\x00\x00", .udp_src = 0, .udp_dst = RTE_BE16(4789), - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" @@ -493,8 +493,8 @@ struct nvgre_encap_conf nvgre_encap_conf = { .select_ipv4 = 1, .select_vlan = 0, .tni = "\x00\x00\x00", - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" diff --git a/app/test/test_acl.c b/app/test/test_acl.c index b1f75d1bc..8663ff031 100644 --- a/app/test/test_acl.c +++ b/app/test/test_acl.c @@ -515,15 +515,15 @@ test_build_ports_range(void) static struct ipv4_7tuple test_data[] = { { .proto = 6, - .ip_src = IPv4(10, 1, 1, 1), - .ip_dst = IPv4(192, 168, 0, 33), + .ip_src = RTE_IPv4(10, 1, 1, 1), + .ip_dst = RTE_IPv4(192, 168, 0, 33), .port_dst = 53, .allow = 1, }, { .proto = 6, - .ip_src = IPv4(127, 84, 33, 1), - .ip_dst = IPv4(1, 2, 3, 4), + .ip_src = RTE_IPv4(127, 84, 33, 1), + .ip_dst = RTE_IPv4(1, 2, 3, 4), .port_dst = 65281, .allow = 1, }, diff --git a/app/test/test_acl.h b/app/test/test_acl.h index bbb0447a8..b071f47c3 100644 --- a/app/test/test_acl.h +++ b/app/test/test_acl.h @@ -82,13 +82,13 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { { .data = {.userdata = 1, .category_mask = 1, .priority = 1}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 24, }, { .data = {.userdata = 2, .category_mask = 1, .priority = 1}, - .dst_addr = IPv4(10,0,0,0), + .dst_addr = RTE_IPv4(10,0,0,0), .dst_mask_len = 24, }, /* test src and dst ports */ @@ -124,8 +124,8 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { * results using the wrong data layout. */ struct ipv4_7tuple invalid_layout_data[] = { - {.ip_src = IPv4(10,0,1,0)}, /* should not match */ - {.ip_src = IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ + {.ip_src = RTE_IPv4(10,0,1,0)}, /* should not match */ + {.ip_src = RTE_IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ {.port_src = 100, .allow = 4}, /* should match 4 */ {.port_dst = 0xf, .allow = 6}, /* should match 6 */ }; @@ -142,7 +142,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 1, .category_mask = ACL_ALLOW_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,0,0), + .dst_addr = RTE_IPv4(192,168,0,0), .dst_mask_len = 16, .src_port_low = 0, .src_port_high = 0xffff, @@ -153,7 +153,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 2, .category_mask = ACL_ALLOW_MASK, .priority = 330}, - .dst_addr = IPv4(192,168,1,0), + .dst_addr = RTE_IPv4(192,168,1,0), .dst_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -164,7 +164,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 3, .category_mask = ACL_DENY_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,1,50), + .dst_addr = RTE_IPv4(192,168,1,50), .dst_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -177,7 +177,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 4, .category_mask = ACL_ALLOW_MASK, .priority = 240}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 8, .src_port_low = 0, .src_port_high = 0xffff, @@ -188,7 +188,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 5, .category_mask = ACL_ALLOW_MASK, .priority = 340}, - .src_addr = IPv4(10,1,1,0), + .src_addr = RTE_IPv4(10,1,1,0), .src_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -199,7 +199,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 6, .category_mask = ACL_DENY_MASK, .priority = 240}, - .src_addr = IPv4(10,1,1,1), + .src_addr = RTE_IPv4(10,1,1,1), .src_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -393,9 +393,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { .data = {.userdata = 24, .category_mask = ACL_ALLOW_MASK, .priority = 400}, /** make sure that unmasked bytes don't fail! */ - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 16, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 24, .proto = 0x5, .proto_mask = 0xff, @@ -411,9 +411,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 25, .category_mask = ACL_DENY_MASK, .priority = 400}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 24, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 16, .proto = 0x5, .proto_mask = 0xff, @@ -429,9 +429,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 26, .category_mask = ACL_ALLOW_MASK, .priority = 500}, - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 8, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 32, .proto = 0x5, .proto_mask = 0xff, @@ -445,9 +445,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 27, .category_mask = ACL_DENY_MASK, .priority = 500}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 32, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 8, .proto = 0x5, .proto_mask = 0xff, @@ -463,20 +463,20 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { /* data for ACL unit test */ struct ipv4_7tuple acl_test_data[] = { /* testing single rule aspects */ - {.ip_src = IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ - {.ip_src = IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ - {.ip_src = IPv4(10,1,1,1), .allow = 5, + {.ip_src = RTE_IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ + {.ip_src = RTE_IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ + {.ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 6}, /* should match 5, 6 */ - {.ip_dst = IPv4(10,0,0,0)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,2)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,1)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,0,0,0)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,2)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,1)}, /* should not match */ - {.ip_src = IPv4(192,168,2,50)}, /* should not match */ - {.ip_src = IPv4(192,168,1,2)}, /* should not match */ - {.ip_src = IPv4(192,168,1,50)}, /* should not match */ - {.ip_dst = IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ - {.ip_dst = IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ - {.ip_dst = IPv4(192,168,1,50), .allow = 2, + {.ip_src = RTE_IPv4(192,168,2,50)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,2)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,50)}, /* should not match */ + {.ip_dst = RTE_IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ + {.ip_dst = RTE_IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ + {.ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 3}, /* should match 2, 3 */ {.vlan = 0x64, .allow = 7}, /* should match 7 */ @@ -515,20 +515,20 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .allow = 22, .deny = 23}, /* should match 22, 23 */ /* testing matching multiple rules at once */ - {.vlan = 0x5, .ip_src = IPv4(10,1,1,1), + {.vlan = 0x5, .ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 9}, /* should match 5, 9 */ - {.vlan = 0x5, .ip_src = IPv4(192,168,2,50), + {.vlan = 0x5, .ip_src = RTE_IPv4(192,168,2,50), .allow = 8, .deny = 9}, /* should match 8, 9 */ - {.vlan = 0x55, .ip_src = IPv4(192,168,1,49), + {.vlan = 0x55, .ip_src = RTE_IPv4(192,168,1,49), .allow = 8}, /* should match 8 */ {.port_dst = 80, .port_src = 1024, .allow = 13, .deny = 20}, /* should match 13,20 */ {.port_dst = 79, .port_src = 1024, .allow = 14, .deny = 20}, /* should match 14,20 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,2,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,2,50), .allow = 1, .deny = 23}, /* should match 1, 23 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,1,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 23}, /* should match 2, 23 */ {.vlan = 0x64, .domain = 0x5, .allow = 11, .deny = 12}, /* should match 11, 12 */ @@ -537,16 +537,16 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .port_dst = 80, .allow = 13, .deny = 23}, /* should match 13, 23 */ {.proto = 0x51, .port_src = 5000}, /* should not match */ - {.ip_src = IPv4(192,168,1,50), - .ip_dst = IPv4(10,0,0,0), + {.ip_src = RTE_IPv4(192,168,1,50), + .ip_dst = RTE_IPv4(10,0,0,0), .proto = 0x51, .port_src = 5000, .port_dst = 5000}, /* should not match */ /* test full packet rules */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -556,8 +556,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 24 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -567,8 +567,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 25 }, /* should match 13, 25 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -577,8 +577,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 26 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -587,8 +587,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 27 }, /* should match 13, 27 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -597,8 +597,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 13, 23 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -610,8 +610,8 @@ struct ipv4_7tuple acl_test_data[] = { /* visual separator! */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x55, .vlan = 0x8000, .domain = 0x6464, @@ -620,8 +620,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x55, .vlan = 0x8100, .domain = 0x6464, @@ -630,8 +630,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -639,8 +639,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -648,8 +648,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -657,8 +657,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x50, .vlan = 0x6466, .port_src = 12345, diff --git a/app/test/test_efd.c b/app/test/test_efd.c index 93e8f1cbb..2868712bb 100644 --- a/app/test/test_efd.c +++ b/app/test/test_efd.c @@ -58,36 +58,36 @@ static void print_key_info(const char *msg, const struct flow_key *key, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 96e371691..ad6c481fe 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -95,7 +95,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" */ static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, IPv4(2, 2, 2, 3), IPv4(2, 2, 2, 7)} + { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, RTE_IPv4(2, 2, 2, 3), RTE_IPv4(2, 2, 2, 7)} }; static const struct rte_flow_item_ipv4 ipv4_mask_24 = { .hdr = { @@ -131,7 +131,7 @@ static struct rte_flow_item end_item_bad = { -1, 0, 0, 0 }; * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" */ static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, IPv4(1, 2, 3, 4), IPv4(5, 6, 7, 8)} + { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, RTE_IPv4(1, 2, 3, 4), RTE_IPv4(5, 6, 7, 8)} }; static struct rte_flow_item_tcp tcp_spec_1 = { @@ -149,8 +149,8 @@ static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" */ static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, IPv4(11, 12, 13, 14), - IPv4(15, 16, 17, 18)} + { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, RTE_IPv4(11, 12, 13, 14), + RTE_IPv4(15, 16, 17, 18)} }; static struct rte_flow_item_sctp sctp_spec_1 = { diff --git a/app/test/test_hash.c b/app/test/test_hash.c index 390fbef87..907e6f191 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -104,32 +104,32 @@ static void print_key_info(const char *msg, const struct flow_key *key, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 2cad4096c..343d933a9 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -536,11 +536,11 @@ const char null_encrypted_data[] = struct rte_ipv4_hdr ipv4_outer = { .version_ihl = IPVERSION << 4 | - sizeof(ipv4_outer) / IPV4_IHL_MULTIPLIER, + sizeof(ipv4_outer) / RTE_IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, .next_proto_id = IPPROTO_ESP, - .src_addr = IPv4(192, 168, 1, 100), - .dst_addr = IPv4(192, 168, 2, 100), + .src_addr = RTE_IPv4(192, 168, 1, 100), + .dst_addr = RTE_IPv4(192, 168, 2, 100), }; static struct rte_mbuf * diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index fba629d43..4968cd91c 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -728,8 +728,8 @@ generate_packets(struct rte_ether_addr *src_mac, uint16_t src_port = 10, dst_port = 20; - uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; - uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; + uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = RTE_IPv4(192, 168, 0, 1) }; + uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c index 5d697dd0f..0f24631ac 100644 --- a/app/test/test_lpm.c +++ b/app/test/test_lpm.c @@ -165,7 +165,7 @@ test3(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop = 100; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop = 100; uint8_t depth = 24; int32_t status = 0; @@ -203,7 +203,7 @@ test4(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0); + uint32_t ip = RTE_IPv4(0, 0, 0, 0); uint8_t depth = 24; int32_t status = 0; @@ -242,7 +242,7 @@ test5(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_return = 0; int32_t status = 0; /* rte_lpm_lookup: lpm == NULL */ @@ -276,7 +276,7 @@ test6(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 24; int32_t status = 0; @@ -315,7 +315,7 @@ test7(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 32; int32_t status = 0; @@ -366,7 +366,7 @@ test8(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip1 = IPv4(127, 255, 255, 255), ip2 = IPv4(128, 0, 0, 0); + uint32_t ip1 = RTE_IPv4(127, 255, 255, 255), ip2 = RTE_IPv4(128, 0, 0, 0); uint32_t next_hop_add, next_hop_return; uint8_t depth; int32_t status = 0; @@ -457,7 +457,7 @@ test9(void) int32_t status = 0; /* Add & lookup to hit invalid TBL24 entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -479,7 +479,7 @@ test9(void) rte_lpm_delete_all(lpm); /* Add & lookup to hit valid TBL24 entry not extended */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 23; next_hop_add = 100; @@ -515,7 +515,7 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with invalid TBL8 * entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -525,7 +525,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 5); + ip = RTE_IPv4(128, 0, 0, 5); depth = 32; next_hop_add = 101; @@ -541,7 +541,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -558,11 +558,11 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with valid TBL8 * entry */ - ip_1 = IPv4(128, 0, 0, 0); + ip_1 = RTE_IPv4(128, 0, 0, 0); depth_1 = 25; next_hop_add_1 = 101; - ip_2 = IPv4(128, 0, 0, 5); + ip_2 = RTE_IPv4(128, 0, 0, 5); depth_2 = 32; next_hop_add_2 = 102; @@ -629,7 +629,7 @@ test10(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 16; next_hop_add = 100; @@ -647,7 +647,7 @@ test10(void) rte_lpm_delete_all(lpm); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 25; next_hop_add = 100; @@ -665,14 +665,14 @@ test10(void) /* Add rule that extends a TBL24 valid entry & lookup for both rules * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -682,13 +682,13 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -697,7 +697,7 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -711,7 +711,7 @@ test10(void) /* Add rule that updates the next hop in TBL24 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -740,7 +740,7 @@ test10(void) /* Add rule that updates the next hop in TBL8 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -768,7 +768,7 @@ test10(void) /* Delete a rule that is not present in the TBL24 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -781,7 +781,7 @@ test10(void) /* Delete a rule that is not present in the TBL8 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -818,14 +818,14 @@ test11(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -835,13 +835,13 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -850,7 +850,7 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -889,7 +889,7 @@ test12(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -944,7 +944,7 @@ test13(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add_1 = 100; @@ -1014,10 +1014,10 @@ test14(void) depth = 32; next_hop_add = 100; - ip = IPv4(0, 0, 0, 0); + ip = RTE_IPv4(0, 0, 0, 0); /* Add 256 rules that require a tbl8 extension */ - for (; ip <= IPv4(0, 0, 255, 0); ip += 256) { + for (; ip <= RTE_IPv4(0, 0, 255, 0); ip += 256) { status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); @@ -1028,7 +1028,7 @@ test14(void) /* All tbl8 extensions have been used above. Try to add one more and * we get a fail */ - ip = IPv4(1, 0, 0, 0); + ip = RTE_IPv4(1, 0, 0, 0); depth = 32; status = rte_lpm_add(lpm, ip, depth, next_hop_add); @@ -1125,9 +1125,9 @@ test17(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - const uint32_t ip_10_32 = IPv4(10, 10, 10, 2); - const uint32_t ip_10_24 = IPv4(10, 10, 10, 0); - const uint32_t ip_20_25 = IPv4(10, 10, 20, 2); + const uint32_t ip_10_32 = RTE_IPv4(10, 10, 10, 2); + const uint32_t ip_10_24 = RTE_IPv4(10, 10, 10, 0); + const uint32_t ip_20_25 = RTE_IPv4(10, 10, 20, 2); const uint8_t d_ip_10_32 = 32, d_ip_10_24 = 24, d_ip_20_25 = 25; @@ -1221,7 +1221,7 @@ test18(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(192, 168, 100, 100); + ip = RTE_IPv4(192, 168, 100, 100); depth = 28; next_hop = 1; rte_lpm_add(lpm, ip, depth, next_hop); diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index 3b98ce0c8..b54650367 100644 --- a/app/test/test_lpm_perf.c +++ b/app/test/test_lpm_perf.c @@ -285,11 +285,11 @@ static void generate_large_route_rule_table(void) * they are 4 rules with private local IP address and 1 all-zeros prefix * with depth = 8. */ - insert_rule_in_random_pos(IPv4(0, 0, 0, 0), 8); - insert_rule_in_random_pos(IPv4(10, 2, 23, 147), 32); - insert_rule_in_random_pos(IPv4(192, 168, 100, 10), 24); - insert_rule_in_random_pos(IPv4(192, 168, 25, 100), 24); - insert_rule_in_random_pos(IPv4(192, 168, 129, 124), 32); + insert_rule_in_random_pos(RTE_IPv4(0, 0, 0, 0), 8); + insert_rule_in_random_pos(RTE_IPv4(10, 2, 23, 147), 32); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 100, 10), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 25, 100), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 129, 124), 32); } static void diff --git a/app/test/test_member.c b/app/test/test_member.c index e2a3932f2..53287fcaf 100644 --- a/app/test/test_member.c +++ b/app/test/test_member.c @@ -41,36 +41,36 @@ struct flow_key { /* Keys used by unit test functions */ static struct flow_key keys[NUM_SAMPLES] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 4781c2307..628cf147d 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -92,7 +92,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(RTE_ETHER_TYPE_IPv4); - ip_hdr->dst_addr = IPv4(0,0,TC,QUEUE); + ip_hdr->dst_addr = RTE_IPv4(0,0,TC,QUEUE); rte_sched_port_pkt_write(port, mbuf, SUBPORT, PIPE, TC, QUEUE, diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c index 22136a396..e01e1f946 100644 --- a/app/test/test_table_acl.c +++ b/app/test/test_table_acl.c @@ -7,7 +7,7 @@ #include "test_table.h" #include "test_table_acl.h" -#define IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -116,7 +116,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; @@ -662,8 +662,8 @@ test_pipeline_single_filter(int expected_count) sizeof(struct ipv4_5tuple)); five_tuple.proto = j; - five_tuple.ip_src = rte_bswap32(IPv4(192, 168, j, 1)); - five_tuple.ip_dst = rte_bswap32(IPv4(10, 4, j, 1)); + five_tuple.ip_src = rte_bswap32(RTE_IPv4(192, 168, j, 1)); + five_tuple.ip_dst = rte_bswap32(RTE_IPv4(10, 4, j, 1)); five_tuple.port_src = rte_bswap16(100 + j); five_tuple.port_dst = rte_bswap16(200 + j); diff --git a/app/test/test_thash.c b/app/test/test_thash.c index bf332c9e9..3724ea5be 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -59,15 +59,15 @@ struct test_thash_v6 { /*From 82599 Datasheet 7.1.2.8.3 RSS Verification Suite*/ struct test_thash_v4 v4_tbl[] = { -{IPv4(161, 142, 100, 80), IPv4(66, 9, 149, 187), +{RTE_IPv4(161, 142, 100, 80), RTE_IPv4(66, 9, 149, 187), 1766, 2794, 0x323e8fc2, 0x51ccc178}, -{IPv4(65, 69, 140, 83), IPv4(199, 92, 111, 2), +{RTE_IPv4(65, 69, 140, 83), RTE_IPv4(199, 92, 111, 2), 4739, 14230, 0xd718262a, 0xc626b0ea}, -{IPv4(12, 22, 207, 184), IPv4(24, 19, 198, 95), +{RTE_IPv4(12, 22, 207, 184), RTE_IPv4(24, 19, 198, 95), 38024, 12898, 0xd2d0a5de, 0x5c2b394a}, -{IPv4(209, 142, 163, 6), IPv4(38, 27, 205, 30), +{RTE_IPv4(209, 142, 163, 6), RTE_IPv4(38, 27, 205, 30), 2217, 48228, 0x82989176, 0xafc7327f}, -{IPv4(202, 188, 127, 2), IPv4(153, 39, 163, 191), +{RTE_IPv4(202, 188, 127, 2), RTE_IPv4(153, 39, 163, 191), 1303, 44251, 0x5d1809c5, 0x10e828a2}, }; diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 6887e4dc6..010ec045d 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -419,7 +419,7 @@ Classify with Multiple Categories .data = {.userdata = 1, .category_mask = 3, .priority = 1}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,0,0),. mask_range.u32 = 16,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,0,0),. mask_range.u32 = 16,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -433,7 +433,7 @@ Classify with Multiple Categories .data = {.userdata = 2, .category_mask = 1, .priority = 2}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,1,0),. mask_range.u32 = 24,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,1,0),. mask_range.u32 = 24,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -447,7 +447,7 @@ Classify with Multiple Categories .data = {.userdata = 3, .category_mask = 2, .priority = 3}, /* source IPv4 */ - .field[1] = {.value.u32 = IPv4(10,1,1,1),. mask_range.u32 = 32,}, + .field[1] = {.value.u32 = RTE_IPv4(10,1,1,1),. mask_range.u32 = 32,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, diff --git a/doc/guides/sample_app_ug/ip_frag.rst b/doc/guides/sample_app_ug/ip_frag.rst index 2583f0c3d..49ba0d8bc 100644 --- a/doc/guides/sample_app_ug/ip_frag.rst +++ b/doc/guides/sample_app_ug/ip_frag.rst @@ -104,14 +104,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ip_reassembly.rst b/doc/guides/sample_app_ug/ip_reassembly.rst index a628b63cb..99dcd9556 100644 --- a/doc/guides/sample_app_ug/ip_reassembly.rst +++ b/doc/guides/sample_app_ug/ip_reassembly.rst @@ -107,14 +107,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 46c920433..ea7902b2d 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -155,7 +155,7 @@ if the routing table has any ports assigned to the destination address: .. code-block:: c - if (!IS_IPV4_MCAST(dest_addr) || + if (!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index c7fcd9b8e..66ed885fa 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -857,8 +857,8 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, if (likely(rte_ipv4_frag_pkt_is_fragmented(ipv4_hdr) == 0)) { ip_hdr_offset = (ipv4_hdr->version_ihl - & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { tcp_hdr = (struct tcp_hdr *) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 469d7aaf6..3671b3876 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2157,7 +2157,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); - if ((frag_field & IPV4_HDR_DF_FLAG) != 0) { + if ((frag_field & RTE_IPV4_HDR_DF_FLAG) != 0) { m->packet_type |= RTE_PTYPE_L4_NONFRAG; /* If IPv4 header has DF flag enabled and TSO support is diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index eab451447..e4b5bbb2d 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2607,8 +2607,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, /* Check if it is fragment. */ frag_off = ipv4_spec->hdr.fragment_offset; frag_off = rte_be_to_cpu_16(frag_off); - if (frag_off & IPV4_HDR_OFFSET_MASK || - frag_off & IPV4_HDR_MF_FLAG) + if (frag_off & RTE_IPV4_HDR_OFFSET_MASK || + frag_off & RTE_IPV4_HDR_MF_FLAG) pctype = I40E_FILTER_PCTYPE_FRAG_IPV4; /* Get the filter info */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 5b7953a7f..217340e59 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4537,7 +4537,7 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool) /* MAXDESC * SRRCTL.BSIZEPKT must not exceed 64 KB minus one */ uint16_t maxdesc = - IPV4_MAX_PKT_LEN / + RTE_IPV4_MAX_PKT_LEN / (mp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM); if (maxdesc >= 16) diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index dd5a090af..743ae8546 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -552,7 +552,7 @@ static const struct { }, .ipv6.hdr = { .proto = 0xff, - .vtc_flow = RTE_BE32(0xfful << IPV6_HDR_FL_SHIFT), + .vtc_flow = RTE_BE32(0xfful << RTE_IPV6_HDR_FL_SHIFT), .hop_limits = 0xff, .src_addr = "\xff\xff\xff\xff\xff\xff\xff\xff" @@ -1426,7 +1426,7 @@ flow_tcf_validate_vxlan_encap_ipv6(const struct rte_flow_item *item, " vxlan encapsulation"); } msk6 = (rte_be_to_cpu_32(mask->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; if (msk6 && msk6 != 0xff) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM_MASK, mask, @@ -2551,7 +2551,7 @@ flow_tcf_get_items_size(const struct rte_flow_attr *attr, if (ipv6 && ipv6->hdr.hop_limits) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; if (ipv6 && (rte_be_to_cpu_32(ipv6->hdr.vtc_flow) & - (0xfful << IPV6_HDR_TC_SHIFT))) + (0xfful << RTE_IPV6_HDR_TC_SHIFT))) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; break; } @@ -2639,7 +2639,7 @@ flow_tcf_vxlan_encap_size(const struct rte_flow_action *action) if (ipv6 && ipv6->hdr.hop_limits) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; if (ipv6 && (rte_be_to_cpu_32(ipv6->hdr.vtc_flow) & - (0xfful << IPV6_HDR_TC_SHIFT))) + (0xfful << RTE_IPV6_HDR_TC_SHIFT))) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; break; } @@ -3037,11 +3037,11 @@ flow_tcf_parse_vxlan_encap_ipv6(const struct rte_flow_item_ipv6 *spec, FLOW_TCF_ENCAP_IPV6_DST; if (mask) { if ((rte_be_to_cpu_32(mask->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff) { + RTE_IPV6_HDR_TC_SHIFT) & 0xff) { encap->mask |= FLOW_TCF_ENCAP_IP_TOS; encap->ip_tos = (rte_be_to_cpu_32 (spec->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; } if (mask->hdr.hop_limits) { encap->mask |= FLOW_TCF_ENCAP_IP_TTL; @@ -3590,11 +3590,11 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, mask.ipv6->hdr.hop_limits); } msk6 = (rte_be_to_cpu_32(mask.ipv6->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; if (msk6) { tos6 = (rte_be_to_cpu_32 (spec.ipv6->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; mnl_attr_put_u8 (nlh, tunnel_outer ? TCA_FLOWER_KEY_ENC_IP_TOS : diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 252febf35..e9913d670 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -476,17 +476,17 @@ flow_verbs_translate_item_ipv6(struct mlx5_flow *dev_flow, vtc_flow_val = rte_be_to_cpu_32(spec->hdr.vtc_flow); vtc_flow_mask = rte_be_to_cpu_32(mask->hdr.vtc_flow); ipv6.val.flow_label = - rte_cpu_to_be_32((vtc_flow_val & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.val.traffic_class = (vtc_flow_val & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_val & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.val.traffic_class = (vtc_flow_val & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.val.next_hdr = spec->hdr.proto; ipv6.val.hop_limit = spec->hdr.hop_limits; ipv6.mask.flow_label = - rte_cpu_to_be_32((vtc_flow_mask & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.mask.traffic_class = (vtc_flow_mask & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_mask & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.mask.traffic_class = (vtc_flow_mask & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.mask.next_hdr = mask->hdr.proto; ipv6.mask.hop_limit = mask->hdr.hop_limits; /* Remove unwanted bits from values. */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index 2b1dba15b..531569b12 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -19,7 +19,7 @@ #include "tap_rss.h" /** Create IPv4 address */ -#define IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -157,11 +157,11 @@ rss_l3_l4(struct __sk_buff *skb) __u8 *src_dst_addr = data + off + offsetof(struct iphdr, saddr); __u8 *src_dst_port = data + off + sizeof(struct iphdr); struct ipv4_l3_l4_tuple v4_tuple = { - .src_addr = IPv4(*(src_dst_addr + 0), + .src_addr = RTE_IPv4(*(src_dst_addr + 0), *(src_dst_addr + 1), *(src_dst_addr + 2), *(src_dst_addr + 3)), - .dst_addr = IPv4(*(src_dst_addr + 4), + .dst_addr = RTE_IPv4(*(src_dst_addr + 4), *(src_dst_addr + 5), *(src_dst_addr + 6), *(src_dst_addr + 7)), diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 7749458e4..949798c39 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -684,8 +684,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, - sizeof(struct tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); - hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index c75a410f4..e68d0f694 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -379,7 +379,7 @@ parse_ipv4_net(char *in, uint32_t *addr, uint32_t *mask_len) if (get_cb_field(&in, &m, 0, sizeof(uint32_t) * CHAR_BIT, 0)) return -EINVAL; - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; } diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 9c8a0a9b9..ba6e29c31 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -168,14 +168,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 00a95e07a..97c499425 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -190,14 +190,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 1d0020567..ef63f59d5 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -951,7 +951,7 @@ get_spi_proto(uint32_t spi, enum rte_security_ipsec_sa_direction dir) if (rc6 >= 0) { RTE_LOG(ERR, IPSEC, "%s: SPI %u used simultaeously by " - "IPv4(%d) and IPv6 (%d) SP rules\n", + "RTE_IPv4(%d) and IPv6 (%d) SP rules\n", __func__, spi, rc4, rc6); return -EINVAL; } else @@ -1040,7 +1040,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) struct rte_ipsec_sa_prm prm; struct rte_ipv4_hdr v4 = { .version_ihl = IPVERSION << 4 | - sizeof(v4) / IPV4_IHL_MULTIPLIER, + sizeof(v4) / RTE_IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, .next_proto_id = IPPROTO_ESP, .src_addr = lsa->src.ip.ip4, diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 259c0d19e..6bad6a92d 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -138,21 +138,21 @@ struct mcast_group_params { }; static struct mcast_group_params mcast_group_table[] = { - {IPv4(224,0,0,101), 0x1}, - {IPv4(224,0,0,102), 0x2}, - {IPv4(224,0,0,103), 0x3}, - {IPv4(224,0,0,104), 0x4}, - {IPv4(224,0,0,105), 0x5}, - {IPv4(224,0,0,106), 0x6}, - {IPv4(224,0,0,107), 0x7}, - {IPv4(224,0,0,108), 0x8}, - {IPv4(224,0,0,109), 0x9}, - {IPv4(224,0,0,110), 0xA}, - {IPv4(224,0,0,111), 0xB}, - {IPv4(224,0,0,112), 0xC}, - {IPv4(224,0,0,113), 0xD}, - {IPv4(224,0,0,114), 0xE}, - {IPv4(224,0,0,115), 0xF}, + {RTE_IPv4(224,0,0,101), 0x1}, + {RTE_IPv4(224,0,0,102), 0x2}, + {RTE_IPv4(224,0,0,103), 0x3}, + {RTE_IPv4(224,0,0,104), 0x4}, + {RTE_IPv4(224,0,0,105), 0x5}, + {RTE_IPv4(224,0,0,106), 0x6}, + {RTE_IPv4(224,0,0,107), 0x7}, + {RTE_IPv4(224,0,0,108), 0x8}, + {RTE_IPv4(224,0,0,109), 0x9}, + {RTE_IPv4(224,0,0,110), 0xA}, + {RTE_IPv4(224,0,0,111), 0xB}, + {RTE_IPv4(224,0,0,112), 0xC}, + {RTE_IPv4(224,0,0,113), 0xD}, + {RTE_IPv4(224,0,0,114), 0xE}, + {RTE_IPv4(224,0,0,115), 0xF}, }; #define N_MCAST_GROUPS \ @@ -315,7 +315,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) * Check that it is a valid multicast address and * we have some active ports assigned to it. */ - if(!IS_IPV4_MCAST(dest_addr) || + if(!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 06f5d1db1..afc658e5d 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -404,8 +404,8 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); - ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) - * IPV4_IHL_MULTIPLIER; + ipdata_offset += (ip_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) + * RTE_IPV4_IHL_MULTIPLIER; /* Zero pad data to be crypto'd so it is block aligned */ diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index b0e933e03..bad6aae8c 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -897,7 +897,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 91f144605..959925e73 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -258,10 +258,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -300,14 +300,14 @@ struct ipv4_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define IPV4_L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index ebb2378dd..5e3809b8d 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -201,10 +201,10 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; typedef struct rte_hash lookup_struct_t; @@ -234,14 +234,14 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index fb55e196d..b0e08f842 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -99,10 +99,10 @@ struct ipv6_l3fwd_em_route { }; static struct ipv4_l3fwd_em_route ipv4_l3fwd_em_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_em_route ipv6_l3fwd_em_route_array[] = { @@ -424,19 +424,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_em_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_em_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_em_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_em_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); @@ -574,8 +574,8 @@ em_parse_ptype(struct rte_mbuf *m) l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr = (struct rte_ipv4_hdr *)l3; - hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hdr_len = (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 881b0c7c0..de9fd9ab3 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -40,14 +40,14 @@ struct ipv6_l3fwd_lpm_route { }; static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = { diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index da5c66203..9b5684ea6 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -380,10 +380,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -503,14 +503,14 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -3134,19 +3134,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index c37b4ef3e..20f2ea7e6 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -239,7 +239,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index a9bdf1d72..d26aa95b4 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -347,11 +347,11 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(outer_ipv4_hdr->fragment_offset); - outer_is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + outer_is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; outer_ip_id = outer_is_atomic ? 0 : rte_be_to_cpu_16(outer_ipv4_hdr->packet_id); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 5f2adc833..13c9aeea8 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -12,8 +12,8 @@ #include <rte_tcp.h> #include <rte_udp.h> -#define IS_FRAGMENTED(frag_off) (((frag_off) & IPV4_HDR_OFFSET_MASK) != 0 \ - || ((frag_off) & IPV4_HDR_MF_FLAG) == IPV4_HDR_MF_FLAG) +#define IS_FRAGMENTED(frag_off) (((frag_off) & RTE_IPV4_HDR_OFFSET_MASK) != 0 \ + || ((frag_off) & RTE_IPV4_HDR_MF_FLAG) == RTE_IPV4_HDR_MF_FLAG) #define TCP_HDR_PSH_MASK ((uint8_t)0x08) #define TCP_HDR_FIN_MASK ((uint8_t)0x01) diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 60c0300e8..73cf553be 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -308,8 +308,8 @@ rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); return ip_flag != 0 || ip_ofs != 0; } diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index 2c781724a..f7c956ee1 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -12,22 +12,22 @@ #include "ip_frag_common.h" /* Fragment Offset */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_MASK (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_MASK (1 << IPV4_HDR_MF_SHIFT) +#define IPV4_HDR_DF_MASK (1 << RTE_IPV4_HDR_DF_SHIFT) +#define IPV4_HDR_MF_MASK (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) +#define IPV4_HDR_FO_ALIGN (1 << RTE_IPV4_HDR_FO_SHIFT) static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); - fofs = (uint16_t)(fofs + (dofs >> IPV4_HDR_FO_SHIFT)); - fofs = (uint16_t)(fofs | mf << IPV4_HDR_MF_SHIFT); + fofs = (uint16_t)(fofs + (dofs >> RTE_IPV4_HDR_FO_SHIFT)); + fofs = (uint16_t)(fofs | mf << RTE_IPV4_HDR_MF_SHIFT); dst->fragment_offset = rte_cpu_to_be_16(fofs); dst->total_length = rte_cpu_to_be_16(len); dst->hdr_checksum = 0; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 97da607ed..b7b92ed28 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -75,7 +75,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_DF_FLAG)); + rte_cpu_to_be_16(RTE_IPV4_HDR_DF_FLAG)); ip_hdr->hdr_checksum = 0; return m; @@ -109,8 +109,8 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, int32_t ip_len; flag_offset = rte_be_to_cpu_16(ip_hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); psd = (unaligned_uint64_t *)&ip_hdr->src_addr; /* use first 8 bytes only */ @@ -118,7 +118,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, key.id = ip_hdr->packet_id; key.key_len = IPV4_KEYLEN; - ip_ofs *= IPV4_HDR_OFFSET_UNITS; + ip_ofs *= RTE_IPV4_HDR_OFFSET_UNITS; ip_len = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len; IP_FRAG_LOG(DEBUG, "%s:%d:\n" diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index a1431ee90..75dfb528d 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -42,52 +42,52 @@ struct rte_ipv4_hdr { } __attribute__((__packed__)); /** Create IPv4 address */ -#define IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) /** Maximal IPv4 packet length (including a header) */ -#define IPV4_MAX_PKT_LEN 65535 +#define RTE_IPV4_MAX_PKT_LEN 65535 /** Internet header length mask for version_ihl field */ -#define IPV4_HDR_IHL_MASK (0x0f) +#define RTE_IPV4_HDR_IHL_MASK (0x0f) /** * Internet header length field multiplier (IHL field specifies overall header * length in number of 4-byte words) */ -#define IPV4_IHL_MULTIPLIER (4) +#define RTE_IPV4_IHL_MULTIPLIER (4) /* Fragment Offset * Flags. */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_FLAG (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_FLAG (1 << IPV4_HDR_MF_SHIFT) +#define RTE_IPV4_HDR_DF_FLAG (1 << RTE_IPV4_HDR_DF_SHIFT) +#define RTE_IPV4_HDR_MF_FLAG (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_OFFSET_MASK ((1 << IPV4_HDR_MF_SHIFT) - 1) +#define RTE_IPV4_HDR_OFFSET_MASK ((1 << RTE_IPV4_HDR_MF_SHIFT) - 1) -#define IPV4_HDR_OFFSET_UNITS 8 +#define RTE_IPV4_HDR_OFFSET_UNITS 8 /* * IPv4 address types */ -#define IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ -#define IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ -#define IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ -#define IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ -#define IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ -#define IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ +#define RTE_IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ +#define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ +#define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ +#define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ +#define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ +#define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ /* * IPv4 Multicast-related macros */ -#define IPV4_MIN_MCAST IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ -#define IPV4_MAX_MCAST IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ +#define RTE_IPV4_MIN_MCAST RTE_IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ +#define RTE_IPV4_MAX_MCAST RTE_IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ -#define IS_IPV4_MCAST(x) \ - ((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ +#define RTE_IS_IPV4_MCAST(x) \ + ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ /** * @internal Calculate a sum of all words in the buffer. @@ -349,10 +349,10 @@ struct rte_ipv6_hdr { } __attribute__((__packed__)); /* IPv6 vtc_flow: IPv / TC / flow_label */ -#define IPV6_HDR_FL_SHIFT 0 -#define IPV6_HDR_TC_SHIFT 20 -#define IPV6_HDR_FL_MASK ((1u << IPV6_HDR_TC_SHIFT) - 1) -#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT) +#define RTE_IPV6_HDR_FL_SHIFT 0 +#define RTE_IPV6_HDR_TC_SHIFT 20 +#define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1) +#define RTE_IPV6_HDR_TC_MASK (0xf << RTE_IPV6_HDR_TC_SHIFT) /** * Process the pseudo-header checksum of an IPv6 header. diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index b01cacb9c..712383484 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -315,7 +315,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (ip4h->fragment_offset & rte_cpu_to_be_16( - IPV4_HDR_OFFSET_MASK | IPV4_HDR_MF_FLAG)) { + RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_L4_FRAG; hdr_lens->l4_len = 0; return pkt_type; @@ -446,8 +446,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_INNER_L4_MASK) == 0) return pkt_type; if (ip4h->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_OFFSET_MASK | - IPV4_HDR_MF_FLAG)) { + rte_cpu_to_be_16(RTE_IPV4_HDR_OFFSET_MASK | + RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_INNER_L4_FRAG; hdr_lens->inner_l4_len = 0; return pkt_type; diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index 2e807e805..0d02f97e5 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -155,8 +155,8 @@ process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); - uint16_t frag_offset = (uint16_t)(frag_field & IPV4_HDR_OFFSET_MASK); - uint16_t frag_flag = (uint16_t)(frag_field & IPV4_HDR_MF_FLAG); + uint16_t frag_offset = (uint16_t)(frag_field & RTE_IPV4_HDR_OFFSET_MASK); + uint16_t frag_flag = (uint16_t)(frag_field & RTE_IPV4_HDR_MF_FLAG); /* If it is a fragmented packet, then try to reassemble */ if ((frag_flag == 0) && (frag_offset == 0)) -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-22 16:05 ` Stephen Hemminger 1 sibling, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'RTE_' prefix to defines: - rename IPv4( as RTE_IPv4(. - rename IPV4_MAX_PKT_LEN as RTE_IPV4_MAX_PKT_LEN. - rename IPV4_HDR_IHL_MASK as RTE_IPV4_HDR_IHL_MASK. - rename IPV4_IHL_MULTIPLIER as RTE_IPV4_IHL_MULTIPLIER. - rename IPV4_HDR_DF_SHIFT as RTE_IPV4_HDR_DF_SHIFT. - rename IPV4_HDR_MF_SHIFT as RTE_IPV4_HDR_MF_SHIFT. - rename IPV4_HDR_FO_SHIFT as RTE_IPV4_HDR_FO_SHIFT. - rename IPV4_HDR_DF_FLAG as RTE_IPV4_HDR_DF_FLAG. - rename IPV4_HDR_MF_FLAG as RTE_IPV4_HDR_MF_FLAG. - rename IPV4_HDR_OFFSET_MASK as RTE_IPV4_HDR_OFFSET_MASK. - rename IPV4_HDR_OFFSET_UNITS as RTE_IPV4_HDR_OFFSET_UNITS. - rename IPV4_ANY as RTE_IPV4_ANY. - rename IPV4_LOOPBACK as RTE_IPV4_LOOPBACK. - rename IPV4_BROADCAST as RTE_IPV4_BROADCAST. - rename IPV4_ALLHOSTS_GROUP as RTE_IPV4_ALLHOSTS_GROUP. - rename IPV4_ALLRTRS_GROUP as RTE_IPV4_ALLRTRS_GROUP. - rename IPV4_MAX_LOCAL_GROUP as RTE_IPV4_MAX_LOCAL_GROUP. - rename IPV4_MIN_MCAST as RTE_IPV4_MIN_MCAST. - rename IPV4_MAX_MCAST as RTE_IPV4_MAX_MCAST. - rename IS_IPV4_MCAST as RTE_IS_IPV4_MCAST. - rename IPV6_HDR_FL_SHIFT as RTE_IPV6_HDR_FL_SHIFT. - rename IPV6_HDR_TC_SHIFT as RTE_IPV6_HDR_TC_SHIFT. - rename IPV6_HDR_FL_MASK as RTE_IPV6_HDR_FL_MASK. - rename IPV6_HDR_TC_MASK as RTE_IPV6_HDR_TC_MASK. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-acl/main.c | 2 +- app/test-pmd/cmdline_flow.c | 4 +- app/test-pmd/flowgen.c | 4 +- app/test-pmd/testpmd.c | 8 +- app/test/test_acl.c | 8 +- app/test/test_acl.h | 122 ++++++++++----------- app/test/test_efd.c | 20 ++-- app/test/test_flow_classify.c | 8 +- app/test/test_hash.c | 20 ++-- app/test/test_ipsec.c | 6 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_lpm.c | 76 ++++++------- app/test/test_lpm_perf.c | 10 +- app/test/test_member.c | 20 ++-- app/test/test_sched.c | 2 +- app/test/test_table_acl.c | 8 +- app/test/test_thash.c | 10 +- .../prog_guide/packet_classif_access_ctrl.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +-- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +-- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 4 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/i40e/i40e_flow.c | 4 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow_tcf.c | 16 +-- drivers/net/mlx5/mlx5_flow_verbs.c | 16 +-- drivers/net/tap/tap_bpf_program.c | 6 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 +- examples/flow_classify/flow_classify.c | 2 +- examples/ip_fragmentation/main.c | 16 +-- examples/ip_reassembly/main.c | 16 +-- examples/ipsec-secgw/sa.c | 4 +- examples/ipv4_multicast/main.c | 32 +++--- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 24 ++-- examples/l3fwd-vf/main.c | 24 ++-- examples/l3fwd/l3fwd_em.c | 20 ++-- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/performance-thread/l3fwd-thread/main.c | 32 +++--- lib/librte_gro/gro_tcp4.c | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 4 +- lib/librte_gso/gso_common.h | 4 +- lib/librte_ip_frag/rte_ip_frag.h | 4 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 16 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 8 +- lib/librte_net/rte_ip.h | 50 ++++----- lib/librte_net/rte_net.c | 6 +- lib/librte_port/rte_port_ras.c | 4 +- 50 files changed, 358 insertions(+), 358 deletions(-) diff --git a/app/test-acl/main.c b/app/test-acl/main.c index b80179417..eb6294396 100644 --- a/app/test-acl/main.c +++ b/app/test-acl/main.c @@ -625,7 +625,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index b1b9b26fd..2251e2d0a 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3522,12 +3522,12 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token, memcpy(&ipv6_mask_tos, &rte_flow_item_ipv6_mask, sizeof(ipv6_mask_tos)); ipv6_mask_tos.hdr.vtc_flow |= - RTE_BE32(0xfful << IPV6_HDR_TC_SHIFT); + RTE_BE32(0xfful << RTE_IPV6_HDR_TC_SHIFT); ipv6_mask_tos.hdr.hop_limits = 0xff; action_vxlan_encap_data->item_ipv6.hdr.vtc_flow |= rte_cpu_to_be_32 ((uint32_t)vxlan_encap_conf.ip_tos << - IPV6_HDR_TC_SHIFT); + RTE_IPV6_HDR_TC_SHIFT); action_vxlan_encap_data->item_ipv6.hdr.hop_limits = vxlan_encap_conf.ip_ttl; action_vxlan_encap_data->items[2].mask = diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 45a5e13e0..46fd6e41f 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -72,8 +72,8 @@ /* hardcoded configuration (for now) */ static unsigned cfg_n_flows = 1024; -static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); -static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); +static uint32_t cfg_ip_src = RTE_IPv4(10, 254, 0, 0); +static uint32_t cfg_ip_dst = RTE_IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; static struct rte_ether_addr cfg_ether_src = diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index b18e2685f..fb2e0f1ce 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -476,8 +476,8 @@ struct vxlan_encap_conf vxlan_encap_conf = { .vni = "\x00\x00\x00", .udp_src = 0, .udp_dst = RTE_BE16(4789), - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" @@ -493,8 +493,8 @@ struct nvgre_encap_conf nvgre_encap_conf = { .select_ipv4 = 1, .select_vlan = 0, .tni = "\x00\x00\x00", - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" diff --git a/app/test/test_acl.c b/app/test/test_acl.c index b1f75d1bc..8663ff031 100644 --- a/app/test/test_acl.c +++ b/app/test/test_acl.c @@ -515,15 +515,15 @@ test_build_ports_range(void) static struct ipv4_7tuple test_data[] = { { .proto = 6, - .ip_src = IPv4(10, 1, 1, 1), - .ip_dst = IPv4(192, 168, 0, 33), + .ip_src = RTE_IPv4(10, 1, 1, 1), + .ip_dst = RTE_IPv4(192, 168, 0, 33), .port_dst = 53, .allow = 1, }, { .proto = 6, - .ip_src = IPv4(127, 84, 33, 1), - .ip_dst = IPv4(1, 2, 3, 4), + .ip_src = RTE_IPv4(127, 84, 33, 1), + .ip_dst = RTE_IPv4(1, 2, 3, 4), .port_dst = 65281, .allow = 1, }, diff --git a/app/test/test_acl.h b/app/test/test_acl.h index bbb0447a8..b071f47c3 100644 --- a/app/test/test_acl.h +++ b/app/test/test_acl.h @@ -82,13 +82,13 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { { .data = {.userdata = 1, .category_mask = 1, .priority = 1}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 24, }, { .data = {.userdata = 2, .category_mask = 1, .priority = 1}, - .dst_addr = IPv4(10,0,0,0), + .dst_addr = RTE_IPv4(10,0,0,0), .dst_mask_len = 24, }, /* test src and dst ports */ @@ -124,8 +124,8 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { * results using the wrong data layout. */ struct ipv4_7tuple invalid_layout_data[] = { - {.ip_src = IPv4(10,0,1,0)}, /* should not match */ - {.ip_src = IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ + {.ip_src = RTE_IPv4(10,0,1,0)}, /* should not match */ + {.ip_src = RTE_IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ {.port_src = 100, .allow = 4}, /* should match 4 */ {.port_dst = 0xf, .allow = 6}, /* should match 6 */ }; @@ -142,7 +142,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 1, .category_mask = ACL_ALLOW_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,0,0), + .dst_addr = RTE_IPv4(192,168,0,0), .dst_mask_len = 16, .src_port_low = 0, .src_port_high = 0xffff, @@ -153,7 +153,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 2, .category_mask = ACL_ALLOW_MASK, .priority = 330}, - .dst_addr = IPv4(192,168,1,0), + .dst_addr = RTE_IPv4(192,168,1,0), .dst_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -164,7 +164,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 3, .category_mask = ACL_DENY_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,1,50), + .dst_addr = RTE_IPv4(192,168,1,50), .dst_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -177,7 +177,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 4, .category_mask = ACL_ALLOW_MASK, .priority = 240}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 8, .src_port_low = 0, .src_port_high = 0xffff, @@ -188,7 +188,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 5, .category_mask = ACL_ALLOW_MASK, .priority = 340}, - .src_addr = IPv4(10,1,1,0), + .src_addr = RTE_IPv4(10,1,1,0), .src_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -199,7 +199,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 6, .category_mask = ACL_DENY_MASK, .priority = 240}, - .src_addr = IPv4(10,1,1,1), + .src_addr = RTE_IPv4(10,1,1,1), .src_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -393,9 +393,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { .data = {.userdata = 24, .category_mask = ACL_ALLOW_MASK, .priority = 400}, /** make sure that unmasked bytes don't fail! */ - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 16, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 24, .proto = 0x5, .proto_mask = 0xff, @@ -411,9 +411,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 25, .category_mask = ACL_DENY_MASK, .priority = 400}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 24, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 16, .proto = 0x5, .proto_mask = 0xff, @@ -429,9 +429,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 26, .category_mask = ACL_ALLOW_MASK, .priority = 500}, - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 8, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 32, .proto = 0x5, .proto_mask = 0xff, @@ -445,9 +445,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 27, .category_mask = ACL_DENY_MASK, .priority = 500}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 32, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 8, .proto = 0x5, .proto_mask = 0xff, @@ -463,20 +463,20 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { /* data for ACL unit test */ struct ipv4_7tuple acl_test_data[] = { /* testing single rule aspects */ - {.ip_src = IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ - {.ip_src = IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ - {.ip_src = IPv4(10,1,1,1), .allow = 5, + {.ip_src = RTE_IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ + {.ip_src = RTE_IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ + {.ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 6}, /* should match 5, 6 */ - {.ip_dst = IPv4(10,0,0,0)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,2)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,1)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,0,0,0)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,2)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,1)}, /* should not match */ - {.ip_src = IPv4(192,168,2,50)}, /* should not match */ - {.ip_src = IPv4(192,168,1,2)}, /* should not match */ - {.ip_src = IPv4(192,168,1,50)}, /* should not match */ - {.ip_dst = IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ - {.ip_dst = IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ - {.ip_dst = IPv4(192,168,1,50), .allow = 2, + {.ip_src = RTE_IPv4(192,168,2,50)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,2)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,50)}, /* should not match */ + {.ip_dst = RTE_IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ + {.ip_dst = RTE_IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ + {.ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 3}, /* should match 2, 3 */ {.vlan = 0x64, .allow = 7}, /* should match 7 */ @@ -515,20 +515,20 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .allow = 22, .deny = 23}, /* should match 22, 23 */ /* testing matching multiple rules at once */ - {.vlan = 0x5, .ip_src = IPv4(10,1,1,1), + {.vlan = 0x5, .ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 9}, /* should match 5, 9 */ - {.vlan = 0x5, .ip_src = IPv4(192,168,2,50), + {.vlan = 0x5, .ip_src = RTE_IPv4(192,168,2,50), .allow = 8, .deny = 9}, /* should match 8, 9 */ - {.vlan = 0x55, .ip_src = IPv4(192,168,1,49), + {.vlan = 0x55, .ip_src = RTE_IPv4(192,168,1,49), .allow = 8}, /* should match 8 */ {.port_dst = 80, .port_src = 1024, .allow = 13, .deny = 20}, /* should match 13,20 */ {.port_dst = 79, .port_src = 1024, .allow = 14, .deny = 20}, /* should match 14,20 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,2,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,2,50), .allow = 1, .deny = 23}, /* should match 1, 23 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,1,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 23}, /* should match 2, 23 */ {.vlan = 0x64, .domain = 0x5, .allow = 11, .deny = 12}, /* should match 11, 12 */ @@ -537,16 +537,16 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .port_dst = 80, .allow = 13, .deny = 23}, /* should match 13, 23 */ {.proto = 0x51, .port_src = 5000}, /* should not match */ - {.ip_src = IPv4(192,168,1,50), - .ip_dst = IPv4(10,0,0,0), + {.ip_src = RTE_IPv4(192,168,1,50), + .ip_dst = RTE_IPv4(10,0,0,0), .proto = 0x51, .port_src = 5000, .port_dst = 5000}, /* should not match */ /* test full packet rules */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -556,8 +556,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 24 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -567,8 +567,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 25 }, /* should match 13, 25 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -577,8 +577,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 26 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -587,8 +587,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 27 }, /* should match 13, 27 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -597,8 +597,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 13, 23 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -610,8 +610,8 @@ struct ipv4_7tuple acl_test_data[] = { /* visual separator! */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x55, .vlan = 0x8000, .domain = 0x6464, @@ -620,8 +620,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x55, .vlan = 0x8100, .domain = 0x6464, @@ -630,8 +630,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -639,8 +639,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -648,8 +648,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -657,8 +657,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x50, .vlan = 0x6466, .port_src = 12345, diff --git a/app/test/test_efd.c b/app/test/test_efd.c index 93e8f1cbb..2868712bb 100644 --- a/app/test/test_efd.c +++ b/app/test/test_efd.c @@ -58,36 +58,36 @@ static void print_key_info(const char *msg, const struct flow_key *key, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 96e371691..ad6c481fe 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -95,7 +95,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" */ static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, IPv4(2, 2, 2, 3), IPv4(2, 2, 2, 7)} + { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, RTE_IPv4(2, 2, 2, 3), RTE_IPv4(2, 2, 2, 7)} }; static const struct rte_flow_item_ipv4 ipv4_mask_24 = { .hdr = { @@ -131,7 +131,7 @@ static struct rte_flow_item end_item_bad = { -1, 0, 0, 0 }; * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" */ static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, IPv4(1, 2, 3, 4), IPv4(5, 6, 7, 8)} + { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, RTE_IPv4(1, 2, 3, 4), RTE_IPv4(5, 6, 7, 8)} }; static struct rte_flow_item_tcp tcp_spec_1 = { @@ -149,8 +149,8 @@ static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" */ static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, IPv4(11, 12, 13, 14), - IPv4(15, 16, 17, 18)} + { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, RTE_IPv4(11, 12, 13, 14), + RTE_IPv4(15, 16, 17, 18)} }; static struct rte_flow_item_sctp sctp_spec_1 = { diff --git a/app/test/test_hash.c b/app/test/test_hash.c index 390fbef87..907e6f191 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -104,32 +104,32 @@ static void print_key_info(const char *msg, const struct flow_key *key, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 2cad4096c..343d933a9 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -536,11 +536,11 @@ const char null_encrypted_data[] = struct rte_ipv4_hdr ipv4_outer = { .version_ihl = IPVERSION << 4 | - sizeof(ipv4_outer) / IPV4_IHL_MULTIPLIER, + sizeof(ipv4_outer) / RTE_IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, .next_proto_id = IPPROTO_ESP, - .src_addr = IPv4(192, 168, 1, 100), - .dst_addr = IPv4(192, 168, 2, 100), + .src_addr = RTE_IPv4(192, 168, 1, 100), + .dst_addr = RTE_IPv4(192, 168, 2, 100), }; static struct rte_mbuf * diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index fba629d43..4968cd91c 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -728,8 +728,8 @@ generate_packets(struct rte_ether_addr *src_mac, uint16_t src_port = 10, dst_port = 20; - uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; - uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; + uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = RTE_IPv4(192, 168, 0, 1) }; + uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c index 5d697dd0f..0f24631ac 100644 --- a/app/test/test_lpm.c +++ b/app/test/test_lpm.c @@ -165,7 +165,7 @@ test3(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop = 100; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop = 100; uint8_t depth = 24; int32_t status = 0; @@ -203,7 +203,7 @@ test4(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0); + uint32_t ip = RTE_IPv4(0, 0, 0, 0); uint8_t depth = 24; int32_t status = 0; @@ -242,7 +242,7 @@ test5(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_return = 0; int32_t status = 0; /* rte_lpm_lookup: lpm == NULL */ @@ -276,7 +276,7 @@ test6(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 24; int32_t status = 0; @@ -315,7 +315,7 @@ test7(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 32; int32_t status = 0; @@ -366,7 +366,7 @@ test8(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip1 = IPv4(127, 255, 255, 255), ip2 = IPv4(128, 0, 0, 0); + uint32_t ip1 = RTE_IPv4(127, 255, 255, 255), ip2 = RTE_IPv4(128, 0, 0, 0); uint32_t next_hop_add, next_hop_return; uint8_t depth; int32_t status = 0; @@ -457,7 +457,7 @@ test9(void) int32_t status = 0; /* Add & lookup to hit invalid TBL24 entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -479,7 +479,7 @@ test9(void) rte_lpm_delete_all(lpm); /* Add & lookup to hit valid TBL24 entry not extended */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 23; next_hop_add = 100; @@ -515,7 +515,7 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with invalid TBL8 * entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -525,7 +525,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 5); + ip = RTE_IPv4(128, 0, 0, 5); depth = 32; next_hop_add = 101; @@ -541,7 +541,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -558,11 +558,11 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with valid TBL8 * entry */ - ip_1 = IPv4(128, 0, 0, 0); + ip_1 = RTE_IPv4(128, 0, 0, 0); depth_1 = 25; next_hop_add_1 = 101; - ip_2 = IPv4(128, 0, 0, 5); + ip_2 = RTE_IPv4(128, 0, 0, 5); depth_2 = 32; next_hop_add_2 = 102; @@ -629,7 +629,7 @@ test10(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 16; next_hop_add = 100; @@ -647,7 +647,7 @@ test10(void) rte_lpm_delete_all(lpm); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 25; next_hop_add = 100; @@ -665,14 +665,14 @@ test10(void) /* Add rule that extends a TBL24 valid entry & lookup for both rules * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -682,13 +682,13 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -697,7 +697,7 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -711,7 +711,7 @@ test10(void) /* Add rule that updates the next hop in TBL24 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -740,7 +740,7 @@ test10(void) /* Add rule that updates the next hop in TBL8 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -768,7 +768,7 @@ test10(void) /* Delete a rule that is not present in the TBL24 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -781,7 +781,7 @@ test10(void) /* Delete a rule that is not present in the TBL8 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -818,14 +818,14 @@ test11(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -835,13 +835,13 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -850,7 +850,7 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -889,7 +889,7 @@ test12(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -944,7 +944,7 @@ test13(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add_1 = 100; @@ -1014,10 +1014,10 @@ test14(void) depth = 32; next_hop_add = 100; - ip = IPv4(0, 0, 0, 0); + ip = RTE_IPv4(0, 0, 0, 0); /* Add 256 rules that require a tbl8 extension */ - for (; ip <= IPv4(0, 0, 255, 0); ip += 256) { + for (; ip <= RTE_IPv4(0, 0, 255, 0); ip += 256) { status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); @@ -1028,7 +1028,7 @@ test14(void) /* All tbl8 extensions have been used above. Try to add one more and * we get a fail */ - ip = IPv4(1, 0, 0, 0); + ip = RTE_IPv4(1, 0, 0, 0); depth = 32; status = rte_lpm_add(lpm, ip, depth, next_hop_add); @@ -1125,9 +1125,9 @@ test17(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - const uint32_t ip_10_32 = IPv4(10, 10, 10, 2); - const uint32_t ip_10_24 = IPv4(10, 10, 10, 0); - const uint32_t ip_20_25 = IPv4(10, 10, 20, 2); + const uint32_t ip_10_32 = RTE_IPv4(10, 10, 10, 2); + const uint32_t ip_10_24 = RTE_IPv4(10, 10, 10, 0); + const uint32_t ip_20_25 = RTE_IPv4(10, 10, 20, 2); const uint8_t d_ip_10_32 = 32, d_ip_10_24 = 24, d_ip_20_25 = 25; @@ -1221,7 +1221,7 @@ test18(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(192, 168, 100, 100); + ip = RTE_IPv4(192, 168, 100, 100); depth = 28; next_hop = 1; rte_lpm_add(lpm, ip, depth, next_hop); diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index 3b98ce0c8..b54650367 100644 --- a/app/test/test_lpm_perf.c +++ b/app/test/test_lpm_perf.c @@ -285,11 +285,11 @@ static void generate_large_route_rule_table(void) * they are 4 rules with private local IP address and 1 all-zeros prefix * with depth = 8. */ - insert_rule_in_random_pos(IPv4(0, 0, 0, 0), 8); - insert_rule_in_random_pos(IPv4(10, 2, 23, 147), 32); - insert_rule_in_random_pos(IPv4(192, 168, 100, 10), 24); - insert_rule_in_random_pos(IPv4(192, 168, 25, 100), 24); - insert_rule_in_random_pos(IPv4(192, 168, 129, 124), 32); + insert_rule_in_random_pos(RTE_IPv4(0, 0, 0, 0), 8); + insert_rule_in_random_pos(RTE_IPv4(10, 2, 23, 147), 32); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 100, 10), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 25, 100), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 129, 124), 32); } static void diff --git a/app/test/test_member.c b/app/test/test_member.c index e2a3932f2..53287fcaf 100644 --- a/app/test/test_member.c +++ b/app/test/test_member.c @@ -41,36 +41,36 @@ struct flow_key { /* Keys used by unit test functions */ static struct flow_key keys[NUM_SAMPLES] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 4781c2307..628cf147d 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -92,7 +92,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(RTE_ETHER_TYPE_IPv4); - ip_hdr->dst_addr = IPv4(0,0,TC,QUEUE); + ip_hdr->dst_addr = RTE_IPv4(0,0,TC,QUEUE); rte_sched_port_pkt_write(port, mbuf, SUBPORT, PIPE, TC, QUEUE, diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c index 22136a396..e01e1f946 100644 --- a/app/test/test_table_acl.c +++ b/app/test/test_table_acl.c @@ -7,7 +7,7 @@ #include "test_table.h" #include "test_table_acl.h" -#define IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -116,7 +116,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; @@ -662,8 +662,8 @@ test_pipeline_single_filter(int expected_count) sizeof(struct ipv4_5tuple)); five_tuple.proto = j; - five_tuple.ip_src = rte_bswap32(IPv4(192, 168, j, 1)); - five_tuple.ip_dst = rte_bswap32(IPv4(10, 4, j, 1)); + five_tuple.ip_src = rte_bswap32(RTE_IPv4(192, 168, j, 1)); + five_tuple.ip_dst = rte_bswap32(RTE_IPv4(10, 4, j, 1)); five_tuple.port_src = rte_bswap16(100 + j); five_tuple.port_dst = rte_bswap16(200 + j); diff --git a/app/test/test_thash.c b/app/test/test_thash.c index bf332c9e9..3724ea5be 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -59,15 +59,15 @@ struct test_thash_v6 { /*From 82599 Datasheet 7.1.2.8.3 RSS Verification Suite*/ struct test_thash_v4 v4_tbl[] = { -{IPv4(161, 142, 100, 80), IPv4(66, 9, 149, 187), +{RTE_IPv4(161, 142, 100, 80), RTE_IPv4(66, 9, 149, 187), 1766, 2794, 0x323e8fc2, 0x51ccc178}, -{IPv4(65, 69, 140, 83), IPv4(199, 92, 111, 2), +{RTE_IPv4(65, 69, 140, 83), RTE_IPv4(199, 92, 111, 2), 4739, 14230, 0xd718262a, 0xc626b0ea}, -{IPv4(12, 22, 207, 184), IPv4(24, 19, 198, 95), +{RTE_IPv4(12, 22, 207, 184), RTE_IPv4(24, 19, 198, 95), 38024, 12898, 0xd2d0a5de, 0x5c2b394a}, -{IPv4(209, 142, 163, 6), IPv4(38, 27, 205, 30), +{RTE_IPv4(209, 142, 163, 6), RTE_IPv4(38, 27, 205, 30), 2217, 48228, 0x82989176, 0xafc7327f}, -{IPv4(202, 188, 127, 2), IPv4(153, 39, 163, 191), +{RTE_IPv4(202, 188, 127, 2), RTE_IPv4(153, 39, 163, 191), 1303, 44251, 0x5d1809c5, 0x10e828a2}, }; diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 6887e4dc6..010ec045d 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -419,7 +419,7 @@ Classify with Multiple Categories .data = {.userdata = 1, .category_mask = 3, .priority = 1}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,0,0),. mask_range.u32 = 16,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,0,0),. mask_range.u32 = 16,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -433,7 +433,7 @@ Classify with Multiple Categories .data = {.userdata = 2, .category_mask = 1, .priority = 2}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,1,0),. mask_range.u32 = 24,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,1,0),. mask_range.u32 = 24,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -447,7 +447,7 @@ Classify with Multiple Categories .data = {.userdata = 3, .category_mask = 2, .priority = 3}, /* source IPv4 */ - .field[1] = {.value.u32 = IPv4(10,1,1,1),. mask_range.u32 = 32,}, + .field[1] = {.value.u32 = RTE_IPv4(10,1,1,1),. mask_range.u32 = 32,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, diff --git a/doc/guides/sample_app_ug/ip_frag.rst b/doc/guides/sample_app_ug/ip_frag.rst index 2583f0c3d..49ba0d8bc 100644 --- a/doc/guides/sample_app_ug/ip_frag.rst +++ b/doc/guides/sample_app_ug/ip_frag.rst @@ -104,14 +104,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ip_reassembly.rst b/doc/guides/sample_app_ug/ip_reassembly.rst index a628b63cb..99dcd9556 100644 --- a/doc/guides/sample_app_ug/ip_reassembly.rst +++ b/doc/guides/sample_app_ug/ip_reassembly.rst @@ -107,14 +107,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 46c920433..ea7902b2d 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -155,7 +155,7 @@ if the routing table has any ports assigned to the destination address: .. code-block:: c - if (!IS_IPV4_MCAST(dest_addr) || + if (!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index c7fcd9b8e..66ed885fa 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -857,8 +857,8 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, if (likely(rte_ipv4_frag_pkt_is_fragmented(ipv4_hdr) == 0)) { ip_hdr_offset = (ipv4_hdr->version_ihl - & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { tcp_hdr = (struct tcp_hdr *) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 469d7aaf6..3671b3876 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2157,7 +2157,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); - if ((frag_field & IPV4_HDR_DF_FLAG) != 0) { + if ((frag_field & RTE_IPV4_HDR_DF_FLAG) != 0) { m->packet_type |= RTE_PTYPE_L4_NONFRAG; /* If IPv4 header has DF flag enabled and TSO support is diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index eab451447..e4b5bbb2d 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2607,8 +2607,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, /* Check if it is fragment. */ frag_off = ipv4_spec->hdr.fragment_offset; frag_off = rte_be_to_cpu_16(frag_off); - if (frag_off & IPV4_HDR_OFFSET_MASK || - frag_off & IPV4_HDR_MF_FLAG) + if (frag_off & RTE_IPV4_HDR_OFFSET_MASK || + frag_off & RTE_IPV4_HDR_MF_FLAG) pctype = I40E_FILTER_PCTYPE_FRAG_IPV4; /* Get the filter info */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 5b7953a7f..217340e59 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4537,7 +4537,7 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool) /* MAXDESC * SRRCTL.BSIZEPKT must not exceed 64 KB minus one */ uint16_t maxdesc = - IPV4_MAX_PKT_LEN / + RTE_IPV4_MAX_PKT_LEN / (mp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM); if (maxdesc >= 16) diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index dd5a090af..743ae8546 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -552,7 +552,7 @@ static const struct { }, .ipv6.hdr = { .proto = 0xff, - .vtc_flow = RTE_BE32(0xfful << IPV6_HDR_FL_SHIFT), + .vtc_flow = RTE_BE32(0xfful << RTE_IPV6_HDR_FL_SHIFT), .hop_limits = 0xff, .src_addr = "\xff\xff\xff\xff\xff\xff\xff\xff" @@ -1426,7 +1426,7 @@ flow_tcf_validate_vxlan_encap_ipv6(const struct rte_flow_item *item, " vxlan encapsulation"); } msk6 = (rte_be_to_cpu_32(mask->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; if (msk6 && msk6 != 0xff) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM_MASK, mask, @@ -2551,7 +2551,7 @@ flow_tcf_get_items_size(const struct rte_flow_attr *attr, if (ipv6 && ipv6->hdr.hop_limits) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; if (ipv6 && (rte_be_to_cpu_32(ipv6->hdr.vtc_flow) & - (0xfful << IPV6_HDR_TC_SHIFT))) + (0xfful << RTE_IPV6_HDR_TC_SHIFT))) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; break; } @@ -2639,7 +2639,7 @@ flow_tcf_vxlan_encap_size(const struct rte_flow_action *action) if (ipv6 && ipv6->hdr.hop_limits) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; if (ipv6 && (rte_be_to_cpu_32(ipv6->hdr.vtc_flow) & - (0xfful << IPV6_HDR_TC_SHIFT))) + (0xfful << RTE_IPV6_HDR_TC_SHIFT))) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; break; } @@ -3037,11 +3037,11 @@ flow_tcf_parse_vxlan_encap_ipv6(const struct rte_flow_item_ipv6 *spec, FLOW_TCF_ENCAP_IPV6_DST; if (mask) { if ((rte_be_to_cpu_32(mask->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff) { + RTE_IPV6_HDR_TC_SHIFT) & 0xff) { encap->mask |= FLOW_TCF_ENCAP_IP_TOS; encap->ip_tos = (rte_be_to_cpu_32 (spec->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; } if (mask->hdr.hop_limits) { encap->mask |= FLOW_TCF_ENCAP_IP_TTL; @@ -3590,11 +3590,11 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, mask.ipv6->hdr.hop_limits); } msk6 = (rte_be_to_cpu_32(mask.ipv6->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; if (msk6) { tos6 = (rte_be_to_cpu_32 (spec.ipv6->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; mnl_attr_put_u8 (nlh, tunnel_outer ? TCA_FLOWER_KEY_ENC_IP_TOS : diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 252febf35..e9913d670 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -476,17 +476,17 @@ flow_verbs_translate_item_ipv6(struct mlx5_flow *dev_flow, vtc_flow_val = rte_be_to_cpu_32(spec->hdr.vtc_flow); vtc_flow_mask = rte_be_to_cpu_32(mask->hdr.vtc_flow); ipv6.val.flow_label = - rte_cpu_to_be_32((vtc_flow_val & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.val.traffic_class = (vtc_flow_val & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_val & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.val.traffic_class = (vtc_flow_val & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.val.next_hdr = spec->hdr.proto; ipv6.val.hop_limit = spec->hdr.hop_limits; ipv6.mask.flow_label = - rte_cpu_to_be_32((vtc_flow_mask & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.mask.traffic_class = (vtc_flow_mask & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_mask & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.mask.traffic_class = (vtc_flow_mask & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.mask.next_hdr = mask->hdr.proto; ipv6.mask.hop_limit = mask->hdr.hop_limits; /* Remove unwanted bits from values. */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index 2b1dba15b..531569b12 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -19,7 +19,7 @@ #include "tap_rss.h" /** Create IPv4 address */ -#define IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -157,11 +157,11 @@ rss_l3_l4(struct __sk_buff *skb) __u8 *src_dst_addr = data + off + offsetof(struct iphdr, saddr); __u8 *src_dst_port = data + off + sizeof(struct iphdr); struct ipv4_l3_l4_tuple v4_tuple = { - .src_addr = IPv4(*(src_dst_addr + 0), + .src_addr = RTE_IPv4(*(src_dst_addr + 0), *(src_dst_addr + 1), *(src_dst_addr + 2), *(src_dst_addr + 3)), - .dst_addr = IPv4(*(src_dst_addr + 4), + .dst_addr = RTE_IPv4(*(src_dst_addr + 4), *(src_dst_addr + 5), *(src_dst_addr + 6), *(src_dst_addr + 7)), diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 7749458e4..949798c39 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -684,8 +684,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, - sizeof(struct tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); - hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index c75a410f4..e68d0f694 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -379,7 +379,7 @@ parse_ipv4_net(char *in, uint32_t *addr, uint32_t *mask_len) if (get_cb_field(&in, &m, 0, sizeof(uint32_t) * CHAR_BIT, 0)) return -EINVAL; - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; } diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 9c8a0a9b9..ba6e29c31 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -168,14 +168,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 00a95e07a..97c499425 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -190,14 +190,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 1d0020567..ef63f59d5 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -951,7 +951,7 @@ get_spi_proto(uint32_t spi, enum rte_security_ipsec_sa_direction dir) if (rc6 >= 0) { RTE_LOG(ERR, IPSEC, "%s: SPI %u used simultaeously by " - "IPv4(%d) and IPv6 (%d) SP rules\n", + "RTE_IPv4(%d) and IPv6 (%d) SP rules\n", __func__, spi, rc4, rc6); return -EINVAL; } else @@ -1040,7 +1040,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) struct rte_ipsec_sa_prm prm; struct rte_ipv4_hdr v4 = { .version_ihl = IPVERSION << 4 | - sizeof(v4) / IPV4_IHL_MULTIPLIER, + sizeof(v4) / RTE_IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, .next_proto_id = IPPROTO_ESP, .src_addr = lsa->src.ip.ip4, diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 259c0d19e..6bad6a92d 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -138,21 +138,21 @@ struct mcast_group_params { }; static struct mcast_group_params mcast_group_table[] = { - {IPv4(224,0,0,101), 0x1}, - {IPv4(224,0,0,102), 0x2}, - {IPv4(224,0,0,103), 0x3}, - {IPv4(224,0,0,104), 0x4}, - {IPv4(224,0,0,105), 0x5}, - {IPv4(224,0,0,106), 0x6}, - {IPv4(224,0,0,107), 0x7}, - {IPv4(224,0,0,108), 0x8}, - {IPv4(224,0,0,109), 0x9}, - {IPv4(224,0,0,110), 0xA}, - {IPv4(224,0,0,111), 0xB}, - {IPv4(224,0,0,112), 0xC}, - {IPv4(224,0,0,113), 0xD}, - {IPv4(224,0,0,114), 0xE}, - {IPv4(224,0,0,115), 0xF}, + {RTE_IPv4(224,0,0,101), 0x1}, + {RTE_IPv4(224,0,0,102), 0x2}, + {RTE_IPv4(224,0,0,103), 0x3}, + {RTE_IPv4(224,0,0,104), 0x4}, + {RTE_IPv4(224,0,0,105), 0x5}, + {RTE_IPv4(224,0,0,106), 0x6}, + {RTE_IPv4(224,0,0,107), 0x7}, + {RTE_IPv4(224,0,0,108), 0x8}, + {RTE_IPv4(224,0,0,109), 0x9}, + {RTE_IPv4(224,0,0,110), 0xA}, + {RTE_IPv4(224,0,0,111), 0xB}, + {RTE_IPv4(224,0,0,112), 0xC}, + {RTE_IPv4(224,0,0,113), 0xD}, + {RTE_IPv4(224,0,0,114), 0xE}, + {RTE_IPv4(224,0,0,115), 0xF}, }; #define N_MCAST_GROUPS \ @@ -315,7 +315,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) * Check that it is a valid multicast address and * we have some active ports assigned to it. */ - if(!IS_IPV4_MCAST(dest_addr) || + if(!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 06f5d1db1..afc658e5d 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -404,8 +404,8 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); - ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) - * IPV4_IHL_MULTIPLIER; + ipdata_offset += (ip_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) + * RTE_IPV4_IHL_MULTIPLIER; /* Zero pad data to be crypto'd so it is block aligned */ diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index b0e933e03..bad6aae8c 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -897,7 +897,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 91f144605..959925e73 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -258,10 +258,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -300,14 +300,14 @@ struct ipv4_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define IPV4_L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index ebb2378dd..5e3809b8d 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -201,10 +201,10 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; typedef struct rte_hash lookup_struct_t; @@ -234,14 +234,14 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index fb55e196d..b0e08f842 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -99,10 +99,10 @@ struct ipv6_l3fwd_em_route { }; static struct ipv4_l3fwd_em_route ipv4_l3fwd_em_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_em_route ipv6_l3fwd_em_route_array[] = { @@ -424,19 +424,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_em_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_em_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_em_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_em_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); @@ -574,8 +574,8 @@ em_parse_ptype(struct rte_mbuf *m) l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr = (struct rte_ipv4_hdr *)l3; - hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hdr_len = (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 881b0c7c0..de9fd9ab3 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -40,14 +40,14 @@ struct ipv6_l3fwd_lpm_route { }; static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_lpm_route ipv6_l3fwd_lpm_route_array[] = { diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index da5c66203..9b5684ea6 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -380,10 +380,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -503,14 +503,14 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -3134,19 +3134,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index c37b4ef3e..20f2ea7e6 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -239,7 +239,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index a9bdf1d72..d26aa95b4 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -347,11 +347,11 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(outer_ipv4_hdr->fragment_offset); - outer_is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + outer_is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; outer_ip_id = outer_is_atomic ? 0 : rte_be_to_cpu_16(outer_ipv4_hdr->packet_id); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 5f2adc833..13c9aeea8 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -12,8 +12,8 @@ #include <rte_tcp.h> #include <rte_udp.h> -#define IS_FRAGMENTED(frag_off) (((frag_off) & IPV4_HDR_OFFSET_MASK) != 0 \ - || ((frag_off) & IPV4_HDR_MF_FLAG) == IPV4_HDR_MF_FLAG) +#define IS_FRAGMENTED(frag_off) (((frag_off) & RTE_IPV4_HDR_OFFSET_MASK) != 0 \ + || ((frag_off) & RTE_IPV4_HDR_MF_FLAG) == RTE_IPV4_HDR_MF_FLAG) #define TCP_HDR_PSH_MASK ((uint8_t)0x08) #define TCP_HDR_FIN_MASK ((uint8_t)0x01) diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 60c0300e8..73cf553be 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -308,8 +308,8 @@ rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); return ip_flag != 0 || ip_ofs != 0; } diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index 2c781724a..f7c956ee1 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -12,22 +12,22 @@ #include "ip_frag_common.h" /* Fragment Offset */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_MASK (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_MASK (1 << IPV4_HDR_MF_SHIFT) +#define IPV4_HDR_DF_MASK (1 << RTE_IPV4_HDR_DF_SHIFT) +#define IPV4_HDR_MF_MASK (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) +#define IPV4_HDR_FO_ALIGN (1 << RTE_IPV4_HDR_FO_SHIFT) static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); - fofs = (uint16_t)(fofs + (dofs >> IPV4_HDR_FO_SHIFT)); - fofs = (uint16_t)(fofs | mf << IPV4_HDR_MF_SHIFT); + fofs = (uint16_t)(fofs + (dofs >> RTE_IPV4_HDR_FO_SHIFT)); + fofs = (uint16_t)(fofs | mf << RTE_IPV4_HDR_MF_SHIFT); dst->fragment_offset = rte_cpu_to_be_16(fofs); dst->total_length = rte_cpu_to_be_16(len); dst->hdr_checksum = 0; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 97da607ed..b7b92ed28 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -75,7 +75,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_DF_FLAG)); + rte_cpu_to_be_16(RTE_IPV4_HDR_DF_FLAG)); ip_hdr->hdr_checksum = 0; return m; @@ -109,8 +109,8 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, int32_t ip_len; flag_offset = rte_be_to_cpu_16(ip_hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); psd = (unaligned_uint64_t *)&ip_hdr->src_addr; /* use first 8 bytes only */ @@ -118,7 +118,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, key.id = ip_hdr->packet_id; key.key_len = IPV4_KEYLEN; - ip_ofs *= IPV4_HDR_OFFSET_UNITS; + ip_ofs *= RTE_IPV4_HDR_OFFSET_UNITS; ip_len = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len; IP_FRAG_LOG(DEBUG, "%s:%d:\n" diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index a1431ee90..75dfb528d 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -42,52 +42,52 @@ struct rte_ipv4_hdr { } __attribute__((__packed__)); /** Create IPv4 address */ -#define IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) /** Maximal IPv4 packet length (including a header) */ -#define IPV4_MAX_PKT_LEN 65535 +#define RTE_IPV4_MAX_PKT_LEN 65535 /** Internet header length mask for version_ihl field */ -#define IPV4_HDR_IHL_MASK (0x0f) +#define RTE_IPV4_HDR_IHL_MASK (0x0f) /** * Internet header length field multiplier (IHL field specifies overall header * length in number of 4-byte words) */ -#define IPV4_IHL_MULTIPLIER (4) +#define RTE_IPV4_IHL_MULTIPLIER (4) /* Fragment Offset * Flags. */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_FLAG (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_FLAG (1 << IPV4_HDR_MF_SHIFT) +#define RTE_IPV4_HDR_DF_FLAG (1 << RTE_IPV4_HDR_DF_SHIFT) +#define RTE_IPV4_HDR_MF_FLAG (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_OFFSET_MASK ((1 << IPV4_HDR_MF_SHIFT) - 1) +#define RTE_IPV4_HDR_OFFSET_MASK ((1 << RTE_IPV4_HDR_MF_SHIFT) - 1) -#define IPV4_HDR_OFFSET_UNITS 8 +#define RTE_IPV4_HDR_OFFSET_UNITS 8 /* * IPv4 address types */ -#define IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ -#define IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ -#define IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ -#define IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ -#define IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ -#define IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ +#define RTE_IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ +#define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ +#define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ +#define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ +#define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ +#define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ /* * IPv4 Multicast-related macros */ -#define IPV4_MIN_MCAST IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ -#define IPV4_MAX_MCAST IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ +#define RTE_IPV4_MIN_MCAST RTE_IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ +#define RTE_IPV4_MAX_MCAST RTE_IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ -#define IS_IPV4_MCAST(x) \ - ((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ +#define RTE_IS_IPV4_MCAST(x) \ + ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ /** * @internal Calculate a sum of all words in the buffer. @@ -349,10 +349,10 @@ struct rte_ipv6_hdr { } __attribute__((__packed__)); /* IPv6 vtc_flow: IPv / TC / flow_label */ -#define IPV6_HDR_FL_SHIFT 0 -#define IPV6_HDR_TC_SHIFT 20 -#define IPV6_HDR_FL_MASK ((1u << IPV6_HDR_TC_SHIFT) - 1) -#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT) +#define RTE_IPV6_HDR_FL_SHIFT 0 +#define RTE_IPV6_HDR_TC_SHIFT 20 +#define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1) +#define RTE_IPV6_HDR_TC_MASK (0xf << RTE_IPV6_HDR_TC_SHIFT) /** * Process the pseudo-header checksum of an IPv6 header. diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index b01cacb9c..712383484 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -315,7 +315,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (ip4h->fragment_offset & rte_cpu_to_be_16( - IPV4_HDR_OFFSET_MASK | IPV4_HDR_MF_FLAG)) { + RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_L4_FRAG; hdr_lens->l4_len = 0; return pkt_type; @@ -446,8 +446,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_INNER_L4_MASK) == 0) return pkt_type; if (ip4h->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_OFFSET_MASK | - IPV4_HDR_MF_FLAG)) { + rte_cpu_to_be_16(RTE_IPV4_HDR_OFFSET_MASK | + RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_INNER_L4_FRAG; hdr_lens->inner_l4_len = 0; return pkt_type; diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index 2e807e805..0d02f97e5 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -155,8 +155,8 @@ process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); - uint16_t frag_offset = (uint16_t)(frag_field & IPV4_HDR_OFFSET_MASK); - uint16_t frag_flag = (uint16_t)(frag_field & IPV4_HDR_MF_FLAG); + uint16_t frag_offset = (uint16_t)(frag_field & RTE_IPV4_HDR_OFFSET_MASK); + uint16_t frag_flag = (uint16_t)(frag_field & RTE_IPV4_HDR_MF_FLAG); /* If it is a fragmented packet, then try to reassemble */ if ((frag_flag == 0) && (frag_offset == 0)) -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines Olivier Matz 2019-04-10 8:32 ` Olivier Matz @ 2019-04-22 16:05 ` Stephen Hemminger 2019-04-22 16:05 ` Stephen Hemminger 2019-05-13 12:02 ` Olivier Matz 1 sibling, 2 replies; 107+ messages in thread From: Stephen Hemminger @ 2019-04-22 16:05 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, Ferruh Yigit On Wed, 10 Apr 2019 10:32:15 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > diff --git a/app/test-acl/main.c b/app/test-acl/main.c > index b80179417..eb6294396 100644 > --- a/app/test-acl/main.c > +++ b/app/test-acl/main.c > @@ -625,7 +625,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) > GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); > GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); > > - addr[0] = IPv4(a, b, c, d); > + addr[0] = RTE_IPv4(a, b, c, d); IPv4 is a DPDK only macro, could you leave it alone. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines 2019-04-22 16:05 ` Stephen Hemminger @ 2019-04-22 16:05 ` Stephen Hemminger 2019-05-13 12:02 ` Olivier Matz 1 sibling, 0 replies; 107+ messages in thread From: Stephen Hemminger @ 2019-04-22 16:05 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, Ferruh Yigit On Wed, 10 Apr 2019 10:32:15 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > diff --git a/app/test-acl/main.c b/app/test-acl/main.c > index b80179417..eb6294396 100644 > --- a/app/test-acl/main.c > +++ b/app/test-acl/main.c > @@ -625,7 +625,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) > GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); > GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); > > - addr[0] = IPv4(a, b, c, d); > + addr[0] = RTE_IPv4(a, b, c, d); IPv4 is a DPDK only macro, could you leave it alone. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines 2019-04-22 16:05 ` Stephen Hemminger 2019-04-22 16:05 ` Stephen Hemminger @ 2019-05-13 12:02 ` Olivier Matz 2019-05-13 12:02 ` Olivier Matz 1 sibling, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-05-13 12:02 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Ferruh Yigit On Mon, Apr 22, 2019 at 09:05:54AM -0700, Stephen Hemminger wrote: > On Wed, 10 Apr 2019 10:32:15 +0200 > Olivier Matz <olivier.matz@6wind.com> wrote: > > > diff --git a/app/test-acl/main.c b/app/test-acl/main.c > > index b80179417..eb6294396 100644 > > --- a/app/test-acl/main.c > > +++ b/app/test-acl/main.c > > @@ -625,7 +625,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) > > GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); > > GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); > > > > - addr[0] = IPv4(a, b, c, d); > > + addr[0] = RTE_IPv4(a, b, c, d); > > IPv4 is a DPDK only macro, could you leave it alone. It is a public macro defined in rte_ip.h. I think we should prefix it, to move it in the dpdk namespace. This would avoid conflicts with an application defining its own IPv4() macro. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines 2019-05-13 12:02 ` Olivier Matz @ 2019-05-13 12:02 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-13 12:02 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev, Ferruh Yigit On Mon, Apr 22, 2019 at 09:05:54AM -0700, Stephen Hemminger wrote: > On Wed, 10 Apr 2019 10:32:15 +0200 > Olivier Matz <olivier.matz@6wind.com> wrote: > > > diff --git a/app/test-acl/main.c b/app/test-acl/main.c > > index b80179417..eb6294396 100644 > > --- a/app/test-acl/main.c > > +++ b/app/test-acl/main.c > > @@ -625,7 +625,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) > > GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); > > GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); > > > > - addr[0] = IPv4(a, b, c, d); > > + addr[0] = RTE_IPv4(a, b, c, d); > > IPv4 is a DPDK only macro, could you leave it alone. It is a public macro defined in rte_ip.h. I think we should prefix it, to move it in the dpdk namespace. This would avoid conflicts with an application defining its own IPv4() macro. ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 12/14] net: add rte prefix to sctp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (11 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 13/14] net: add rte prefix to tcp structure Olivier Matz ` (3 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct sctp_hdr as struct rte_sctp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 4 ++-- app/test/packet_burst_generator.c | 6 +++--- app/test/packet_burst_generator.h | 2 +- app/test/test_flow_classify.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 4 ++-- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- examples/tep_termination/vxlan.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_sctp.h | 2 +- lib/librte_vhost/virtio_net.c | 4 ++-- 17 files changed, 36 insertions(+), 36 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index eff2b4f7c..ac1c2ec60 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -365,7 +365,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -432,7 +432,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_TCP_SEG; } else if (info->l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *)((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 886b5f8ac..9aa07e176 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -121,7 +121,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, } uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -394,7 +394,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; default: @@ -416,7 +416,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; default: diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 93efee1f5..98185c162 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -42,7 +42,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index ad6c481fe..85228486d 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -565,7 +565,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct sctp_hdr pkt_sctp_hdr; + struct rte_sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); uint16_t src_port = 10; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index ee51eca97..3bfddc651 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -299,7 +299,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; default: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_RSV | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 6bdc5a09a..6c37e2ec5 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -153,7 +153,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -176,7 +176,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, * manually set proto_id=sctp below. */ enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP || @@ -247,7 +247,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -265,7 +265,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP || diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index b1a9bcbde..9dee5d2ee 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -895,9 +895,9 @@ enic_copy_item_sctp_v2(struct copy_item_args *arg) mask = &rte_flow_item_sctp_mask; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index b20f30fb4..14a82426e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -801,7 +801,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload, *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -841,8 +841,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -886,8 +886,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1091,7 +1091,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; struct rte_ipv6_hdr *gtp_ipv6; @@ -1138,8 +1138,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->dst_port = fdir_input->flow.tcp4_flow.src_port; tcp->data_off = I40E_FDIR_TCP_DEFAULT_DATAOFF; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1175,8 +1175,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->src_port = fdir_input->flow.udp6_flow.dst_port; tcp->dst_port = fdir_input->flow.udp6_flow.src_port; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 52ce536e0..edd4509ee 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -307,7 +307,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 103a020c8..7a6750e02 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1422,7 +1422,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 9fc98b401..2e15de46d 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1766,7 +1766,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 217340e59..08b2f5df5 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -436,7 +436,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_SCTP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 8088d9412..07a53abc3 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -77,7 +77,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; info->l2_len = sizeof(struct rte_ether_hdr); @@ -126,7 +126,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i tcp_hdr->cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *)((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; ol_flags |= PKT_TX_SCTP_CKSUM; } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 0bf55a62f..f93427a44 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -731,7 +731,7 @@ static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { * Matches a SCTP header. */ struct rte_flow_item_sctp { - struct sctp_hdr hdr; /**< SCTP header definition. */ + struct rte_sctp_hdr hdr; /**< SCTP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 712383484..4a46df58d 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -370,7 +370,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = (th->data_off & 0xf0) >> 2; return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_SCTP) { - hdr_lens->l4_len = sizeof(struct sctp_hdr); + hdr_lens->l4_len = sizeof(struct rte_sctp_hdr); return pkt_type; } else { uint32_t prev_off = off; @@ -506,7 +506,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = (th->data_off & 0xf0) >> 2; } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_SCTP) { - hdr_lens->inner_l4_len = sizeof(struct sctp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_sctp_hdr); } else { hdr_lens->inner_l4_len = 0; } diff --git a/lib/librte_net/rte_sctp.h b/lib/librte_net/rte_sctp.h index bfb7165a6..b3661b0db 100644 --- a/lib/librte_net/rte_sctp.h +++ b/lib/librte_net/rte_sctp.h @@ -23,7 +23,7 @@ extern "C" { /** * SCTP Header */ -struct sctp_hdr { +struct rte_sctp_hdr { uint16_t src_port; /**< Source port. */ uint16_t dst_port; /**< Destin port. */ uint32_t tag; /**< Validation tag. */ diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 2960a5c8a..720d77ba6 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -226,7 +226,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: - net_hdr->csum_offset = (offsetof(struct sctp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_sctp_hdr, cksum)); break; } @@ -1031,7 +1031,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; - case (offsetof(struct sctp_hdr, cksum)): + case (offsetof(struct rte_sctp_hdr, cksum)): if (l4_proto == IPPROTO_SCTP) m->ol_flags |= PKT_TX_SCTP_CKSUM; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 12/14] net: add rte prefix to sctp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 12/14] net: add rte prefix to sctp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct sctp_hdr as struct rte_sctp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 4 ++-- app/test/packet_burst_generator.c | 6 +++--- app/test/packet_burst_generator.h | 2 +- app/test/test_flow_classify.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 4 ++-- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- examples/tep_termination/vxlan.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_sctp.h | 2 +- lib/librte_vhost/virtio_net.c | 4 ++-- 17 files changed, 36 insertions(+), 36 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index eff2b4f7c..ac1c2ec60 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -365,7 +365,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -432,7 +432,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_TCP_SEG; } else if (info->l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *)((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 886b5f8ac..9aa07e176 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -121,7 +121,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, } uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -394,7 +394,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; default: @@ -416,7 +416,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; default: diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 93efee1f5..98185c162 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -42,7 +42,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index ad6c481fe..85228486d 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -565,7 +565,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct sctp_hdr pkt_sctp_hdr; + struct rte_sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); uint16_t src_port = 10; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index ee51eca97..3bfddc651 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -299,7 +299,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; default: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_RSV | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 6bdc5a09a..6c37e2ec5 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -153,7 +153,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -176,7 +176,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, * manually set proto_id=sctp below. */ enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP || @@ -247,7 +247,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -265,7 +265,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP || diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index b1a9bcbde..9dee5d2ee 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -895,9 +895,9 @@ enic_copy_item_sctp_v2(struct copy_item_args *arg) mask = &rte_flow_item_sctp_mask; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index b20f30fb4..14a82426e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -801,7 +801,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload, *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -841,8 +841,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -886,8 +886,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1091,7 +1091,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; struct rte_ipv6_hdr *gtp_ipv6; @@ -1138,8 +1138,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->dst_port = fdir_input->flow.tcp4_flow.src_port; tcp->data_off = I40E_FDIR_TCP_DEFAULT_DATAOFF; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1175,8 +1175,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->src_port = fdir_input->flow.udp6_flow.dst_port; tcp->dst_port = fdir_input->flow.udp6_flow.src_port; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 52ce536e0..edd4509ee 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -307,7 +307,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 103a020c8..7a6750e02 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1422,7 +1422,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 9fc98b401..2e15de46d 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1766,7 +1766,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 217340e59..08b2f5df5 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -436,7 +436,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_SCTP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 8088d9412..07a53abc3 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -77,7 +77,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; info->l2_len = sizeof(struct rte_ether_hdr); @@ -126,7 +126,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i tcp_hdr->cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *)((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; ol_flags |= PKT_TX_SCTP_CKSUM; } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 0bf55a62f..f93427a44 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -731,7 +731,7 @@ static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { * Matches a SCTP header. */ struct rte_flow_item_sctp { - struct sctp_hdr hdr; /**< SCTP header definition. */ + struct rte_sctp_hdr hdr; /**< SCTP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 712383484..4a46df58d 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -370,7 +370,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = (th->data_off & 0xf0) >> 2; return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_SCTP) { - hdr_lens->l4_len = sizeof(struct sctp_hdr); + hdr_lens->l4_len = sizeof(struct rte_sctp_hdr); return pkt_type; } else { uint32_t prev_off = off; @@ -506,7 +506,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = (th->data_off & 0xf0) >> 2; } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_SCTP) { - hdr_lens->inner_l4_len = sizeof(struct sctp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_sctp_hdr); } else { hdr_lens->inner_l4_len = 0; } diff --git a/lib/librte_net/rte_sctp.h b/lib/librte_net/rte_sctp.h index bfb7165a6..b3661b0db 100644 --- a/lib/librte_net/rte_sctp.h +++ b/lib/librte_net/rte_sctp.h @@ -23,7 +23,7 @@ extern "C" { /** * SCTP Header */ -struct sctp_hdr { +struct rte_sctp_hdr { uint16_t src_port; /**< Source port. */ uint16_t dst_port; /**< Destin port. */ uint32_t tag; /**< Validation tag. */ diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 2960a5c8a..720d77ba6 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -226,7 +226,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: - net_hdr->csum_offset = (offsetof(struct sctp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_sctp_hdr, cksum)); break; } @@ -1031,7 +1031,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; - case (offsetof(struct sctp_hdr, cksum)): + case (offsetof(struct rte_sctp_hdr, cksum)): if (l4_proto == IPPROTO_SCTP) m->ol_flags |= PKT_TX_SCTP_CKSUM; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 13/14] net: add rte prefix to tcp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (12 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 12/14] net: add rte prefix to sctp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 14/14] net: add rte prefix to udp structure Olivier Matz ` (2 subsequent siblings) 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct tcp_hdr as struct rte_tcp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 12 ++++++------ app/test/packet_burst_generator.c | 10 +++++----- app/test/packet_burst_generator.h | 2 +- app/test/test_flow_classify.c | 6 +++--- doc/guides/sample_app_ug/flow_classify.rst | 4 ++-- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 8 ++++---- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/mlx5/mlx5_flow_tcf.c | 4 ++-- drivers/net/qede/qede_filter.c | 12 ++++++------ drivers/net/sfc/sfc_ef10_tx.c | 4 ++-- drivers/net/sfc/sfc_tso.c | 4 ++-- drivers/net/softnic/rte_eth_softnic_pipeline.c | 8 ++++---- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 4 ++-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 14 +++++++------- examples/flow_classify/flow_classify.c | 4 ++-- examples/ip_pipeline/pipeline.c | 8 ++++---- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 4 ++-- examples/vhost/main.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_tcp4.c | 4 ++-- lib/librte_gro/gro_tcp4.h | 10 +++++----- lib/librte_gro/gro_vxlan_tcp4.c | 6 +++--- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/gso_tcp4.c | 4 ++-- lib/librte_gso/gso_tunnel_tcp4.c | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_net.c | 8 ++++---- lib/librte_net/rte_net.h | 6 +++--- lib/librte_net/rte_tcp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 8 ++++---- lib/librte_vhost/virtio_net.c | 6 +++--- 45 files changed, 125 insertions(+), 125 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index ac1c2ec60..ae4a091dd 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -102,14 +102,14 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) static void parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4; info->l4_proto = ipv4_hdr->next_proto_id; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) info->l4_len = sizeof(struct udp_hdr); @@ -121,14 +121,14 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) static void parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv6_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) info->l4_len = sizeof(struct udp_hdr); @@ -364,7 +364,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -418,7 +418,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_UDP_SEG; } else if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 9aa07e176..5730f8129 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -106,14 +106,14 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, } uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct tcp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_tcp_hdr)); - memset(tcp_hdr, 0, sizeof(struct tcp_hdr)); + memset(tcp_hdr, 0, sizeof(struct rte_tcp_hdr)); tcp_hdr->src_port = rte_cpu_to_be_16(src_port); tcp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -389,7 +389,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: @@ -411,7 +411,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 98185c162..5cfe0c600 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -38,7 +38,7 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 85228486d..1a79326b8 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -74,7 +74,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -84,7 +84,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -528,7 +528,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct tcp_hdr pkt_tcp_hdr; + struct rte_tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); uint16_t src_port = 16; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 46703acbf..96a5c66d0 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -126,7 +126,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -136,7 +136,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 66ed885fa..d9a47159a 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -836,7 +836,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, int i; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { @@ -861,7 +861,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *) + tcp_hdr = (struct rte_tcp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); l4hash = HASH_L4_PORTS(tcp_hdr); @@ -879,7 +879,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l3hash = ipv6_hash(ipv6_hdr); if (ipv6_hdr->proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)(ipv6_hdr + 1); + tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 63243a79a..3a3964330 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -218,7 +218,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + + struct rte_tcp_hdr *tcp_hdr = (struct rte_tcp_hdr *)(l3_hdr + mbuf->l3_len); tcp_hdr->cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index f59215894..427d434f4 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -249,7 +249,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, break; case PKT_TX_TCP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct tcp_hdr, cksum)); + offsetof(struct rte_tcp_hdr, cksum)); cmd_len |= E1000_TXD_CMD_TCP; cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 3bfddc651..e36e9e1f7 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -294,7 +294,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 3671b3876..2e3599f33 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -75,7 +75,7 @@ #define TEST_BIT(val, bit_shift) (val & (1UL << bit_shift)) #define GET_L4_HDR_LEN(mbuf) \ - ((rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, \ + ((rte_pktmbuf_mtod_offset(mbuf, struct rte_tcp_hdr *, \ mbuf->l3_len + mbuf->l2_len)->data_off) >> 4) #define ENA_RX_RSS_TABLE_LOG_SIZE 7 diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 6c37e2ec5..90494299a 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -137,7 +137,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -151,7 +151,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); @@ -232,7 +232,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -245,7 +245,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, tcp_val.dst_port = input->flow.tcp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 9dee5d2ee..76eba44a4 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -487,7 +487,7 @@ enic_copy_item_tcp_v1(struct copy_item_args *arg) const struct rte_flow_item_tcp *spec = item->spec; const struct rte_flow_item_tcp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct tcp_hdr supported_mask = { + struct rte_tcp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -653,7 +653,7 @@ enic_copy_item_inner_tcp_v2(struct copy_item_args *arg) mask = &rte_flow_item_tcp_mask; /* Append tcp header to L5 and set ip proto = tcp */ return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct tcp_hdr), + arg->item->spec, mask, sizeof(struct rte_tcp_hdr), arg->l3_proto_off, IPPROTO_TCP, 1); } @@ -845,9 +845,9 @@ enic_copy_item_tcp_v2(struct copy_item_args *arg) return ENOTSUP; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 14a82426e..46dfa79b7 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -800,7 +800,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload, *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ @@ -828,8 +828,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -873,8 +873,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1090,7 +1090,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload = NULL; unsigned char *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; @@ -1127,8 +1127,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp4_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1164,8 +1164,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp6_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index edd4509ee..6b8e586e5 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -302,7 +302,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 7a6750e02..9c733a596 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1417,7 +1417,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 2e15de46d..0862ab0cc 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1761,7 +1761,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 08b2f5df5..c720a6db9 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -429,7 +429,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 43a5dd4cb..a1e90ea2d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2607,11 +2607,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp4_flow.src_port, .dst_port = input->flow.tcp4_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2637,11 +2637,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp6_flow.src_port, .dst_port = input->flow.tcp6_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 743ae8546..c118ede97 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -776,8 +776,8 @@ flow_tcf_pedit_key_set_tp_port(const struct rte_flow_action *actions, /* offset of src/dst port is same for TCP and UDP */ p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC ? - offsetof(struct tcp_hdr, src_port) : - offsetof(struct tcp_hdr, dst_port); + offsetof(struct rte_tcp_hdr, src_port) : + offsetof(struct rte_tcp_hdr, dst_port); p_parser->keys[idx].mask = 0xFFFF0000; p_parser->keys[idx].val = (__u32)((const struct rte_flow_action_set_tp *) diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 34299b993..cd762cddb 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -460,7 +460,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; uint16_t len; raw_pkt = (uint8_t *)buff; @@ -496,13 +496,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, ip->total_length += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct tcp_hdr); + ip->total_length += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; @@ -528,11 +528,11 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, len += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index 055389efe..4e4f35827 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -373,7 +373,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, size_t header_len = tcph_off + m_seg->l4_len; /* Offset of the payload in the last segment that contains the header */ size_t in_off = 0; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; uint16_t packet_id = 0; uint16_t outer_packet_id = 0; uint32_t sent_seq; @@ -489,7 +489,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, outer_packet_id = sfc_tso_ip4_get_ipid(hdr_addr, first_m_seg->outer_l2_len); - th = (const struct tcp_hdr *)(hdr_addr + tcph_off); + th = (const struct rte_tcp_hdr *)(hdr_addr + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index 1374aceaa..2e34fc045 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -95,7 +95,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, unsigned int *pkt_descs, size_t *pkt_len) { uint8_t *tsoh; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; efsys_dma_addr_t header_paddr; uint16_t packet_id = 0; uint32_t sent_seq; @@ -150,7 +150,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, packet_id = sfc_tso_ip4_get_ipid(tsoh, nh_off); /* Handle TCP header */ - th = (const struct tcp_hdr *)(tsoh + tcph_off); + th = (const struct rte_tcp_hdr *)(tsoh + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index e0e5856a4..337aa32e5 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -688,7 +688,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -698,7 +698,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -785,7 +785,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -795,7 +795,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 2465d9c2c..a6d3baa5f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -510,7 +510,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) - *l4_cksum = &((struct tcp_hdr *)l4_hdr)->cksum; + *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else return; **l4_cksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 2b1080155..6c3f21bfb 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -481,7 +481,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) m->l4_len)) { struct rte_ipv4_hdr *iph; struct rte_ipv6_hdr *ip6h; - struct tcp_hdr *th; + struct rte_tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; @@ -545,7 +545,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, case PKT_TX_TCP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct tcp_hdr, cksum); + hdr->csum_offset = offsetof(struct rte_tcp_hdr, cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 949798c39..550cd8738 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -541,7 +541,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, switch (txm->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct tcp_hdr, cksum); + gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); @@ -669,7 +669,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, uint32_t hlen, slen; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; char *ptr; RTE_ASSERT(rcd->tcp); @@ -681,7 +681,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) return hw->mtu - sizeof(struct rte_ipv4_hdr) - - sizeof(struct tcp_hdr); + - sizeof(struct rte_tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * @@ -689,7 +689,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - - sizeof(struct tcp_hdr); + sizeof(struct rte_tcp_hdr); ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); hlen += sizeof(struct rte_ipv6_hdr); @@ -701,11 +701,11 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } } - if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) - return hw->mtu - hlen - sizeof(struct tcp_hdr) + + if (unlikely(slen < hlen + sizeof(struct rte_tcp_hdr))) + return hw->mtu - hlen - sizeof(struct rte_tcp_hdr) + sizeof(struct rte_ether_hdr); - tcp_hdr = (struct tcp_hdr *)(ptr + hlen); + tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; if (rxm->udata64 > 1) diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index e68d0f694..75a66fd5b 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -133,7 +133,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -143,7 +143,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index 9cc7e32d8..b627310a0 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -664,7 +664,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -674,7 +674,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -761,7 +761,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -771,7 +771,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 959925e73..cd43b37dc 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -527,7 +527,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -537,7 +537,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); @@ -566,7 +566,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -577,7 +577,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 5e3809b8d..d57ac262b 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -366,7 +366,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -376,7 +376,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 07a53abc3..261332adf 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -76,7 +76,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -112,7 +112,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); /* Put PKT_TX_TCP_SEG bit setting before get_psd_sum(), because * it depends on PKT_TX_TCP_SEG to calculate pseudo-header * checksum. diff --git a/examples/vhost/main.c b/examples/vhost/main.c index ce14b100a..a8719caec 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -865,7 +865,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; struct rte_ipv4_hdr *ipv4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); l3_hdr = (char *)eth_hdr + m->l2_len; @@ -876,7 +876,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) m->ol_flags |= PKT_TX_IP_CKSUM; } - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + m->l3_len); tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags); } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index f93427a44..fcf444ffd 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -712,7 +712,7 @@ static const struct rte_flow_item_udp rte_flow_item_udp_mask = { * Matches a TCP header. */ struct rte_flow_item_tcp { - struct tcp_hdr hdr; /**< TCP header definition. */ + struct rte_tcp_hdr hdr; /**< TCP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 20f2ea7e6..70d8c5d19 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -196,7 +196,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; uint16_t ip_id, hdr_len, frag_off; @@ -217,7 +217,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; /* diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 0a42a1ae8..9fe291191 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -20,7 +20,7 @@ /* The maximum TCP header length */ #define MAX_TCP_HLEN 60 #define INVALID_TCP_HDRLEN(len) \ - (((len) < sizeof(struct tcp_hdr)) || ((len) > MAX_TCP_HLEN)) + (((len) < sizeof(struct rte_tcp_hdr)) || ((len) > MAX_TCP_HLEN)) /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { @@ -260,7 +260,7 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, */ static inline int check_seq_option(struct gro_tcp4_item *item, - struct tcp_hdr *tcph, + struct rte_tcp_hdr *tcph, uint32_t sent_seq, uint16_t ip_id, uint16_t tcp_hl, @@ -270,16 +270,16 @@ check_seq_option(struct gro_tcp4_item *item, { struct rte_mbuf *pkt_orig = item->firstseg; struct rte_ipv4_hdr *iph_orig; - struct tcp_hdr *tcph_orig; + struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); - tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); + tcph_orig = (struct rte_tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; /* Check if TCP option fields equal */ - len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct tcp_hdr); + len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct rte_tcp_hdr); if ((tcp_hl != tcp_hl_orig) || ((len > 0) && (memcmp(tcph + 1, tcph_orig + 1, len) != 0))) diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index d26aa95b4..e8adb310b 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -207,7 +207,7 @@ is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, static inline int check_vxlan_seq_option(struct gro_vxlan_tcp4_item *item, - struct tcp_hdr *tcp_hdr, + struct rte_tcp_hdr *tcp_hdr, uint32_t sent_seq, uint16_t outer_ip_id, uint16_t ip_id, @@ -291,7 +291,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; @@ -323,7 +323,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* * Don't process the packet which has FIN, SYN, RST, PSH, URG, diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 13c9aeea8..3edd2429b 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -71,9 +71,9 @@ static inline void update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, uint8_t non_tail) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; - tcp_hdr = (struct tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + tcp_hdr = (struct rte_tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l4_offset); tcp_hdr->sent_seq = rte_cpu_to_be_32(sent_seq); if (likely(non_tail)) diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index ad0cce6f9..ade172ac7 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -10,7 +10,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; @@ -18,7 +18,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index f5a19bc43..e0384c26d 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -10,7 +10,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; uint16_t outer_ipv4_offset, inner_ipv4_offset; @@ -32,7 +32,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index ee879968c..8f65adf1c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,7 +19,7 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 4a46df58d..268892cc9 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -360,8 +360,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = sizeof(struct udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) @@ -496,8 +496,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = sizeof(struct udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 5c9a37a94..57b5ce363 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -114,7 +114,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -170,7 +170,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) (ol_flags & PKT_TX_TCP_SEG)) { if (ol_flags & PKT_TX_IPV4) { /* non-TSO tcp or TSO */ - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + m->l3_len); tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -178,7 +178,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ - tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, + tcp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_tcp_hdr *, inner_l3_offset + m->l3_len); tcp_hdr->cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h index 91f58987b..4bcda5565 100644 --- a/lib/librte_net/rte_tcp.h +++ b/lib/librte_net/rte_tcp.h @@ -23,7 +23,7 @@ extern "C" { /** * TCP Header */ -struct tcp_hdr { +struct rte_tcp_hdr { uint16_t src_port; /**< TCP source port. */ uint16_t dst_port; /**< TCP destination port. */ uint32_t sent_seq; /**< TX data sequence number. */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 682df6cc4..3df121c06 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -1340,7 +1340,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1379,7 +1379,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1426,7 +1426,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, @@ -1454,7 +1454,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 720d77ba6..fadfa3288 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -218,7 +218,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) switch (csum_l4) { case PKT_TX_TCP_CKSUM: - net_hdr->csum_offset = (offsetof(struct tcp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_tcp_hdr, cksum)); break; case PKT_TX_UDP_CKSUM: @@ -1014,7 +1014,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) { uint16_t l4_proto = 0; void *l4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; if (hdr->flags == 0 && hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE) return; @@ -1023,7 +1023,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (hdr->flags == VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (hdr->csum_start == (m->l2_len + m->l3_len)) { switch (hdr->csum_offset) { - case (offsetof(struct tcp_hdr, cksum)): + case (offsetof(struct rte_tcp_hdr, cksum)): if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 13/14] net: add rte prefix to tcp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 13/14] net: add rte prefix to tcp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct tcp_hdr as struct rte_tcp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 12 ++++++------ app/test/packet_burst_generator.c | 10 +++++----- app/test/packet_burst_generator.h | 2 +- app/test/test_flow_classify.c | 6 +++--- doc/guides/sample_app_ug/flow_classify.rst | 4 ++-- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 8 ++++---- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/mlx5/mlx5_flow_tcf.c | 4 ++-- drivers/net/qede/qede_filter.c | 12 ++++++------ drivers/net/sfc/sfc_ef10_tx.c | 4 ++-- drivers/net/sfc/sfc_tso.c | 4 ++-- drivers/net/softnic/rte_eth_softnic_pipeline.c | 8 ++++---- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 4 ++-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 14 +++++++------- examples/flow_classify/flow_classify.c | 4 ++-- examples/ip_pipeline/pipeline.c | 8 ++++---- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 4 ++-- examples/vhost/main.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_tcp4.c | 4 ++-- lib/librte_gro/gro_tcp4.h | 10 +++++----- lib/librte_gro/gro_vxlan_tcp4.c | 6 +++--- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/gso_tcp4.c | 4 ++-- lib/librte_gso/gso_tunnel_tcp4.c | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_net.c | 8 ++++---- lib/librte_net/rte_net.h | 6 +++--- lib/librte_net/rte_tcp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 8 ++++---- lib/librte_vhost/virtio_net.c | 6 +++--- 45 files changed, 125 insertions(+), 125 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index ac1c2ec60..ae4a091dd 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -102,14 +102,14 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) static void parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4; info->l4_proto = ipv4_hdr->next_proto_id; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) info->l4_len = sizeof(struct udp_hdr); @@ -121,14 +121,14 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) static void parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv6_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) info->l4_len = sizeof(struct udp_hdr); @@ -364,7 +364,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -418,7 +418,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_UDP_SEG; } else if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 9aa07e176..5730f8129 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -106,14 +106,14 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, } uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct tcp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_tcp_hdr)); - memset(tcp_hdr, 0, sizeof(struct tcp_hdr)); + memset(tcp_hdr, 0, sizeof(struct rte_tcp_hdr)); tcp_hdr->src_port = rte_cpu_to_be_16(src_port); tcp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -389,7 +389,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: @@ -411,7 +411,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 98185c162..5cfe0c600 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -38,7 +38,7 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 85228486d..1a79326b8 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -74,7 +74,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -84,7 +84,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -528,7 +528,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct tcp_hdr pkt_tcp_hdr; + struct rte_tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); uint16_t src_port = 16; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 46703acbf..96a5c66d0 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -126,7 +126,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -136,7 +136,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 66ed885fa..d9a47159a 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -836,7 +836,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, int i; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { @@ -861,7 +861,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *) + tcp_hdr = (struct rte_tcp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); l4hash = HASH_L4_PORTS(tcp_hdr); @@ -879,7 +879,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l3hash = ipv6_hash(ipv6_hdr); if (ipv6_hdr->proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)(ipv6_hdr + 1); + tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 63243a79a..3a3964330 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -218,7 +218,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + + struct rte_tcp_hdr *tcp_hdr = (struct rte_tcp_hdr *)(l3_hdr + mbuf->l3_len); tcp_hdr->cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index f59215894..427d434f4 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -249,7 +249,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, break; case PKT_TX_TCP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct tcp_hdr, cksum)); + offsetof(struct rte_tcp_hdr, cksum)); cmd_len |= E1000_TXD_CMD_TCP; cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 3bfddc651..e36e9e1f7 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -294,7 +294,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 3671b3876..2e3599f33 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -75,7 +75,7 @@ #define TEST_BIT(val, bit_shift) (val & (1UL << bit_shift)) #define GET_L4_HDR_LEN(mbuf) \ - ((rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, \ + ((rte_pktmbuf_mtod_offset(mbuf, struct rte_tcp_hdr *, \ mbuf->l3_len + mbuf->l2_len)->data_off) >> 4) #define ENA_RX_RSS_TABLE_LOG_SIZE 7 diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 6c37e2ec5..90494299a 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -137,7 +137,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -151,7 +151,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); @@ -232,7 +232,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -245,7 +245,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, tcp_val.dst_port = input->flow.tcp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 9dee5d2ee..76eba44a4 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -487,7 +487,7 @@ enic_copy_item_tcp_v1(struct copy_item_args *arg) const struct rte_flow_item_tcp *spec = item->spec; const struct rte_flow_item_tcp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct tcp_hdr supported_mask = { + struct rte_tcp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -653,7 +653,7 @@ enic_copy_item_inner_tcp_v2(struct copy_item_args *arg) mask = &rte_flow_item_tcp_mask; /* Append tcp header to L5 and set ip proto = tcp */ return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct tcp_hdr), + arg->item->spec, mask, sizeof(struct rte_tcp_hdr), arg->l3_proto_off, IPPROTO_TCP, 1); } @@ -845,9 +845,9 @@ enic_copy_item_tcp_v2(struct copy_item_args *arg) return ENOTSUP; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 14a82426e..46dfa79b7 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -800,7 +800,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload, *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ @@ -828,8 +828,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -873,8 +873,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1090,7 +1090,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload = NULL; unsigned char *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; @@ -1127,8 +1127,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp4_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1164,8 +1164,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp6_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index edd4509ee..6b8e586e5 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -302,7 +302,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 7a6750e02..9c733a596 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1417,7 +1417,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 2e15de46d..0862ab0cc 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1761,7 +1761,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 08b2f5df5..c720a6db9 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -429,7 +429,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 43a5dd4cb..a1e90ea2d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2607,11 +2607,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp4_flow.src_port, .dst_port = input->flow.tcp4_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2637,11 +2637,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp6_flow.src_port, .dst_port = input->flow.tcp6_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 743ae8546..c118ede97 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -776,8 +776,8 @@ flow_tcf_pedit_key_set_tp_port(const struct rte_flow_action *actions, /* offset of src/dst port is same for TCP and UDP */ p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC ? - offsetof(struct tcp_hdr, src_port) : - offsetof(struct tcp_hdr, dst_port); + offsetof(struct rte_tcp_hdr, src_port) : + offsetof(struct rte_tcp_hdr, dst_port); p_parser->keys[idx].mask = 0xFFFF0000; p_parser->keys[idx].val = (__u32)((const struct rte_flow_action_set_tp *) diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 34299b993..cd762cddb 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -460,7 +460,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; uint16_t len; raw_pkt = (uint8_t *)buff; @@ -496,13 +496,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, ip->total_length += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct tcp_hdr); + ip->total_length += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; @@ -528,11 +528,11 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, len += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index 055389efe..4e4f35827 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -373,7 +373,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, size_t header_len = tcph_off + m_seg->l4_len; /* Offset of the payload in the last segment that contains the header */ size_t in_off = 0; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; uint16_t packet_id = 0; uint16_t outer_packet_id = 0; uint32_t sent_seq; @@ -489,7 +489,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, outer_packet_id = sfc_tso_ip4_get_ipid(hdr_addr, first_m_seg->outer_l2_len); - th = (const struct tcp_hdr *)(hdr_addr + tcph_off); + th = (const struct rte_tcp_hdr *)(hdr_addr + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index 1374aceaa..2e34fc045 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -95,7 +95,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, unsigned int *pkt_descs, size_t *pkt_len) { uint8_t *tsoh; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; efsys_dma_addr_t header_paddr; uint16_t packet_id = 0; uint32_t sent_seq; @@ -150,7 +150,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, packet_id = sfc_tso_ip4_get_ipid(tsoh, nh_off); /* Handle TCP header */ - th = (const struct tcp_hdr *)(tsoh + tcph_off); + th = (const struct rte_tcp_hdr *)(tsoh + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index e0e5856a4..337aa32e5 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -688,7 +688,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -698,7 +698,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -785,7 +785,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -795,7 +795,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 2465d9c2c..a6d3baa5f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -510,7 +510,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) - *l4_cksum = &((struct tcp_hdr *)l4_hdr)->cksum; + *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else return; **l4_cksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 2b1080155..6c3f21bfb 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -481,7 +481,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) m->l4_len)) { struct rte_ipv4_hdr *iph; struct rte_ipv6_hdr *ip6h; - struct tcp_hdr *th; + struct rte_tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; @@ -545,7 +545,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, case PKT_TX_TCP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct tcp_hdr, cksum); + hdr->csum_offset = offsetof(struct rte_tcp_hdr, cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 949798c39..550cd8738 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -541,7 +541,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, switch (txm->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct tcp_hdr, cksum); + gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); @@ -669,7 +669,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, uint32_t hlen, slen; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; char *ptr; RTE_ASSERT(rcd->tcp); @@ -681,7 +681,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) return hw->mtu - sizeof(struct rte_ipv4_hdr) - - sizeof(struct tcp_hdr); + - sizeof(struct rte_tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * @@ -689,7 +689,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - - sizeof(struct tcp_hdr); + sizeof(struct rte_tcp_hdr); ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); hlen += sizeof(struct rte_ipv6_hdr); @@ -701,11 +701,11 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } } - if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) - return hw->mtu - hlen - sizeof(struct tcp_hdr) + + if (unlikely(slen < hlen + sizeof(struct rte_tcp_hdr))) + return hw->mtu - hlen - sizeof(struct rte_tcp_hdr) + sizeof(struct rte_ether_hdr); - tcp_hdr = (struct tcp_hdr *)(ptr + hlen); + tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; if (rxm->udata64 > 1) diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index e68d0f694..75a66fd5b 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -133,7 +133,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -143,7 +143,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index 9cc7e32d8..b627310a0 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -664,7 +664,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -674,7 +674,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -761,7 +761,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -771,7 +771,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 959925e73..cd43b37dc 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -527,7 +527,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -537,7 +537,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); @@ -566,7 +566,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -577,7 +577,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 5e3809b8d..d57ac262b 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -366,7 +366,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -376,7 +376,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 07a53abc3..261332adf 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -76,7 +76,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -112,7 +112,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); /* Put PKT_TX_TCP_SEG bit setting before get_psd_sum(), because * it depends on PKT_TX_TCP_SEG to calculate pseudo-header * checksum. diff --git a/examples/vhost/main.c b/examples/vhost/main.c index ce14b100a..a8719caec 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -865,7 +865,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; struct rte_ipv4_hdr *ipv4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); l3_hdr = (char *)eth_hdr + m->l2_len; @@ -876,7 +876,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) m->ol_flags |= PKT_TX_IP_CKSUM; } - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + m->l3_len); tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags); } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index f93427a44..fcf444ffd 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -712,7 +712,7 @@ static const struct rte_flow_item_udp rte_flow_item_udp_mask = { * Matches a TCP header. */ struct rte_flow_item_tcp { - struct tcp_hdr hdr; /**< TCP header definition. */ + struct rte_tcp_hdr hdr; /**< TCP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 20f2ea7e6..70d8c5d19 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -196,7 +196,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; uint16_t ip_id, hdr_len, frag_off; @@ -217,7 +217,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; /* diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 0a42a1ae8..9fe291191 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -20,7 +20,7 @@ /* The maximum TCP header length */ #define MAX_TCP_HLEN 60 #define INVALID_TCP_HDRLEN(len) \ - (((len) < sizeof(struct tcp_hdr)) || ((len) > MAX_TCP_HLEN)) + (((len) < sizeof(struct rte_tcp_hdr)) || ((len) > MAX_TCP_HLEN)) /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { @@ -260,7 +260,7 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, */ static inline int check_seq_option(struct gro_tcp4_item *item, - struct tcp_hdr *tcph, + struct rte_tcp_hdr *tcph, uint32_t sent_seq, uint16_t ip_id, uint16_t tcp_hl, @@ -270,16 +270,16 @@ check_seq_option(struct gro_tcp4_item *item, { struct rte_mbuf *pkt_orig = item->firstseg; struct rte_ipv4_hdr *iph_orig; - struct tcp_hdr *tcph_orig; + struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); - tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); + tcph_orig = (struct rte_tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; /* Check if TCP option fields equal */ - len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct tcp_hdr); + len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct rte_tcp_hdr); if ((tcp_hl != tcp_hl_orig) || ((len > 0) && (memcmp(tcph + 1, tcph_orig + 1, len) != 0))) diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index d26aa95b4..e8adb310b 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -207,7 +207,7 @@ is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, static inline int check_vxlan_seq_option(struct gro_vxlan_tcp4_item *item, - struct tcp_hdr *tcp_hdr, + struct rte_tcp_hdr *tcp_hdr, uint32_t sent_seq, uint16_t outer_ip_id, uint16_t ip_id, @@ -291,7 +291,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; @@ -323,7 +323,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* * Don't process the packet which has FIN, SYN, RST, PSH, URG, diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 13c9aeea8..3edd2429b 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -71,9 +71,9 @@ static inline void update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, uint8_t non_tail) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; - tcp_hdr = (struct tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + tcp_hdr = (struct rte_tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l4_offset); tcp_hdr->sent_seq = rte_cpu_to_be_32(sent_seq); if (likely(non_tail)) diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index ad0cce6f9..ade172ac7 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -10,7 +10,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; @@ -18,7 +18,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index f5a19bc43..e0384c26d 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -10,7 +10,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; uint16_t outer_ipv4_offset, inner_ipv4_offset; @@ -32,7 +32,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index ee879968c..8f65adf1c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,7 +19,7 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 4a46df58d..268892cc9 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -360,8 +360,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = sizeof(struct udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) @@ -496,8 +496,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = sizeof(struct udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 5c9a37a94..57b5ce363 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -114,7 +114,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -170,7 +170,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) (ol_flags & PKT_TX_TCP_SEG)) { if (ol_flags & PKT_TX_IPV4) { /* non-TSO tcp or TSO */ - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + m->l3_len); tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -178,7 +178,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ - tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, + tcp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_tcp_hdr *, inner_l3_offset + m->l3_len); tcp_hdr->cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h index 91f58987b..4bcda5565 100644 --- a/lib/librte_net/rte_tcp.h +++ b/lib/librte_net/rte_tcp.h @@ -23,7 +23,7 @@ extern "C" { /** * TCP Header */ -struct tcp_hdr { +struct rte_tcp_hdr { uint16_t src_port; /**< TCP source port. */ uint16_t dst_port; /**< TCP destination port. */ uint32_t sent_seq; /**< TX data sequence number. */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 682df6cc4..3df121c06 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -1340,7 +1340,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1379,7 +1379,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1426,7 +1426,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, @@ -1454,7 +1454,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 720d77ba6..fadfa3288 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -218,7 +218,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) switch (csum_l4) { case PKT_TX_TCP_CKSUM: - net_hdr->csum_offset = (offsetof(struct tcp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_tcp_hdr, cksum)); break; case PKT_TX_UDP_CKSUM: @@ -1014,7 +1014,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) { uint16_t l4_proto = 0; void *l4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; if (hdr->flags == 0 && hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE) return; @@ -1023,7 +1023,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (hdr->flags == VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (hdr->csum_start == (m->l2_len + m->l3_len)) { switch (hdr->csum_offset) { - case (offsetof(struct tcp_hdr, cksum)): + case (offsetof(struct rte_tcp_hdr, cksum)): if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 14/14] net: add rte prefix to udp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (13 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 13/14] net: add rte prefix to tcp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-05-20 17:11 ` [dpdk-dev] [RFC v2 00/14] prefix network structures Ferruh Yigit 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz 16 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct udp_hdr as struct rte_udp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 24 ++++++++++++------------ app/test-pmd/flowgen.c | 4 ++-- app/test-pmd/txonly.c | 8 ++++---- app/test-pmd/util.c | 6 +++--- app/test/packet_burst_generator.c | 12 ++++++------ app/test/packet_burst_generator.h | 4 ++-- app/test/test_flow_classify.c | 2 +- app/test/test_link_bonding.c | 4 ++-- app/test/test_link_bonding_mode4.c | 2 +- app/test/test_pmd_perf.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 22 +++++++++++----------- drivers/net/i40e/i40e_fdir.c | 24 ++++++++++++------------ drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/mlx5/mlx5_flow_dv.c | 4 ++-- drivers/net/qede/qede_filter.c | 14 +++++++------- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 2 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 16 ++++++++-------- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 10 +++++----- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_ether.h | 4 ++-- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_net.h | 6 +++--- lib/librte_net/rte_udp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 32 ++++++++++++++++---------------- lib/librte_vhost/virtio_net.c | 6 +++--- 40 files changed, 137 insertions(+), 137 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index ae4a091dd..55926e812 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -112,7 +112,7 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) - info->l4_len = sizeof(struct udp_hdr); + info->l4_len = sizeof(struct rte_udp_hdr); else info->l4_len = 0; } @@ -131,7 +131,7 @@ parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) - info->l4_len = sizeof(struct udp_hdr); + info->l4_len = sizeof(struct rte_udp_hdr); else info->l4_len = 0; } @@ -176,7 +176,7 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) /* Parse a vxlan header */ static void -parse_vxlan(struct udp_hdr *udp_hdr, +parse_vxlan(struct rte_udp_hdr *udp_hdr, struct testpmd_offload_info *info, uint32_t pkt_type) { @@ -196,7 +196,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, info->outer_l4_proto = info->l4_proto; eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); @@ -205,7 +205,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, /* Parse a vxlan-gpe header */ static void -parse_vxlan_gpe(struct udp_hdr *udp_hdr, +parse_vxlan_gpe(struct rte_udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; @@ -219,7 +219,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, return; vxlan_gpe_hdr = (struct rte_vxlan_gpe_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == RTE_VXLAN_GPE_TYPE_IPV4) { @@ -363,7 +363,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -403,7 +403,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, return 0; /* packet type not supported, nothing to do */ if (info->l4_proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info->l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; @@ -455,7 +455,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint64_t ol_flags = 0; if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPv4)) { @@ -478,7 +478,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, return ol_flags; } - udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len); /* outer UDP checksum is done in software. In the other side, for * UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be @@ -776,9 +776,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* check if it's a supported tunnel */ if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info.l3_len); parse_vxlan_gpe(udp_hdr, &info); if (info.is_tunnel) { diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 46fd6e41f..fd2c860fb 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -121,7 +121,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ip_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags = 0; uint16_t nb_rx; @@ -193,7 +193,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) sizeof(*ip_hdr)); /* Initialize UDP header. */ - udp_hdr = (struct udp_hdr *)(ip_hdr + 1); + udp_hdr = (struct rte_udp_hdr *)(ip_hdr + 1); udp_hdr->src_port = rte_cpu_to_be_16(cfg_udp_src); udp_hdr->dst_port = rte_cpu_to_be_16(cfg_udp_dst); udp_hdr->dgram_cksum = 0; /* No UDP checksum. */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index f7f023ff6..ed402e042 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -53,7 +53,7 @@ static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ -static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ +static struct rte_udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ static void copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt, @@ -94,7 +94,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) static void setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, - struct udp_hdr *udp_hdr, + struct rte_udp_hdr *udp_hdr, uint16_t pkt_data_len) { uint16_t *ptr16; @@ -104,7 +104,7 @@ setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, /* * Initialize UDP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(UDP_SRC_PORT); udp_hdr->dst_port = rte_cpu_to_be_16(UDP_DST_PORT); udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt_len); @@ -347,7 +347,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - sizeof(struct udp_hdr))); + sizeof(struct rte_udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index b8e5548ca..a1164b705 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -105,7 +105,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (is_encapsulation) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; uint8_t l4_len; @@ -130,9 +130,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], } if (l4_proto == IPPROTO_UDP) { udp_hdr = rte_pktmbuf_mtod_offset(mb, - struct udp_hdr *, + struct rte_udp_hdr *, l2_len + l3_len); - l4_len = sizeof(struct udp_hdr); + l4_len = sizeof(struct rte_udp_hdr); vxlan_hdr = rte_pktmbuf_mtod_offset(mb, struct rte_vxlan_hdr *, l2_len + l3_len + l4_len); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 5730f8129..305ed3d0d 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -90,12 +90,12 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma } uint16_t -initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, +initialize_udp_header(struct rte_udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(src_port); udp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -126,7 +126,7 @@ initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); sctp_hdr->src_port = rte_cpu_to_be_16(src_port); sctp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -257,7 +257,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, + uint8_t ipv4, struct rte_udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { int i, nb_pkt = 0; @@ -384,7 +384,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, - sizeof(struct udp_hdr), pkt, + sizeof(struct rte_udp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_TCP: @@ -406,7 +406,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, - sizeof(struct udp_hdr), pkt, + sizeof(struct rte_udp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_TCP: diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 5cfe0c600..1ad444b2c 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -34,7 +34,7 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma uint32_t opcode); uint16_t -initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, +initialize_udp_header(struct rte_udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t @@ -60,7 +60,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, + uint8_t ipv4, struct rte_udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); int diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 1a79326b8..a9d32cd37 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -491,7 +491,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); uint16_t src_port = 32; diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 924de81ae..7d3d19034 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -80,13 +80,13 @@ struct link_bonding_unittest_params { struct rte_ether_hdr *pkt_eth_hdr; struct rte_ipv4_hdr *pkt_ipv4_hdr; struct rte_ipv6_hdr *pkt_ipv6_hdr; - struct udp_hdr *pkt_udp_hdr; + struct rte_udp_hdr *pkt_udp_hdr; }; static struct rte_ipv4_hdr pkt_ipv4_hdr; static struct rte_ipv6_hdr pkt_ipv6_hdr; -static struct udp_hdr pkt_udp_hdr; +static struct rte_udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { .bonded_port_id = -1, diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 4968cd91c..e3eab892c 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -732,7 +732,7 @@ generate_packets(struct rte_ether_addr *src_mac, uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; union { struct rte_ipv4_hdr v4; struct rte_ipv6_hdr v6; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 0d1c1b1ab..5e2dad9ec 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -184,7 +184,7 @@ init_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index d9a47159a..4386418d7 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -835,7 +835,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, size_t vlan_offset; int i; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; @@ -867,7 +867,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *) + udp_hdr = (struct rte_udp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); l4hash = HASH_L4_PORTS(udp_hdr); @@ -882,7 +882,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); + udp_hdr = (struct rte_udp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(udp_hdr); } } diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 3a3964330..89f29126a 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -229,7 +229,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) tcp_hdr); } else if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) { - struct udp_hdr *udp_hdr = (struct udp_hdr *)(l3_hdr + + struct rte_udp_hdr *udp_hdr = (struct rte_udp_hdr *)(l3_hdr + mbuf->l3_len); udp_hdr->dgram_cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 427d434f4..690574acf 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -244,7 +244,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, switch (flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct udp_hdr, dgram_cksum)); + offsetof(struct rte_udp_hdr, dgram_cksum)); cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; case PKT_TX_TCP_CKSUM: diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index e36e9e1f7..1910231b6 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -289,7 +289,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct udp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_udp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 90494299a..7b68f0df1 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -121,7 +121,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, memset(gp, 0, sizeof(*gp)); if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP) { - struct udp_hdr udp_mask, udp_val; + struct rte_udp_hdr udp_mask, udp_val; memset(&udp_mask, 0, sizeof(udp_mask)); memset(&udp_val, 0, sizeof(udp_val)); @@ -135,7 +135,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, - &udp_mask, &udp_val, sizeof(struct udp_hdr)); + &udp_mask, &udp_val, sizeof(struct rte_udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); @@ -217,7 +217,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { - struct udp_hdr udp_mask, udp_val; + struct rte_udp_hdr udp_mask, udp_val; memset(&udp_mask, 0, sizeof(udp_mask)); memset(&udp_val, 0, sizeof(udp_val)); @@ -230,7 +230,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, udp_val.dst_port = input->flow.udp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, - &udp_mask, &udp_val, sizeof(struct udp_hdr)); + &udp_mask, &udp_val, sizeof(struct rte_udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 76eba44a4..f7e18399a 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -448,7 +448,7 @@ enic_copy_item_udp_v1(struct copy_item_args *arg) const struct rte_flow_item_udp *spec = item->spec; const struct rte_flow_item_udp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct udp_hdr supported_mask = { + struct rte_udp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -638,7 +638,7 @@ enic_copy_item_inner_udp_v2(struct copy_item_args *arg) mask = &rte_flow_item_udp_mask; /* Append udp header to L5 and set ip proto = udp */ return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct udp_hdr), + arg->item->spec, mask, sizeof(struct rte_udp_hdr), arg->l3_proto_off, IPPROTO_UDP, 1); } @@ -816,9 +816,9 @@ enic_copy_item_udp_v2(struct copy_item_args *arg) mask = &rte_flow_item_udp_mask; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); return 0; } @@ -910,7 +910,7 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) const struct rte_flow_item_vxlan *spec = item->spec; const struct rte_flow_item_vxlan *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; FLOW_TRACE(); @@ -920,9 +920,9 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) */ gp->mask_flags |= FILTER_GENERIC_1_UDP; gp->val_flags |= FILTER_GENERIC_1_UDP; - udp = (struct udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].mask; + udp = (struct rte_udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].mask; udp->dst_port = 0xffff; - udp = (struct udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].val; + udp = (struct rte_udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].val; udp->dst_port = RTE_BE16(4789); /* Match all if no spec */ if (!spec) @@ -980,9 +980,9 @@ enic_copy_item_raw_v2(struct copy_item_args *arg) */ if (mask->length != 0 && mask->length < spec->length) return EINVAL; - memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr), mask->pattern, spec->length); - memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct rte_udp_hdr), spec->pattern, spec->length); return 0; @@ -1036,9 +1036,9 @@ fixup_l5_layer(struct enic *enic, struct filter_generic_1 *gp, return; FLOW_TRACE(); vxlan = sizeof(struct rte_vxlan_hdr); - memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr), gp->layer[FILTER_GENERIC_1_L5].mask, vxlan); - memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct rte_udp_hdr), gp->layer[FILTER_GENERIC_1_L5].val, vxlan); inner = inner_ofst - vxlan; memset(layer, 0, sizeof(layer)); diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 46dfa79b7..40f25febf 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -799,7 +799,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *raw_pkt) { unsigned char *payload, *ptr; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; @@ -815,8 +815,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, /* fill the L4 head */ switch (fdir_input->flow_type) { case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -860,8 +860,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1089,7 +1089,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload = NULL; unsigned char *ptr; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; @@ -1116,8 +1116,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, /* fill the L4 head */ if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1153,8 +1153,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, payload = raw_pkt + len; set_idx = I40E_FLXPLD_L3_IDX; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1206,12 +1206,12 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 || cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); gtp = (struct rte_flow_item_gtp *) - ((unsigned char *)udp + sizeof(struct udp_hdr)); + ((unsigned char *)udp + sizeof(struct rte_udp_hdr)); gtp->msg_len = rte_cpu_to_be_16(I40E_FDIR_GTP_DEFAULT_LEN); gtp->teid = fdir_input->flow.gtp_flow.teid; diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 6b8e586e5..a244ae65c 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -312,7 +312,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; default: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 9c733a596..ad897f2ca 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1427,7 +1427,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; default: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 0862ab0cc..4a2ac954c 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1771,7 +1771,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; default: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index c720a6db9..58966863a 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -422,7 +422,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_UDP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct udp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_udp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a1e90ea2d..307cc363f 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2592,11 +2592,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, /* Handle L4. */ switch (fdir_filter->input.flow_type) { case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: - attributes->l4.udp.hdr = (struct udp_hdr){ + attributes->l4.udp.hdr = (struct rte_udp_hdr){ .src_port = input->flow.udp4_flow.src_port, .dst_port = input->flow.udp4_flow.dst_port, }; - attributes->l4_mask.udp.hdr = (struct udp_hdr){ + attributes->l4_mask.udp.hdr = (struct rte_udp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2622,11 +2622,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - attributes->l4.udp.hdr = (struct udp_hdr){ + attributes->l4.udp.hdr = (struct rte_udp_hdr){ .src_port = input->flow.udp6_flow.src_port, .dst_port = input->flow.udp6_flow.dst_port, }; - attributes->l4_mask.udp.hdr = (struct udp_hdr){ + attributes->l4_mask.udp.hdr = (struct rte_udp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index d2a725469..bb3b1f68a 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1054,7 +1054,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, struct rte_vlan_hdr *vlan = NULL; struct rte_ipv4_hdr *ipv4 = NULL; struct rte_ipv6_hdr *ipv6 = NULL; - struct udp_hdr *udp = NULL; + struct rte_udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; struct rte_gre_hdr *gre = NULL; @@ -1125,7 +1125,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv6->hop_limits = MLX5_ENCAP_IPV6_HOP_LIMIT; break; case RTE_FLOW_ITEM_TYPE_UDP: - udp = (struct udp_hdr *)&buf[temp_size]; + udp = (struct rte_udp_hdr *)&buf[temp_size]; if (!ipv4 && !ipv6) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index cd762cddb..33eb9fc39 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -459,7 +459,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, uint8_t *raw_pkt; struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; uint16_t len; @@ -487,13 +487,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; /* UDP */ if (arfs->tuple.ip_proto == IPPROTO_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->dst_port = arfs->tuple.dst_port; udp->src_port = arfs->tuple.src_port; - udp->dgram_len = sizeof(struct udp_hdr); - len += sizeof(struct udp_hdr); + udp->dgram_len = sizeof(struct rte_udp_hdr); + len += sizeof(struct rte_udp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct udp_hdr); + ip->total_length += sizeof(struct rte_udp_hdr); params->udp = true; } else { /* TCP */ tcp = (struct rte_tcp_hdr *)(raw_pkt + len); @@ -522,10 +522,10 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; /* UDP */ if (arfs->tuple.ip_proto == IPPROTO_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->src_port = arfs->tuple.src_port; udp->dst_port = arfs->tuple.dst_port; - len += sizeof(struct udp_hdr); + len += sizeof(struct rte_udp_hdr); params->udp = true; } else { /* TCP */ tcp = (struct rte_tcp_hdr *)(raw_pkt + len); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index a6d3baa5f..266fe96bf 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -508,7 +508,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, l4_hdr = packet + l2_len + l3_len; if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) - *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; + *l4_cksum = &((struct rte_udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 6c3f21bfb..7ddf8fb0f 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -538,7 +538,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, switch (cookie->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct udp_hdr, + hdr->csum_offset = offsetof(struct rte_udp_hdr, dgram_cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 550cd8738..f5534344f 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -544,7 +544,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); + gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_udp_hdr, dgram_cksum); break; default: PMD_TX_LOG(WARNING, "requested cksum offload not supported %#llx", diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index cd43b37dc..c8f975491 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -528,7 +528,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, { struct ipv4_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; key.ip_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); @@ -544,7 +544,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); @@ -567,7 +567,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, { struct ipv6_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; memcpy(key.ip_dst, ipv6_hdr->dst_addr, IPV6_ADDR_LEN); @@ -584,7 +584,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d57ac262b..0ef469c29 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -367,7 +367,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, { struct ipv4_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; key.ip_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); @@ -383,7 +383,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 261332adf..166cd8a31 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -75,7 +75,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i uint16_t ethertype; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -107,7 +107,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i return 0; /* packet type not supported, nothing to do */ if (l4_proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info->l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); ol_flags |= PKT_TX_UDP_CKSUM; udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); @@ -139,7 +139,7 @@ decapsulation(struct rte_mbuf *pkt) { uint8_t l4_proto = 0; uint16_t outer_header_len; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; union tunnel_offload_info info = { .data = 0 }; struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); @@ -148,7 +148,7 @@ decapsulation(struct rte_mbuf *pkt) if (l4_proto != IPPROTO_UDP) return -1; - udp_hdr = (struct udp_hdr *)((char *)phdr + + udp_hdr = (struct rte_udp_hdr *)((char *)phdr + info.outer_l2_len + info.outer_l3_len); /** check udp destination port, 4789 is the default vxlan port @@ -158,7 +158,7 @@ decapsulation(struct rte_mbuf *pkt) (pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0) return -1; outer_header_len = info.outer_l2_len + info.outer_l3_len - + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr); + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr); rte_pktmbuf_adj(pkt, outer_header_len); @@ -177,10 +177,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) - + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; /* convert TX queue ID to vport ID */ @@ -224,7 +224,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*UDP HEADER*/ udp->dgram_cksum = 0; udp->dgram_len = rte_cpu_to_be_16(old_len - + sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); udp->dst_port = rte_cpu_to_be_16(vxdev.dst_port); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index fcf444ffd..9838792fd 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -693,7 +693,7 @@ static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = { * Matches a UDP header. */ struct rte_flow_item_udp { - struct udp_hdr hdr; /**< UDP header definition. */ + struct rte_udp_hdr hdr; /**< UDP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */ diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index e8adb310b..a081b5b39 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -263,7 +263,7 @@ static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { struct rte_ipv4_hdr *ipv4_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; @@ -275,7 +275,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the outer UDP header. */ len -= pkt->outer_l3_len; - udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + pkt->outer_l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + pkt->outer_l3_len); udp_hdr->dgram_len = rte_cpu_to_be_16(len); /* Update the inner IPv4 header. */ @@ -292,7 +292,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct rte_tcp_hdr *tcp_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; int32_t tcp_dl; @@ -316,10 +316,10 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); - udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); vxlan_hdr = (struct rte_vxlan_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 3edd2429b..a0b83436d 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -46,9 +46,9 @@ static inline void update_udp_header(struct rte_mbuf *pkt, uint16_t udp_offset) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + udp_hdr = (struct rte_udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + udp_offset); udp_hdr->dgram_len = rte_cpu_to_be_16(pkt->pkt_len - udp_offset); } diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 8f65adf1c..3aab297f4 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -23,7 +23,7 @@ extern "C" { /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index b8b545f37..d692f3dba 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -311,7 +311,7 @@ struct rte_vxlan_hdr { #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)) +#define RTE_ETHER_VXLAN_HLEN (sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -335,7 +335,7 @@ struct rte_vxlan_gpe_hdr { #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) + \ +#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 268892cc9..e1868f7da 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -357,7 +357,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) { - hdr_lens->l4_len = sizeof(struct udp_hdr); + hdr_lens->l4_len = sizeof(struct rte_udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { const struct rte_tcp_hdr *th; @@ -493,7 +493,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_UDP) { - hdr_lens->inner_l4_len = sizeof(struct udp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { const struct rte_tcp_hdr *th; diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 57b5ce363..e7c4f676e 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -115,7 +115,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct rte_tcp_hdr *tcp_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; #ifdef RTE_LIBRTE_ETHDEV_DEBUG @@ -153,7 +153,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) if ((ol_flags & PKT_TX_UDP_CKSUM) == PKT_TX_UDP_CKSUM) { if (ol_flags & PKT_TX_IPV4) { - udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + m->l3_len); udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -161,7 +161,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ - udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, + udp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *, inner_l3_offset + m->l3_len); udp_hdr->dgram_cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_udp.h b/lib/librte_net/rte_udp.h index ba033955c..1c3437c5f 100644 --- a/lib/librte_net/rte_udp.h +++ b/lib/librte_net/rte_udp.h @@ -23,7 +23,7 @@ extern "C" { /** * UDP Header */ -struct udp_hdr { +struct rte_udp_hdr { uint16_t src_port; /**< UDP source port. */ uint16_t dst_port; /**< UDP destination port. */ uint16_t dgram_len; /**< UDP datagram length */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 3df121c06..8ee85bfc1 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -492,7 +492,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -500,14 +500,14 @@ struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -515,7 +515,7 @@ struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -998,13 +998,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length); @@ -1028,13 +1028,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length); @@ -1058,10 +1058,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length); @@ -1084,10 +1084,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length); @@ -1358,7 +1358,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t ip_cksum, udp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1397,7 +1397,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t ip_cksum, udp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1439,7 +1439,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t udp_cksum; udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum, @@ -1467,7 +1467,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t udp_cksum; udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index fadfa3288..d0e9e90fe 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -222,7 +222,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) cksum)); break; case PKT_TX_UDP_CKSUM: - net_hdr->csum_offset = (offsetof(struct udp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_udp_hdr, dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: @@ -1027,7 +1027,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; - case (offsetof(struct udp_hdr, dgram_cksum)): + case (offsetof(struct rte_udp_hdr, dgram_cksum)): if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; @@ -1053,7 +1053,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) case VIRTIO_NET_HDR_GSO_UDP: m->ol_flags |= PKT_TX_UDP_SEG; m->tso_segsz = hdr->gso_size; - m->l4_len = sizeof(struct udp_hdr); + m->l4_len = sizeof(struct rte_udp_hdr); break; default: RTE_LOG(WARNING, VHOST_DATA, -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [RFC v2 14/14] net: add rte prefix to udp structure 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 14/14] net: add rte prefix to udp structure Olivier Matz @ 2019-04-10 8:32 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-04-10 8:32 UTC (permalink / raw) To: dev; +Cc: Ferruh Yigit Add 'rte_' prefix to structures: - rename struct udp_hdr as struct rte_udp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 24 ++++++++++++------------ app/test-pmd/flowgen.c | 4 ++-- app/test-pmd/txonly.c | 8 ++++---- app/test-pmd/util.c | 6 +++--- app/test/packet_burst_generator.c | 12 ++++++------ app/test/packet_burst_generator.h | 4 ++-- app/test/test_flow_classify.c | 2 +- app/test/test_link_bonding.c | 4 ++-- app/test/test_link_bonding_mode4.c | 2 +- app/test/test_pmd_perf.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 22 +++++++++++----------- drivers/net/i40e/i40e_fdir.c | 24 ++++++++++++------------ drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/mlx5/mlx5_flow_dv.c | 4 ++-- drivers/net/qede/qede_filter.c | 14 +++++++------- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 2 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 2 +- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 16 ++++++++-------- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 10 +++++----- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_ether.h | 4 ++-- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_net.h | 6 +++--- lib/librte_net/rte_udp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 32 ++++++++++++++++---------------- lib/librte_vhost/virtio_net.c | 6 +++--- 40 files changed, 137 insertions(+), 137 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index ae4a091dd..55926e812 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -112,7 +112,7 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) - info->l4_len = sizeof(struct udp_hdr); + info->l4_len = sizeof(struct rte_udp_hdr); else info->l4_len = 0; } @@ -131,7 +131,7 @@ parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) - info->l4_len = sizeof(struct udp_hdr); + info->l4_len = sizeof(struct rte_udp_hdr); else info->l4_len = 0; } @@ -176,7 +176,7 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) /* Parse a vxlan header */ static void -parse_vxlan(struct udp_hdr *udp_hdr, +parse_vxlan(struct rte_udp_hdr *udp_hdr, struct testpmd_offload_info *info, uint32_t pkt_type) { @@ -196,7 +196,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, info->outer_l4_proto = info->l4_proto; eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); @@ -205,7 +205,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, /* Parse a vxlan-gpe header */ static void -parse_vxlan_gpe(struct udp_hdr *udp_hdr, +parse_vxlan_gpe(struct rte_udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; @@ -219,7 +219,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, return; vxlan_gpe_hdr = (struct rte_vxlan_gpe_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == RTE_VXLAN_GPE_TYPE_IPV4) { @@ -363,7 +363,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -403,7 +403,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, return 0; /* packet type not supported, nothing to do */ if (info->l4_proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info->l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; @@ -455,7 +455,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint64_t ol_flags = 0; if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPv4)) { @@ -478,7 +478,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, return ol_flags; } - udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len); /* outer UDP checksum is done in software. In the other side, for * UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be @@ -776,9 +776,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* check if it's a supported tunnel */ if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info.l3_len); parse_vxlan_gpe(udp_hdr, &info); if (info.is_tunnel) { diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 46fd6e41f..fd2c860fb 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -121,7 +121,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ip_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags = 0; uint16_t nb_rx; @@ -193,7 +193,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) sizeof(*ip_hdr)); /* Initialize UDP header. */ - udp_hdr = (struct udp_hdr *)(ip_hdr + 1); + udp_hdr = (struct rte_udp_hdr *)(ip_hdr + 1); udp_hdr->src_port = rte_cpu_to_be_16(cfg_udp_src); udp_hdr->dst_port = rte_cpu_to_be_16(cfg_udp_dst); udp_hdr->dgram_cksum = 0; /* No UDP checksum. */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index f7f023ff6..ed402e042 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -53,7 +53,7 @@ static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ -static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ +static struct rte_udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ static void copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt, @@ -94,7 +94,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) static void setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, - struct udp_hdr *udp_hdr, + struct rte_udp_hdr *udp_hdr, uint16_t pkt_data_len) { uint16_t *ptr16; @@ -104,7 +104,7 @@ setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, /* * Initialize UDP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(UDP_SRC_PORT); udp_hdr->dst_port = rte_cpu_to_be_16(UDP_DST_PORT); udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt_len); @@ -347,7 +347,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - sizeof(struct udp_hdr))); + sizeof(struct rte_udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index b8e5548ca..a1164b705 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -105,7 +105,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (is_encapsulation) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; uint8_t l4_len; @@ -130,9 +130,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], } if (l4_proto == IPPROTO_UDP) { udp_hdr = rte_pktmbuf_mtod_offset(mb, - struct udp_hdr *, + struct rte_udp_hdr *, l2_len + l3_len); - l4_len = sizeof(struct udp_hdr); + l4_len = sizeof(struct rte_udp_hdr); vxlan_hdr = rte_pktmbuf_mtod_offset(mb, struct rte_vxlan_hdr *, l2_len + l3_len + l4_len); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 5730f8129..305ed3d0d 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -90,12 +90,12 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma } uint16_t -initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, +initialize_udp_header(struct rte_udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(src_port); udp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -126,7 +126,7 @@ initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); sctp_hdr->src_port = rte_cpu_to_be_16(src_port); sctp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -257,7 +257,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, + uint8_t ipv4, struct rte_udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { int i, nb_pkt = 0; @@ -384,7 +384,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, - sizeof(struct udp_hdr), pkt, + sizeof(struct rte_udp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_TCP: @@ -406,7 +406,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, - sizeof(struct udp_hdr), pkt, + sizeof(struct rte_udp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_TCP: diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 5cfe0c600..1ad444b2c 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -34,7 +34,7 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct rte_ether_addr *src_ma uint32_t opcode); uint16_t -initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, +initialize_udp_header(struct rte_udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t @@ -60,7 +60,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, + uint8_t ipv4, struct rte_udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); int diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 1a79326b8..a9d32cd37 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -491,7 +491,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); uint16_t src_port = 32; diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 924de81ae..7d3d19034 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -80,13 +80,13 @@ struct link_bonding_unittest_params { struct rte_ether_hdr *pkt_eth_hdr; struct rte_ipv4_hdr *pkt_ipv4_hdr; struct rte_ipv6_hdr *pkt_ipv6_hdr; - struct udp_hdr *pkt_udp_hdr; + struct rte_udp_hdr *pkt_udp_hdr; }; static struct rte_ipv4_hdr pkt_ipv4_hdr; static struct rte_ipv6_hdr pkt_ipv6_hdr; -static struct udp_hdr pkt_udp_hdr; +static struct rte_udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { .bonded_port_id = -1, diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 4968cd91c..e3eab892c 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -732,7 +732,7 @@ generate_packets(struct rte_ether_addr *src_mac, uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; union { struct rte_ipv4_hdr v4; struct rte_ipv6_hdr v6; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 0d1c1b1ab..5e2dad9ec 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -184,7 +184,7 @@ init_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index d9a47159a..4386418d7 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -835,7 +835,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, size_t vlan_offset; int i; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; @@ -867,7 +867,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *) + udp_hdr = (struct rte_udp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); l4hash = HASH_L4_PORTS(udp_hdr); @@ -882,7 +882,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); + udp_hdr = (struct rte_udp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(udp_hdr); } } diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 3a3964330..89f29126a 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -229,7 +229,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) tcp_hdr); } else if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) { - struct udp_hdr *udp_hdr = (struct udp_hdr *)(l3_hdr + + struct rte_udp_hdr *udp_hdr = (struct rte_udp_hdr *)(l3_hdr + mbuf->l3_len); udp_hdr->dgram_cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 427d434f4..690574acf 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -244,7 +244,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, switch (flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct udp_hdr, dgram_cksum)); + offsetof(struct rte_udp_hdr, dgram_cksum)); cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; case PKT_TX_TCP_CKSUM: diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index e36e9e1f7..1910231b6 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -289,7 +289,7 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct udp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_udp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 90494299a..7b68f0df1 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -121,7 +121,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, memset(gp, 0, sizeof(*gp)); if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP) { - struct udp_hdr udp_mask, udp_val; + struct rte_udp_hdr udp_mask, udp_val; memset(&udp_mask, 0, sizeof(udp_mask)); memset(&udp_val, 0, sizeof(udp_val)); @@ -135,7 +135,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, - &udp_mask, &udp_val, sizeof(struct udp_hdr)); + &udp_mask, &udp_val, sizeof(struct rte_udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); @@ -217,7 +217,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { - struct udp_hdr udp_mask, udp_val; + struct rte_udp_hdr udp_mask, udp_val; memset(&udp_mask, 0, sizeof(udp_mask)); memset(&udp_val, 0, sizeof(udp_val)); @@ -230,7 +230,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, udp_val.dst_port = input->flow.udp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, - &udp_mask, &udp_val, sizeof(struct udp_hdr)); + &udp_mask, &udp_val, sizeof(struct rte_udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 76eba44a4..f7e18399a 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -448,7 +448,7 @@ enic_copy_item_udp_v1(struct copy_item_args *arg) const struct rte_flow_item_udp *spec = item->spec; const struct rte_flow_item_udp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct udp_hdr supported_mask = { + struct rte_udp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -638,7 +638,7 @@ enic_copy_item_inner_udp_v2(struct copy_item_args *arg) mask = &rte_flow_item_udp_mask; /* Append udp header to L5 and set ip proto = udp */ return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct udp_hdr), + arg->item->spec, mask, sizeof(struct rte_udp_hdr), arg->l3_proto_off, IPPROTO_UDP, 1); } @@ -816,9 +816,9 @@ enic_copy_item_udp_v2(struct copy_item_args *arg) mask = &rte_flow_item_udp_mask; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); return 0; } @@ -910,7 +910,7 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) const struct rte_flow_item_vxlan *spec = item->spec; const struct rte_flow_item_vxlan *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; FLOW_TRACE(); @@ -920,9 +920,9 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) */ gp->mask_flags |= FILTER_GENERIC_1_UDP; gp->val_flags |= FILTER_GENERIC_1_UDP; - udp = (struct udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].mask; + udp = (struct rte_udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].mask; udp->dst_port = 0xffff; - udp = (struct udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].val; + udp = (struct rte_udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].val; udp->dst_port = RTE_BE16(4789); /* Match all if no spec */ if (!spec) @@ -980,9 +980,9 @@ enic_copy_item_raw_v2(struct copy_item_args *arg) */ if (mask->length != 0 && mask->length < spec->length) return EINVAL; - memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr), mask->pattern, spec->length); - memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct rte_udp_hdr), spec->pattern, spec->length); return 0; @@ -1036,9 +1036,9 @@ fixup_l5_layer(struct enic *enic, struct filter_generic_1 *gp, return; FLOW_TRACE(); vxlan = sizeof(struct rte_vxlan_hdr); - memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr), gp->layer[FILTER_GENERIC_1_L5].mask, vxlan); - memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct rte_udp_hdr), gp->layer[FILTER_GENERIC_1_L5].val, vxlan); inner = inner_ofst - vxlan; memset(layer, 0, sizeof(layer)); diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 46dfa79b7..40f25febf 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -799,7 +799,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *raw_pkt) { unsigned char *payload, *ptr; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; @@ -815,8 +815,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, /* fill the L4 head */ switch (fdir_input->flow_type) { case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -860,8 +860,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1089,7 +1089,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload = NULL; unsigned char *ptr; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; @@ -1116,8 +1116,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, /* fill the L4 head */ if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1153,8 +1153,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, payload = raw_pkt + len; set_idx = I40E_FLXPLD_L3_IDX; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1206,12 +1206,12 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 || cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); gtp = (struct rte_flow_item_gtp *) - ((unsigned char *)udp + sizeof(struct udp_hdr)); + ((unsigned char *)udp + sizeof(struct rte_udp_hdr)); gtp->msg_len = rte_cpu_to_be_16(I40E_FDIR_GTP_DEFAULT_LEN); gtp->teid = fdir_input->flow.gtp_flow.teid; diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 6b8e586e5..a244ae65c 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -312,7 +312,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; default: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 9c733a596..ad897f2ca 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1427,7 +1427,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; default: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 0862ab0cc..4a2ac954c 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1771,7 +1771,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; default: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index c720a6db9..58966863a 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -422,7 +422,7 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_UDP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct udp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_udp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a1e90ea2d..307cc363f 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2592,11 +2592,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, /* Handle L4. */ switch (fdir_filter->input.flow_type) { case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: - attributes->l4.udp.hdr = (struct udp_hdr){ + attributes->l4.udp.hdr = (struct rte_udp_hdr){ .src_port = input->flow.udp4_flow.src_port, .dst_port = input->flow.udp4_flow.dst_port, }; - attributes->l4_mask.udp.hdr = (struct udp_hdr){ + attributes->l4_mask.udp.hdr = (struct rte_udp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2622,11 +2622,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - attributes->l4.udp.hdr = (struct udp_hdr){ + attributes->l4.udp.hdr = (struct rte_udp_hdr){ .src_port = input->flow.udp6_flow.src_port, .dst_port = input->flow.udp6_flow.dst_port, }; - attributes->l4_mask.udp.hdr = (struct udp_hdr){ + attributes->l4_mask.udp.hdr = (struct rte_udp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index d2a725469..bb3b1f68a 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1054,7 +1054,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, struct rte_vlan_hdr *vlan = NULL; struct rte_ipv4_hdr *ipv4 = NULL; struct rte_ipv6_hdr *ipv6 = NULL; - struct udp_hdr *udp = NULL; + struct rte_udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; struct rte_gre_hdr *gre = NULL; @@ -1125,7 +1125,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv6->hop_limits = MLX5_ENCAP_IPV6_HOP_LIMIT; break; case RTE_FLOW_ITEM_TYPE_UDP: - udp = (struct udp_hdr *)&buf[temp_size]; + udp = (struct rte_udp_hdr *)&buf[temp_size]; if (!ipv4 && !ipv6) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index cd762cddb..33eb9fc39 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -459,7 +459,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, uint8_t *raw_pkt; struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; uint16_t len; @@ -487,13 +487,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; /* UDP */ if (arfs->tuple.ip_proto == IPPROTO_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->dst_port = arfs->tuple.dst_port; udp->src_port = arfs->tuple.src_port; - udp->dgram_len = sizeof(struct udp_hdr); - len += sizeof(struct udp_hdr); + udp->dgram_len = sizeof(struct rte_udp_hdr); + len += sizeof(struct rte_udp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct udp_hdr); + ip->total_length += sizeof(struct rte_udp_hdr); params->udp = true; } else { /* TCP */ tcp = (struct rte_tcp_hdr *)(raw_pkt + len); @@ -522,10 +522,10 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; /* UDP */ if (arfs->tuple.ip_proto == IPPROTO_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->src_port = arfs->tuple.src_port; udp->dst_port = arfs->tuple.dst_port; - len += sizeof(struct udp_hdr); + len += sizeof(struct rte_udp_hdr); params->udp = true; } else { /* TCP */ tcp = (struct rte_tcp_hdr *)(raw_pkt + len); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index a6d3baa5f..266fe96bf 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -508,7 +508,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, l4_hdr = packet + l2_len + l3_len; if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) - *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; + *l4_cksum = &((struct rte_udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 6c3f21bfb..7ddf8fb0f 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -538,7 +538,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, switch (cookie->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct udp_hdr, + hdr->csum_offset = offsetof(struct rte_udp_hdr, dgram_cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 550cd8738..f5534344f 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -544,7 +544,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); + gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct rte_udp_hdr, dgram_cksum); break; default: PMD_TX_LOG(WARNING, "requested cksum offload not supported %#llx", diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index cd43b37dc..c8f975491 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -528,7 +528,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, { struct ipv4_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; key.ip_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); @@ -544,7 +544,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); @@ -567,7 +567,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, { struct ipv6_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; memcpy(key.ip_dst, ipv6_hdr->dst_addr, IPV6_ADDR_LEN); @@ -584,7 +584,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d57ac262b..0ef469c29 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -367,7 +367,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, { struct ipv4_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; key.ip_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); @@ -383,7 +383,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 261332adf..166cd8a31 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -75,7 +75,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i uint16_t ethertype; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -107,7 +107,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *i return 0; /* packet type not supported, nothing to do */ if (l4_proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info->l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); ol_flags |= PKT_TX_UDP_CKSUM; udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); @@ -139,7 +139,7 @@ decapsulation(struct rte_mbuf *pkt) { uint8_t l4_proto = 0; uint16_t outer_header_len; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; union tunnel_offload_info info = { .data = 0 }; struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); @@ -148,7 +148,7 @@ decapsulation(struct rte_mbuf *pkt) if (l4_proto != IPPROTO_UDP) return -1; - udp_hdr = (struct udp_hdr *)((char *)phdr + + udp_hdr = (struct rte_udp_hdr *)((char *)phdr + info.outer_l2_len + info.outer_l3_len); /** check udp destination port, 4789 is the default vxlan port @@ -158,7 +158,7 @@ decapsulation(struct rte_mbuf *pkt) (pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0) return -1; outer_header_len = info.outer_l2_len + info.outer_l3_len - + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr); + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr); rte_pktmbuf_adj(pkt, outer_header_len); @@ -177,10 +177,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) - + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; /* convert TX queue ID to vport ID */ @@ -224,7 +224,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*UDP HEADER*/ udp->dgram_cksum = 0; udp->dgram_len = rte_cpu_to_be_16(old_len - + sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); udp->dst_port = rte_cpu_to_be_16(vxdev.dst_port); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index fcf444ffd..9838792fd 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -693,7 +693,7 @@ static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = { * Matches a UDP header. */ struct rte_flow_item_udp { - struct udp_hdr hdr; /**< UDP header definition. */ + struct rte_udp_hdr hdr; /**< UDP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */ diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index e8adb310b..a081b5b39 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -263,7 +263,7 @@ static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { struct rte_ipv4_hdr *ipv4_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; @@ -275,7 +275,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the outer UDP header. */ len -= pkt->outer_l3_len; - udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + pkt->outer_l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + pkt->outer_l3_len); udp_hdr->dgram_len = rte_cpu_to_be_16(len); /* Update the inner IPv4 header. */ @@ -292,7 +292,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct rte_tcp_hdr *tcp_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; int32_t tcp_dl; @@ -316,10 +316,10 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); - udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); vxlan_hdr = (struct rte_vxlan_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 3edd2429b..a0b83436d 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -46,9 +46,9 @@ static inline void update_udp_header(struct rte_mbuf *pkt, uint16_t udp_offset) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + udp_hdr = (struct rte_udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + udp_offset); udp_hdr->dgram_len = rte_cpu_to_be_16(pkt->pkt_len - udp_offset); } diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 8f65adf1c..3aab297f4 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -23,7 +23,7 @@ extern "C" { /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index b8b545f37..d692f3dba 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -311,7 +311,7 @@ struct rte_vxlan_hdr { #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)) +#define RTE_ETHER_VXLAN_HLEN (sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -335,7 +335,7 @@ struct rte_vxlan_gpe_hdr { #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) + \ +#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 268892cc9..e1868f7da 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -357,7 +357,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) { - hdr_lens->l4_len = sizeof(struct udp_hdr); + hdr_lens->l4_len = sizeof(struct rte_udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { const struct rte_tcp_hdr *th; @@ -493,7 +493,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_UDP) { - hdr_lens->inner_l4_len = sizeof(struct udp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { const struct rte_tcp_hdr *th; diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 57b5ce363..e7c4f676e 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -115,7 +115,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct rte_tcp_hdr *tcp_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; #ifdef RTE_LIBRTE_ETHDEV_DEBUG @@ -153,7 +153,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) if ((ol_flags & PKT_TX_UDP_CKSUM) == PKT_TX_UDP_CKSUM) { if (ol_flags & PKT_TX_IPV4) { - udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + m->l3_len); udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -161,7 +161,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ - udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, + udp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *, inner_l3_offset + m->l3_len); udp_hdr->dgram_cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_udp.h b/lib/librte_net/rte_udp.h index ba033955c..1c3437c5f 100644 --- a/lib/librte_net/rte_udp.h +++ b/lib/librte_net/rte_udp.h @@ -23,7 +23,7 @@ extern "C" { /** * UDP Header */ -struct udp_hdr { +struct rte_udp_hdr { uint16_t src_port; /**< UDP source port. */ uint16_t dst_port; /**< UDP destination port. */ uint16_t dgram_len; /**< UDP datagram length */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 3df121c06..8ee85bfc1 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -492,7 +492,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -500,14 +500,14 @@ struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -515,7 +515,7 @@ struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -998,13 +998,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length); @@ -1028,13 +1028,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length); @@ -1058,10 +1058,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length); @@ -1084,10 +1084,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length); @@ -1358,7 +1358,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t ip_cksum, udp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1397,7 +1397,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t ip_cksum, udp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1439,7 +1439,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t udp_cksum; udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum, @@ -1467,7 +1467,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t udp_cksum; udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index fadfa3288..d0e9e90fe 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -222,7 +222,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) cksum)); break; case PKT_TX_UDP_CKSUM: - net_hdr->csum_offset = (offsetof(struct udp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_udp_hdr, dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: @@ -1027,7 +1027,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; - case (offsetof(struct udp_hdr, dgram_cksum)): + case (offsetof(struct rte_udp_hdr, dgram_cksum)): if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; @@ -1053,7 +1053,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) case VIRTIO_NET_HDR_GSO_UDP: m->ol_flags |= PKT_TX_UDP_SEG; m->tso_segsz = hdr->gso_size; - m->l4_len = sizeof(struct udp_hdr); + m->l4_len = sizeof(struct rte_udp_hdr); break; default: RTE_LOG(WARNING, VHOST_DATA, -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 00/14] prefix network structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (14 preceding siblings ...) 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 14/14] net: add rte prefix to udp structure Olivier Matz @ 2019-05-20 17:11 ` Ferruh Yigit 2019-05-21 16:15 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz 16 siblings, 1 reply; 107+ messages in thread From: Ferruh Yigit @ 2019-05-20 17:11 UTC (permalink / raw) To: Olivier Matz, dev On 4/10/2019 9:32 AM, Olivier Matz wrote: > This RFC targets 19.08. > > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > This was discussed in [1], and recently requested by the techboard [2]. > > v2: > * rebase on top of v19.05-rc1 > > [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html > [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html > > Olivier Matz (14): > net: add rte prefix to arp structures > net: add rte prefix to arp defines > net: add rte prefix to ether structures > net: add rte prefix to ether functions > net: add rte prefix to ether defines > net: add rte prefix to esp structure > net: add rte prefix to gre structure > net: add rte prefix to icmp structure > net: add rte prefix to icmp defines > net: add rte prefix to ip structure > net: add rte prefix to ip defines > net: add rte prefix to sctp structure > net: add rte prefix to tcp structure > net: add rte prefix to udp structure Hi Oliver, This was planned as one of the early step for the 19.08. Should we continue with this patchset or are you planning to send a new version on top of latest head? Thanks, ferruh ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [RFC v2 00/14] prefix network structures 2019-05-20 17:11 ` [dpdk-dev] [RFC v2 00/14] prefix network structures Ferruh Yigit @ 2019-05-21 16:15 ` Olivier Matz 0 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:15 UTC (permalink / raw) To: Ferruh Yigit; +Cc: dev Hi Ferruh, On Mon, May 20, 2019 at 06:11:35PM +0100, Ferruh Yigit wrote: > On 4/10/2019 9:32 AM, Olivier Matz wrote: > > This RFC targets 19.08. > > > > The rte_net headers conflict with the libc headers, because > > some definitions are duplicated, sometimes with few differences. > > > > This RFC adds the rte_ (or RTE_) prefix to all structures, functions > > and defines in rte_net library. This is a big changeset, that will > > break the API of many functions, but not the ABI. > > > > This was discussed in [1], and recently requested by the techboard [2]. > > > > v2: > > * rebase on top of v19.05-rc1 > > > > [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html > > [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html > > > > Olivier Matz (14): > > net: add rte prefix to arp structures > > net: add rte prefix to arp defines > > net: add rte prefix to ether structures > > net: add rte prefix to ether functions > > net: add rte prefix to ether defines > > net: add rte prefix to esp structure > > net: add rte prefix to gre structure > > net: add rte prefix to icmp structure > > net: add rte prefix to icmp defines > > net: add rte prefix to ip structure > > net: add rte prefix to ip defines > > net: add rte prefix to sctp structure > > net: add rte prefix to tcp structure > > net: add rte prefix to udp structure > > Hi Oliver, > > This was planned as one of the early step for the 19.08. Should we continue with > this patchset or are you planning to send a new version on top of latest head? I've just send an updated version. Thanks, Olivier ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 00/15] prefix network structures 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz ` (15 preceding siblings ...) 2019-05-20 17:11 ` [dpdk-dev] [RFC v2 00/14] prefix network structures Ferruh Yigit @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures Olivier Matz ` (17 more replies) 16 siblings, 18 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit The rte_net headers conflict with the libc headers, because some definitions are duplicated, sometimes with few differences. This patchset adds the rte_ (or RTE_) prefix to all structures, functions and defines in rte_net library. This is a big changeset, that will break the API of many functions, but not the ABI. This was discussed in [1], and requested by the techboard [2]. patch-v1: * rease on top of v19.05 * remove uneeded renames in drivers/net/bonding/rte_eth_bond_pmd.c and app/test-pmd/icmpecho.c (arp-related variables) * do not modify base drivers, except cxgbe, thunderx, enetc, qede: only files that already contain dpdk definitions are modified. * fix checkpatch issues when it does not impact the code style too much. Big warnings remain about the RTE_IPv4() macros because arguments are separated by ',' instead of ', '. * add a release note patch * tested compilation on x86_64-linux and x86_64-freebsd. rfc-v2: * rebase on top of v19.05-rc1 [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html Olivier Matz (15): net: add rte prefix to arp structures net: add rte prefix to arp defines net: add rte prefix to ether structures net: add rte prefix to ether functions net: add rte prefix to ether defines net: add rte prefix to esp structure net: add rte prefix to gre structure net: add rte prefix to icmp structure net: add rte prefix to icmp defines net: add rte prefix to ip structure net: add rte prefix to ip defines net: add rte prefix to sctp structure net: add rte prefix to tcp structure net: add rte prefix to udp structure doc: announce network api change app/pdump/main.c | 2 +- app/test-acl/main.c | 2 +- app/test-eventdev/test_perf_common.c | 2 +- app/test-eventdev/test_pipeline_common.c | 2 +- app/test-pipeline/pipeline_acl.c | 19 +- app/test-pipeline/pipeline_hash.c | 12 +- app/test-pmd/cmdline.c | 90 +++--- app/test-pmd/cmdline_flow.c | 86 +++--- app/test-pmd/config.c | 35 ++- app/test-pmd/csumonly.c | 169 +++++----- app/test-pmd/flowgen.c | 30 +- app/test-pmd/icmpecho.c | 117 +++---- app/test-pmd/ieee1588fwd.c | 18 +- app/test-pmd/macfwd.c | 12 +- app/test-pmd/macswap.h | 12 +- app/test-pmd/macswap_common.h | 4 +- app/test-pmd/macswap_neon.h | 12 +- app/test-pmd/macswap_sse.h | 12 +- app/test-pmd/parameters.c | 6 +- app/test-pmd/testpmd.c | 23 +- app/test-pmd/testpmd.h | 30 +- app/test-pmd/txonly.c | 45 +-- app/test-pmd/util.c | 34 +- app/test/packet_burst_generator.c | 150 ++++----- app/test/packet_burst_generator.h | 33 +- app/test/test_acl.c | 8 +- app/test/test_acl.h | 122 ++++---- app/test/test_cmdline_etheraddr.c | 16 +- app/test/test_efd.c | 20 +- app/test/test_event_eth_rx_adapter.c | 2 +- app/test/test_event_eth_tx_adapter.c | 2 +- app/test/test_flow_classify.c | 70 +++-- app/test/test_hash.c | 20 +- app/test/test_ipsec.c | 13 +- app/test/test_link_bonding.c | 342 ++++++++++++--------- app/test/test_link_bonding_mode4.c | 124 ++++---- app/test/test_link_bonding_rssconf.c | 6 +- app/test/test_lpm.c | 76 ++--- app/test/test_lpm_perf.c | 10 +- app/test/test_member.c | 20 +- app/test/test_pmd_perf.c | 20 +- app/test/test_sched.c | 24 +- app/test/test_table_acl.c | 8 +- app/test/test_thash.c | 12 +- app/test/virtual_pmd.c | 6 +- app/test/virtual_pmd.h | 2 +- doc/guides/nics/kni.rst | 2 +- doc/guides/prog_guide/bbdev.rst | 6 +- .../prog_guide/packet_classif_access_ctrl.rst | 18 +- doc/guides/prog_guide/rte_flow.rst | 4 +- doc/guides/rel_notes/deprecation.rst | 4 - doc/guides/rel_notes/release_19_08.rst | 3 + doc/guides/sample_app_ug/flow_classify.rst | 28 +- doc/guides/sample_app_ug/flow_filtering.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- doc/guides/sample_app_ug/l3_forward.rst | 12 +- doc/guides/sample_app_ug/link_status_intr.rst | 6 +- doc/guides/sample_app_ug/ptpclient.rst | 6 +- doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- doc/guides/sample_app_ug/server_node_efd.rst | 12 +- doc/guides/sample_app_ug/skeleton.rst | 4 +- doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- drivers/bus/dpaa/include/compat.h | 2 + drivers/bus/dpaa/include/fman.h | 2 +- drivers/bus/dpaa/include/netcfg.h | 4 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 8 +- drivers/net/ark/ark_ethdev.c | 19 +- drivers/net/ark/ark_ext.h | 4 +- drivers/net/ark/ark_global.h | 5 +- drivers/net/atlantic/atl_ethdev.c | 27 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- drivers/net/avp/avp_ethdev.c | 21 +- drivers/net/avp/rte_avp_common.h | 2 +- drivers/net/axgbe/axgbe_dev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 10 +- drivers/net/axgbe/axgbe_ethdev.h | 4 +- drivers/net/axgbe/axgbe_rxtx.c | 2 +- drivers/net/bnx2x/bnx2x.c | 16 +- drivers/net/bnx2x/bnx2x_ethdev.c | 5 +- drivers/net/bnx2x/bnx2x_ethdev.h | 3 +- drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- drivers/net/bnx2x/ecore_sp.h | 2 +- drivers/net/bnxt/bnxt.h | 4 +- drivers/net/bnxt/bnxt_ethdev.c | 80 ++--- drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 +- drivers/net/bnxt/bnxt_flow.c | 27 +- drivers/net/bnxt/bnxt_hwrm.c | 41 +-- drivers/net/bnxt/bnxt_hwrm.h | 2 +- drivers/net/bnxt/bnxt_ring.c | 8 +- drivers/net/bnxt/bnxt_rxq.c | 2 +- drivers/net/bnxt/bnxt_rxr.c | 4 +- drivers/net/bnxt/bnxt_vnic.c | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 14 +- drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- drivers/net/bonding/rte_eth_bond.h | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 30 +- drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- drivers/net/bonding/rte_eth_bond_8023ad_private.h | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 98 +++--- drivers/net/bonding/rte_eth_bond_alb.h | 10 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_args.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 203 ++++++------ drivers/net/bonding/rte_eth_bond_private.h | 8 +- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe.h | 5 +- drivers/net/cxgbe/cxgbe_compat.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- drivers/net/cxgbe/cxgbe_filter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 10 +- drivers/net/cxgbe/cxgbe_main.c | 4 +- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- 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 | 9 +- drivers/net/dpaa/dpaa_ethdev.c | 20 +- drivers/net/dpaa/dpaa_rxtx.c | 23 +- drivers/net/dpaa2/dpaa2_ethdev.c | 37 +-- drivers/net/dpaa2/dpaa2_flow.c | 18 +- drivers/net/e1000/e1000_ethdev.h | 5 +- drivers/net/e1000/em_ethdev.c | 39 +-- drivers/net/e1000/em_rxtx.c | 24 +- drivers/net/e1000/igb_ethdev.c | 76 ++--- drivers/net/e1000/igb_flow.c | 12 +- drivers/net/e1000/igb_pf.c | 17 +- drivers/net/e1000/igb_rxtx.c | 23 +- drivers/net/ena/ena_ethdev.c | 17 +- drivers/net/ena/ena_ethdev.h | 2 +- drivers/net/enetc/base/enetc_hw.h | 4 +- drivers/net/enetc/enetc_ethdev.c | 21 +- drivers/net/enic/enic.h | 4 +- drivers/net/enic/enic_clsf.c | 40 +-- drivers/net/enic/enic_ethdev.c | 29 +- drivers/net/enic/enic_flow.c | 114 +++---- drivers/net/enic/enic_main.c | 4 +- drivers/net/enic/enic_res.c | 5 +- drivers/net/failsafe/failsafe.c | 8 +- drivers/net/failsafe/failsafe_args.c | 4 +- drivers/net/failsafe/failsafe_ether.c | 7 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/failsafe/failsafe_private.h | 4 +- drivers/net/fm10k/fm10k.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 18 +- drivers/net/i40e/i40e_ethdev.c | 143 +++++---- drivers/net/i40e/i40e_ethdev.h | 23 +- drivers/net/i40e/i40e_ethdev_vf.c | 68 ++-- drivers/net/i40e/i40e_fdir.c | 127 ++++---- drivers/net/i40e/i40e_flow.c | 58 ++-- drivers/net/i40e/i40e_pf.c | 18 +- drivers/net/i40e/i40e_rxtx.c | 28 +- drivers/net/i40e/i40e_vf_representor.c | 2 +- drivers/net/i40e/rte_pmd_i40e.c | 31 +- drivers/net/i40e/rte_pmd_i40e.h | 8 +- drivers/net/iavf/iavf.h | 4 +- drivers/net/iavf/iavf_ethdev.c | 53 ++-- drivers/net/iavf/iavf_rxtx.c | 14 +- drivers/net/iavf/iavf_vchnl.c | 8 +- drivers/net/ice/ice_ethdev.c | 64 ++-- drivers/net/ice/ice_ethdev.h | 6 +- drivers/net/ice/ice_rxtx.c | 28 +- drivers/net/ipn3ke/ipn3ke_ethdev.h | 6 +- drivers/net/ipn3ke/ipn3ke_flow.c | 4 +- drivers/net/ipn3ke/ipn3ke_representor.c | 21 +- drivers/net/ixgbe/ixgbe_ethdev.c | 107 ++++--- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_flow.c | 22 +- drivers/net/ixgbe/ixgbe_pf.c | 16 +- drivers/net/ixgbe/ixgbe_rxtx.c | 18 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 11 +- drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- drivers/net/kni/rte_eth_kni.c | 6 +- drivers/net/liquidio/lio_ethdev.c | 23 +- drivers/net/mlx4/mlx4.c | 4 +- drivers/net/mlx4/mlx4.h | 10 +- drivers/net/mlx4/mlx4_ethdev.c | 12 +- drivers/net/mlx4/mlx4_flow.c | 16 +- drivers/net/mlx4/mlx4_rxtx.c | 2 +- drivers/net/mlx5/mlx5.c | 4 +- drivers/net/mlx5/mlx5.h | 15 +- drivers/net/mlx5/mlx5_flow.c | 22 +- drivers/net/mlx5/mlx5_flow_dv.c | 44 +-- drivers/net/mlx5/mlx5_flow_tcf.c | 66 ++-- drivers/net/mlx5/mlx5_flow_verbs.c | 30 +- drivers/net/mlx5/mlx5_mac.c | 18 +- drivers/net/mlx5/mlx5_nl.c | 28 +- drivers/net/mlx5/mlx5_rxtx.c | 6 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- drivers/net/mlx5/mlx5_trigger.c | 6 +- drivers/net/mvneta/mvneta_ethdev.c | 22 +- drivers/net/mvneta/mvneta_ethdev.h | 6 +- drivers/net/mvpp2/mrvl_ethdev.c | 22 +- drivers/net/mvpp2/mrvl_ethdev.h | 6 +- drivers/net/mvpp2/mrvl_flow.c | 4 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/netvsc/hn_nvs.c | 2 +- drivers/net/netvsc/hn_rndis.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 12 +- drivers/net/netvsc/hn_var.h | 4 +- drivers/net/netvsc/hn_vf.c | 8 +- drivers/net/nfb/nfb_ethdev.c | 16 +- drivers/net/nfp/nfp_net.c | 22 +- drivers/net/nfp/nfp_net_pmd.h | 2 +- drivers/net/null/rte_eth_null.c | 6 +- drivers/net/octeontx/octeontx_ethdev.c | 9 +- drivers/net/octeontx/octeontx_ethdev.h | 2 +- drivers/net/pcap/rte_eth_pcap.c | 22 +- drivers/net/qede/base/bcm_osal.h | 4 +- drivers/net/qede/qede_ethdev.c | 71 +++-- drivers/net/qede/qede_ethdev.h | 6 +- drivers/net/qede/qede_filter.c | 68 ++-- drivers/net/qede/qede_if.h | 4 +- drivers/net/qede/qede_main.c | 6 +- drivers/net/qede/qede_rxtx.c | 34 +- drivers/net/qede/qede_rxtx.h | 2 +- drivers/net/ring/rte_eth_ring.c | 4 +- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ef10_tx.c | 4 +- drivers/net/sfc/sfc_ethdev.c | 24 +- drivers/net/sfc/sfc_flow.c | 12 +- drivers/net/sfc/sfc_port.c | 8 +- drivers/net/sfc/sfc_tso.c | 4 +- drivers/net/sfc/sfc_tso.h | 4 +- drivers/net/softnic/parser.c | 18 +- drivers/net/softnic/parser.h | 2 +- drivers/net/softnic/rte_eth_softnic.c | 2 +- drivers/net/softnic/rte_eth_softnic_flow.c | 4 +- drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- drivers/net/szedata2/rte_eth_szedata2.c | 8 +- drivers/net/tap/rte_eth_tap.c | 68 ++-- drivers/net/tap/rte_eth_tap.h | 4 +- drivers/net/tap/tap_bpf_program.c | 14 +- drivers/net/tap/tap_flow.c | 16 +- drivers/net/thunderx/base/nicvf_plat.h | 5 +- drivers/net/thunderx/nicvf_ethdev.c | 19 +- drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- drivers/net/vhost/rte_eth_vhost.c | 12 +- drivers/net/virtio/virtio_ethdev.c | 78 ++--- drivers/net/virtio/virtio_pci.h | 4 +- drivers/net/virtio/virtio_rxtx.c | 33 +- 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 | 12 +- drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 47 +-- examples/bbdev_app/main.c | 41 +-- examples/bond/main.c | 83 ++--- examples/distributor/main.c | 4 +- examples/ethtool/ethtool-app/ethapp.c | 8 +- examples/ethtool/ethtool-app/main.c | 10 +- examples/ethtool/lib/rte_ethtool.c | 8 +- examples/ethtool/lib/rte_ethtool.h | 7 +- examples/eventdev_pipeline/main.c | 4 +- examples/eventdev_pipeline/pipeline_common.h | 10 +- examples/flow_classify/flow_classify.c | 30 +- examples/flow_filtering/main.c | 10 +- examples/ip_fragmentation/main.c | 69 +++-- examples/ip_pipeline/cli.c | 4 +- examples/ip_pipeline/kni.c | 2 +- examples/ip_pipeline/parser.c | 18 +- examples/ip_pipeline/parser.h | 2 +- examples/ip_pipeline/pipeline.c | 40 +-- examples/ip_reassembly/main.c | 51 +-- examples/ipsec-secgw/esp.c | 47 +-- examples/ipsec-secgw/ipsec-secgw.c | 43 +-- examples/ipsec-secgw/ipsec.h | 2 +- examples/ipsec-secgw/parser.c | 4 +- examples/ipsec-secgw/sa.c | 16 +- examples/ipv4_multicast/main.c | 60 ++-- examples/kni/main.c | 14 +- examples/l2fwd-cat/l2fwd-cat.c | 4 +- examples/l2fwd-crypto/main.c | 26 +- examples/l2fwd-jobstats/main.c | 8 +- examples/l2fwd-keepalive/main.c | 8 +- examples/l2fwd/main.c | 8 +- examples/l3fwd-acl/main.c | 106 ++++--- examples/l3fwd-power/main.c | 102 +++--- examples/l3fwd-vf/main.c | 68 ++-- examples/l3fwd/l3fwd.h | 8 +- examples/l3fwd/l3fwd_altivec.h | 26 +- examples/l3fwd/l3fwd_common.h | 4 +- examples/l3fwd/l3fwd_em.c | 46 +-- examples/l3fwd/l3fwd_em.h | 22 +- examples/l3fwd/l3fwd_em_hlm.h | 19 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 20 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- examples/l3fwd/l3fwd_em_sequential.h | 19 +- examples/l3fwd/l3fwd_lpm.c | 50 +-- examples/l3fwd/l3fwd_lpm.h | 22 +- examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- examples/l3fwd/l3fwd_lpm_neon.h | 30 +- examples/l3fwd/l3fwd_lpm_sse.h | 20 +- examples/l3fwd/l3fwd_neon.h | 26 +- examples/l3fwd/l3fwd_sse.h | 26 +- examples/l3fwd/main.c | 20 +- examples/link_status_interrupt/main.c | 8 +- examples/load_balancer/runtime.c | 8 +- .../client_server_mp/mp_server/main.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 337 ++++++++++---------- examples/ptpclient/ptpclient.c | 32 +- examples/qos_meter/main.c | 5 +- examples/qos_sched/init.c | 2 +- examples/quota_watermark/qw/main.c | 8 +- examples/rxtx_callbacks/main.c | 4 +- examples/server_node_efd/node/node.c | 6 +- examples/server_node_efd/server/main.c | 8 +- examples/skeleton/basicfwd.c | 4 +- examples/tep_termination/main.c | 2 +- examples/tep_termination/main.h | 2 +- examples/tep_termination/vxlan.c | 115 +++---- examples/tep_termination/vxlan.h | 8 +- examples/tep_termination/vxlan_setup.c | 32 +- examples/tep_termination/vxlan_setup.h | 2 +- examples/vhost/main.c | 42 +-- examples/vhost/main.h | 2 +- examples/vm_power_manager/channel_monitor.c | 12 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/main.c | 6 +- examples/vmdq/main.c | 12 +- examples/vmdq_dcb/main.c | 12 +- lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_eth_ctrl.h | 12 +- lib/librte_ethdev/rte_ethdev.c | 59 ++-- lib/librte_ethdev/rte_ethdev.h | 15 +- lib/librte_ethdev/rte_ethdev_core.h | 12 +- lib/librte_ethdev/rte_flow.h | 34 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 33 +- lib/librte_gro/gro_tcp4.c | 26 +- lib/librte_gro/gro_tcp4.h | 22 +- lib/librte_gro/gro_vxlan_tcp4.c | 66 ++-- lib/librte_gro/gro_vxlan_tcp4.h | 6 +- lib/librte_gso/gso_common.h | 16 +- lib/librte_gso/gso_tcp4.c | 12 +- lib/librte_gso/gso_tunnel_tcp4.c | 14 +- lib/librte_gso/gso_udp4.c | 10 +- lib/librte_gso/rte_gso.h | 8 +- lib/librte_hash/rte_thash.h | 3 +- lib/librte_ip_frag/rte_ip_frag.h | 13 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 28 +- lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- lib/librte_ipsec/crypto.h | 2 +- lib/librte_ipsec/esp_inb.c | 10 +- lib/librte_ipsec/esp_outb.c | 8 +- lib/librte_ipsec/iph.h | 8 +- lib/librte_ipsec/sa.c | 10 +- lib/librte_kni/rte_kni.c | 4 +- lib/librte_kni/rte_kni.h | 2 +- lib/librte_net/rte_arp.c | 33 +- lib/librte_net/rte_arp.h | 36 +-- lib/librte_net/rte_esp.h | 2 +- lib/librte_net/rte_ether.h | 189 ++++++------ lib/librte_net/rte_gre.h | 2 +- lib/librte_net/rte_icmp.h | 6 +- lib/librte_net/rte_ip.h | 75 ++--- lib/librte_net/rte_net.c | 94 +++--- lib/librte_net/rte_net.h | 28 +- lib/librte_net/rte_sctp.h | 2 +- lib/librte_net/rte_tcp.h | 2 +- lib/librte_net/rte_udp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 242 ++++++++------- lib/librte_pipeline/rte_table_action.h | 4 +- lib/librte_port/rte_port_ras.c | 10 +- lib/librte_port/rte_port_source_sink.c | 6 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/virtio_net.c | 43 +-- 385 files changed, 4563 insertions(+), 4234 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-24 11:37 ` Ferruh Yigit 2019-05-21 16:13 ` [dpdk-dev] [PATCH 02/15] net: add rte prefix to arp defines Olivier Matz ` (16 subsequent siblings) 17 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields to avoid conflict with the #defines in gnu libc. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 24 ++++++++++----------- app/test/packet_burst_generator.c | 12 +++++------ app/test/packet_burst_generator.h | 2 +- app/test/test_link_bonding.c | 38 +++++++++++++++++++++------------- drivers/net/bonding/rte_eth_bond_alb.c | 26 +++++++++++------------ drivers/net/bonding/rte_eth_bond_pmd.c | 10 +++++---- drivers/net/i40e/i40e_fdir.c | 4 ++-- examples/bond/main.c | 26 ++++++++++++----------- lib/librte_net/rte_arp.c | 14 ++++++------- lib/librte_net/rte_arp.h | 16 +++++++------- 10 files changed, 93 insertions(+), 79 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 55d266d77..0f92d14ad 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -38,7 +38,7 @@ static const char * arp_op_name(uint16_t arp_op) { - switch (arp_op ) { + switch (arp_op) { case ARP_OP_REQUEST: return "ARP Request"; case ARP_OP_REPLY: @@ -277,7 +277,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_mbuf *pkt; struct ether_hdr *eth_h; struct vlan_hdr *vlan_h; - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; struct icmp_hdr *icmp_h; struct ether_addr eth_addr; @@ -347,22 +347,22 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* Reply to ARP requests */ if (eth_type == ETHER_TYPE_ARP) { - arp_h = (struct arp_hdr *) ((char *)eth_h + l2_len); - arp_op = RTE_BE_TO_CPU_16(arp_h->arp_op); - arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_pro); + arp_h = (struct rte_arp_hdr *) ((char *)eth_h + l2_len); + arp_op = RTE_BE_TO_CPU_16(arp_h->arp_opcode); + arp_pro = RTE_BE_TO_CPU_16(arp_h->arp_protocol); if (verbose_level > 0) { printf(" ARP: hrd=%d proto=0x%04x hln=%d " "pln=%d op=%u (%s)\n", - RTE_BE_TO_CPU_16(arp_h->arp_hrd), - arp_pro, arp_h->arp_hln, - arp_h->arp_pln, arp_op, + RTE_BE_TO_CPU_16(arp_h->arp_hardware), + arp_pro, arp_h->arp_hlen, + arp_h->arp_plen, arp_op, arp_op_name(arp_op)); } - if ((RTE_BE_TO_CPU_16(arp_h->arp_hrd) != + if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != ARP_HRD_ETHER) || (arp_pro != ETHER_TYPE_IPv4) || - (arp_h->arp_hln != 6) || - (arp_h->arp_pln != 4) + (arp_h->arp_hlen != 6) || + (arp_h->arp_plen != 4) ) { rte_pktmbuf_free(pkt); if (verbose_level > 0) @@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); - arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index e894dc76f..0b12058bb 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -74,15 +74,15 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, } void -initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { - arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hln = ETHER_ADDR_LEN; - arp_hdr->arp_pln = sizeof(uint32_t); - arp_hdr->arp_op = rte_cpu_to_be_16(opcode); + arp_hdr->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = src_ip; ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index c20cea6e9..b6e013a11 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -29,7 +29,7 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, uint8_t vlan_enabled, uint16_t van_id); void -initialize_arp_header(struct arp_hdr *arp_hdr, struct ether_addr *src_mac, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 0438e76cc..6ff0f5b9c 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4469,7 +4469,7 @@ test_alb_change_mac_in_reply_sent(void) struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; struct ether_hdr *eth_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; int slave_idx, nb_pkts, pkt_idx; int retval = 0; @@ -4504,7 +4504,8 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4514,7 +4515,8 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4524,7 +4526,8 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4534,7 +4537,8 @@ test_alb_change_mac_in_reply_sent(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4555,7 +4559,8 @@ test_alb_change_mac_in_reply_sent(void) for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4580,7 +4585,7 @@ static int test_alb_reply_from_client(void) { struct ether_hdr *eth_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; @@ -4617,7 +4622,8 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4628,7 +4634,8 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4639,7 +4646,8 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4650,7 +4658,8 @@ test_alb_reply_from_client(void) eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4676,7 +4685,8 @@ test_alb_reply_from_client(void) for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - arp_pkt = (struct arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); + arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + + sizeof(struct ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4708,7 +4718,7 @@ test_alb_receive_vlan_reply(void) { struct ether_hdr *eth_pkt; struct vlan_hdr *vlan_pkt; - struct arp_hdr *arp_pkt; + struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; @@ -4749,7 +4759,7 @@ test_alb_receive_vlan_reply(void) 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); - arp_pkt = (struct arp_hdr *)((char *)(vlan_pkt + 1)); + arp_pkt = (struct rte_arp_hdr *)((char *)(vlan_pkt + 1)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index d3e16d4bd..703223937 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -74,17 +74,17 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { - struct arp_hdr *arp; + struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; struct client_data *client_info; uint8_t hash_index; - arp = (struct arp_hdr *) ((char *) (eth_h + 1) + offset); + arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); /* ARP Requests are forwarded to the application with no changes */ - if (arp->arp_op != rte_cpu_to_be_16(ARP_OP_REPLY)) + if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY)) return; /* From now on, we analyze only ARP Reply packets */ @@ -123,7 +123,7 @@ uint16_t bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { - struct arp_hdr *arp; + struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; struct client_data *client_info; @@ -132,7 +132,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, struct ether_addr bonding_mac; - arp = (struct arp_hdr *)((char *)(eth_h + 1) + offset); + arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); /* * Traffic with src MAC other than bonding should be sent on @@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, client_info = &hash_table[hash_index]; rte_spinlock_lock(&internals->mode6.lock); - if (arp->arp_op == rte_cpu_to_be_16(ARP_OP_REPLY)) { + if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) { if (client_info->in_use) { if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { @@ -196,7 +196,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals) { struct ether_hdr *eth_h; - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; uint16_t slave_idx; rte_spinlock_lock(&internals->mode6.lock); @@ -209,7 +209,7 @@ bond_mode_alb_arp_upd(struct client_data *client_info, else eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_h = (struct arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) + arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) + client_info->vlan_count * sizeof(struct vlan_hdr)); memcpy(eth_h + 1, client_info->vlan, @@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; - arp_h->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_h->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_h->arp_hln = ETHER_ADDR_LEN; - arp_h->arp_pln = sizeof(uint32_t); - arp_h->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); slave_idx = client_info->slave_idx; rte_spinlock_unlock(&internals->mode6.lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 2c4da90c6..fa8f81e2b 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -589,7 +589,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, { struct ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB - struct arp_hdr *arp_h; + struct rte_arp_hdr *arp_h; char dst_ip[16]; char ArpOp[24]; char buf[16]; @@ -614,7 +614,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, } #ifdef RTE_LIBRTE_BOND_DEBUG_ALB else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { - arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset); + 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); arp_op_name(rte_be_to_cpu_16(arp_h->arp_op), @@ -1132,8 +1132,10 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) "Failed to allocate ARP packet from pool"); continue; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr) - + client_info->vlan_count * sizeof(struct vlan_hdr); + pkt_size = sizeof(struct ether_hdr) + + sizeof(struct rte_arp_hdr) + + client_info->vlan_count * + sizeof(struct vlan_hdr); upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index d41601a17..4b32fee1e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -911,7 +911,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, */ if (fdir_input->flow.l2_flow.ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) - payload += sizeof(struct arp_hdr); + payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; break; default: @@ -1197,7 +1197,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, */ if (fdir_input->flow.l2_flow.ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) - payload += sizeof(struct arp_hdr); + payload += sizeof(struct rte_arp_hdr); set_idx = I40E_FLXPLD_L2_IDX; } else if (fdir_input->flow_ext.customized_pctype) { /* If customized pctype is used */ diff --git a/examples/bond/main.c b/examples/bond/main.c index ef86194ff..24479649e 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -339,7 +339,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct ether_addr d_addr; struct ether_hdr *eth_hdr; - struct arp_hdr *arp_hdr; + struct rte_arp_hdr *arp_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; @@ -382,10 +382,11 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[1]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - arp_hdr = (struct arp_hdr *)((char *)(eth_hdr + 1) + offset); + arp_hdr = (struct rte_arp_hdr *)( + (char *)(eth_hdr + 1) + offset); if (arp_hdr->arp_data.arp_tip == bond_ip) { - if (arp_hdr->arp_op == rte_cpu_to_be_16(ARP_OP_REQUEST)) { - arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REPLY); + if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) { + arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); @@ -450,7 +451,7 @@ static void cmd_obj_send_parsed(void *parsed_result, struct rte_mbuf *created_pkt; struct ether_hdr *eth_hdr; - struct arp_hdr *arp_hdr; + struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; size_t pkt_size; @@ -469,7 +470,7 @@ static void cmd_obj_send_parsed(void *parsed_result, return; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct arp_hdr); + pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; @@ -478,12 +479,13 @@ static void cmd_obj_send_parsed(void *parsed_result, memset(ð_hdr->d_addr, 0xFF, ETHER_ADDR_LEN); eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_hdr = (struct arp_hdr *)((char *)eth_hdr + sizeof(struct ether_hdr)); - arp_hdr->arp_hrd = rte_cpu_to_be_16(ARP_HRD_ETHER); - arp_hdr->arp_pro = rte_cpu_to_be_16(ETHER_TYPE_IPv4); - arp_hdr->arp_hln = ETHER_ADDR_LEN; - arp_hdr->arp_pln = sizeof(uint32_t); - arp_hdr->arp_op = rte_cpu_to_be_16(ARP_OP_REQUEST); + arp_hdr = (struct rte_arp_hdr *)( + (char *)eth_hdr + sizeof(struct ether_hdr)); + arp_hdr->arp_hardware = rte_cpu_to_be_16(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_plen = sizeof(uint32_t); + arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST); rte_eth_macaddr_get(BOND_PORT, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index f0ed9bd68..c80ebc7e1 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -12,7 +12,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, const struct ether_addr *mac) { struct ether_hdr *eth_hdr; - struct arp_hdr *rarp; + struct rte_arp_hdr *rarp; struct rte_mbuf *mbuf; if (mpool == NULL) @@ -34,12 +34,12 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, eth_hdr->ether_type = htons(ETHER_TYPE_RARP); /* RARP header. */ - rarp = (struct arp_hdr *)(eth_hdr + 1); - rarp->arp_hrd = htons(ARP_HRD_ETHER); - rarp->arp_pro = htons(ETHER_TYPE_IPv4); - rarp->arp_hln = ETHER_ADDR_LEN; - rarp->arp_pln = 4; - rarp->arp_op = htons(ARP_OP_REVREQUEST); + rarp = (struct rte_arp_hdr *)(eth_hdr + 1); + rarp->arp_hardware = htons(ARP_HRD_ETHER); + rarp->arp_protocol = htons(ETHER_TYPE_IPv4); + rarp->arp_hlen = ETHER_ADDR_LEN; + rarp->arp_plen = 4; + rarp->arp_opcode = htons(ARP_OP_REVREQUEST); ether_addr_copy(mac, &rarp->arp_data.arp_sha); ether_addr_copy(mac, &rarp->arp_data.arp_tha); diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index 139a84ca5..c9b5cd49d 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -21,7 +21,7 @@ extern "C" { /** * ARP header IPv4 payload. */ -struct arp_ipv4 { +struct rte_arp_ipv4 { struct ether_addr arp_sha; /**< sender hardware address */ uint32_t arp_sip; /**< sender IP address */ struct ether_addr arp_tha; /**< target hardware address */ @@ -31,14 +31,14 @@ struct arp_ipv4 { /** * ARP header. */ -struct arp_hdr { - uint16_t arp_hrd; /* format of hardware address */ +struct rte_arp_hdr { + uint16_t arp_hardware; /* format of hardware address */ #define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ - uint16_t arp_pro; /* format of protocol address */ - uint8_t arp_hln; /* length of hardware address */ - uint8_t arp_pln; /* length of protocol address */ - uint16_t arp_op; /* ARP opcode (command) */ + uint16_t arp_protocol; /* format of protocol address */ + uint8_t arp_hlen; /* length of hardware address */ + uint8_t arp_plen; /* length of protocol address */ + uint16_t arp_opcode; /* ARP opcode (command) */ #define ARP_OP_REQUEST 1 /* request to resolve address */ #define ARP_OP_REPLY 2 /* response to previous request */ #define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ @@ -46,7 +46,7 @@ struct arp_hdr { #define ARP_OP_INVREQUEST 8 /* request to identify peer */ #define ARP_OP_INVREPLY 9 /* response identifying peer */ - struct arp_ipv4 arp_data; + struct rte_arp_ipv4 arp_data; } __attribute__((__packed__)); /** -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures 2019-05-21 16:13 ` [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures Olivier Matz @ 2019-05-24 11:37 ` Ferruh Yigit 0 siblings, 0 replies; 107+ messages in thread From: Ferruh Yigit @ 2019-05-24 11:37 UTC (permalink / raw) To: Olivier Matz, dev; +Cc: stephen On 5/21/2019 5:13 PM, Olivier Matz wrote: > Also rename arp_hrd, arp_pro, arp_hln, arp_pln and arp_op fields > to avoid conflict with the #defines in gnu libc. > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com> <...> > @@ -614,7 +614,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, > } > #ifdef RTE_LIBRTE_BOND_DEBUG_ALB > else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_ARP)) { > - arp_h = (struct arp_hdr *)((char *)(eth_h + 1) + offset); > + 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); > arp_op_name(rte_be_to_cpu_16(arp_h->arp_op), There is one 'arp_op' seems left here (should be 'arp_opcode'), I am fixing while merging. ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 02/15] net: add rte prefix to arp defines 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 03/15] net: add rte prefix to ether structures Olivier Matz ` (15 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'RTE_' prefix to defines: - rename ARP_HRD_ETHER as RTE_ARP_HRD_ETHER. - rename ARP_OP_REQUEST as RTE_ARP_OP_REQUEST. - rename ARP_OP_REPLY as RTE_ARP_OP_REPLY. - rename ARP_OP_REVREQUEST as RTE_ARP_OP_REVREQUEST. - rename ARP_OP_REVREPLY as RTE_ARP_OP_REVREPLY. - rename ARP_OP_INVREQUEST as RTE_ARP_OP_INVREQUEST. - rename ARP_OP_INVREPLY as RTE_ARP_OP_INVREPLY. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 18 +++++++++--------- app/test/packet_burst_generator.c | 2 +- app/test/test_link_bonding.c | 18 +++++++++--------- drivers/net/bonding/rte_eth_bond_alb.c | 8 ++++---- drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++++++------ examples/bond/main.c | 8 ++++---- lib/librte_net/rte_arp.c | 4 ++-- lib/librte_net/rte_arp.h | 14 +++++++------- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 0f92d14ad..b0767f22b 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -39,17 +39,17 @@ static const char * arp_op_name(uint16_t arp_op) { switch (arp_op) { - case ARP_OP_REQUEST: + case RTE_ARP_OP_REQUEST: return "ARP Request"; - case ARP_OP_REPLY: + case RTE_ARP_OP_REPLY: return "ARP Reply"; - case ARP_OP_REVREQUEST: + case RTE_ARP_OP_REVREQUEST: return "Reverse ARP Request"; - case ARP_OP_REVREPLY: + case RTE_ARP_OP_REVREPLY: return "Reverse ARP Reply"; - case ARP_OP_INVREQUEST: + case RTE_ARP_OP_INVREQUEST: return "Peer Identify Request"; - case ARP_OP_INVREPLY: + case RTE_ARP_OP_INVREPLY: return "Peer Identify Reply"; default: break; @@ -359,7 +359,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) arp_op_name(arp_op)); } if ((RTE_BE_TO_CPU_16(arp_h->arp_hardware) != - ARP_HRD_ETHER) || + RTE_ARP_HRD_ETHER) || (arp_pro != ETHER_TYPE_IPv4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) @@ -381,7 +381,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ipv4_addr_dump(" tip=", ip_addr); printf("\n"); } - if (arp_op != ARP_OP_REQUEST) { + if (arp_op != RTE_ARP_OP_REQUEST) { rte_pktmbuf_free(pkt); continue; } @@ -396,7 +396,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); - arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 0b12058bb..ccc0bd591 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -78,7 +78,7 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { - arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 6ff0f5b9c..451c693d6 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4507,7 +4507,7 @@ test_alb_change_mac_in_reply_sent(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4518,7 +4518,7 @@ test_alb_change_mac_in_reply_sent(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4529,7 +4529,7 @@ test_alb_change_mac_in_reply_sent(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); @@ -4540,7 +4540,7 @@ test_alb_change_mac_in_reply_sent(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); slave_mac1 = @@ -4625,7 +4625,7 @@ test_alb_reply_from_client(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4637,7 +4637,7 @@ test_alb_reply_from_client(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4649,7 +4649,7 @@ test_alb_reply_from_client(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4661,7 +4661,7 @@ test_alb_reply_from_client(void) arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + sizeof(struct ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); @@ -4761,7 +4761,7 @@ test_alb_receive_vlan_reply(void) vlan_pkt->eth_proto = rte_cpu_to_be_16(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, - ARP_OP_REPLY); + RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, 1); diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index 703223937..f16ae8f21 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -84,7 +84,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); /* ARP Requests are forwarded to the application with no changes */ - if (arp->arp_opcode != rte_cpu_to_be_16(ARP_OP_REPLY)) + if (arp->arp_opcode != rte_cpu_to_be_16(RTE_ARP_OP_REPLY)) return; /* From now on, we analyze only ARP Reply packets */ @@ -150,7 +150,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, client_info = &hash_table[hash_index]; rte_spinlock_lock(&internals->mode6.lock); - if (arp->arp_opcode == rte_cpu_to_be_16(ARP_OP_REPLY)) { + if (arp->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REPLY)) { if (client_info->in_use) { if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { @@ -220,11 +220,11 @@ bond_mode_alb_arp_upd(struct client_data *client_info, ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; - arp_h->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); - arp_h->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); slave_idx = client_info->slave_idx; rte_spinlock_unlock(&internals->mode6.lock); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index fa8f81e2b..b5300df12 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -492,22 +492,22 @@ static void arp_op_name(uint16_t arp_op, char *buf, size_t buf_len) { switch (arp_op) { - case ARP_OP_REQUEST: + case RTE_ARP_OP_REQUEST: strlcpy(buf, "ARP Request", buf_len); return; - case ARP_OP_REPLY: + case RTE_ARP_OP_REPLY: strlcpy(buf, "ARP Reply", buf_len); return; - case ARP_OP_REVREQUEST: + case RTE_ARP_OP_REVREQUEST: strlcpy(buf, "Reverse ARP Request", buf_len); return; - case ARP_OP_REVREPLY: + case RTE_ARP_OP_REVREPLY: strlcpy(buf, "Reverse ARP Reply", buf_len); return; - case ARP_OP_INVREQUEST: + case RTE_ARP_OP_INVREQUEST: strlcpy(buf, "Peer Identify Request", buf_len); return; - case ARP_OP_INVREPLY: + case RTE_ARP_OP_INVREPLY: strlcpy(buf, "Peer Identify Reply", buf_len); return; default: diff --git a/examples/bond/main.c b/examples/bond/main.c index 24479649e..21a67e531 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -385,8 +385,8 @@ static int lcore_main(__attribute__((unused)) void *arg1) arp_hdr = (struct rte_arp_hdr *)( (char *)(eth_hdr + 1) + offset); if (arp_hdr->arp_data.arp_tip == bond_ip) { - if (arp_hdr->arp_opcode == rte_cpu_to_be_16(ARP_OP_REQUEST)) { - arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REPLY); + if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) { + arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); @@ -481,11 +481,11 @@ static void cmd_obj_send_parsed(void *parsed_result, arp_hdr = (struct rte_arp_hdr *)( (char *)eth_hdr + sizeof(struct ether_hdr)); - arp_hdr->arp_hardware = rte_cpu_to_be_16(ARP_HRD_ETHER); + 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_plen = sizeof(uint32_t); - arp_hdr->arp_opcode = rte_cpu_to_be_16(ARP_OP_REQUEST); + 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; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index c80ebc7e1..877874a5e 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -35,11 +35,11 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, /* RARP header. */ rarp = (struct rte_arp_hdr *)(eth_hdr + 1); - rarp->arp_hardware = htons(ARP_HRD_ETHER); + rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER); rarp->arp_protocol = htons(ETHER_TYPE_IPv4); rarp->arp_hlen = ETHER_ADDR_LEN; rarp->arp_plen = 4; - rarp->arp_opcode = htons(ARP_OP_REVREQUEST); + rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); ether_addr_copy(mac, &rarp->arp_data.arp_sha); ether_addr_copy(mac, &rarp->arp_data.arp_tha); diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index c9b5cd49d..a94fa6a00 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -33,18 +33,18 @@ struct rte_arp_ipv4 { */ struct rte_arp_hdr { uint16_t arp_hardware; /* format of hardware address */ -#define ARP_HRD_ETHER 1 /* ARP Ethernet address format */ +#define RTE_ARP_HRD_ETHER 1 /* ARP Ethernet address format */ uint16_t arp_protocol; /* format of protocol address */ uint8_t arp_hlen; /* length of hardware address */ uint8_t arp_plen; /* length of protocol address */ uint16_t arp_opcode; /* ARP opcode (command) */ -#define ARP_OP_REQUEST 1 /* request to resolve address */ -#define ARP_OP_REPLY 2 /* response to previous request */ -#define ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ -#define ARP_OP_REVREPLY 4 /* response giving protocol address */ -#define ARP_OP_INVREQUEST 8 /* request to identify peer */ -#define ARP_OP_INVREPLY 9 /* response identifying peer */ +#define RTE_ARP_OP_REQUEST 1 /* request to resolve address */ +#define RTE_ARP_OP_REPLY 2 /* response to previous request */ +#define RTE_ARP_OP_REVREQUEST 3 /* request proto addr given hardware */ +#define RTE_ARP_OP_REVREPLY 4 /* response giving protocol address */ +#define RTE_ARP_OP_INVREQUEST 8 /* request to identify peer */ +#define RTE_ARP_OP_INVREPLY 9 /* response identifying peer */ struct rte_arp_ipv4 arp_data; } __attribute__((__packed__)); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 03/15] net: add rte prefix to ether structures 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 02/15] net: add rte prefix to arp defines Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-29 8:39 ` David Marchand 2019-05-21 16:13 ` [dpdk-dev] [PATCH 04/15] net: add rte prefix to ether functions Olivier Matz ` (14 subsequent siblings) 17 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to structures: - rename struct ether_addr as struct rte_ether_addr. - rename struct ether_hdr as struct rte_ether_hdr. - rename struct vlan_hdr as struct rte_vlan_hdr. - rename struct vxlan_hdr as struct rte_vxlan_hdr. - rename struct vxlan_gpe_hdr as struct rte_vxlan_gpe_hdr. Do not update the command line library to avoid adding a dependency to librte_net. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/pdump/main.c | 2 +- app/test-pipeline/pipeline_acl.c | 13 +- app/test-pipeline/pipeline_hash.c | 4 +- app/test-pmd/cmdline.c | 50 +++--- app/test-pmd/cmdline_flow.c | 2 +- app/test-pmd/config.c | 25 +-- app/test-pmd/csumonly.c | 31 ++-- app/test-pmd/flowgen.c | 10 +- app/test-pmd/icmpecho.c | 18 +-- app/test-pmd/ieee1588fwd.c | 8 +- app/test-pmd/macfwd.c | 6 +- app/test-pmd/macswap.h | 6 +- app/test-pmd/macswap_common.h | 2 +- app/test-pmd/macswap_neon.h | 12 +- app/test-pmd/macswap_sse.h | 12 +- app/test-pmd/testpmd.c | 4 +- app/test-pmd/testpmd.h | 10 +- app/test-pmd/txonly.c | 19 +-- app/test-pmd/util.c | 12 +- app/test/packet_burst_generator.c | 36 +++-- app/test/packet_burst_generator.h | 21 +-- app/test/test_cmdline_etheraddr.c | 14 +- app/test/test_event_eth_rx_adapter.c | 2 +- app/test/test_event_eth_tx_adapter.c | 2 +- app/test/test_flow_classify.c | 34 ++--- app/test/test_link_bonding.c | 169 ++++++++++++--------- app/test/test_link_bonding_mode4.c | 55 +++---- app/test/test_link_bonding_rssconf.c | 2 +- app/test/test_pmd_perf.c | 10 +- app/test/test_sched.c | 18 ++- app/test/virtual_pmd.c | 4 +- app/test/virtual_pmd.h | 2 +- doc/guides/prog_guide/bbdev.rst | 6 +- doc/guides/sample_app_ug/flow_classify.rst | 12 +- doc/guides/sample_app_ug/flow_filtering.rst | 6 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 8 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 4 +- .../sample_app_ug/l2_forward_real_virtual.rst | 4 +- doc/guides/sample_app_ug/l3_forward.rst | 8 +- doc/guides/sample_app_ug/link_status_intr.rst | 4 +- doc/guides/sample_app_ug/ptpclient.rst | 6 +- doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- doc/guides/sample_app_ug/server_node_efd.rst | 4 +- doc/guides/sample_app_ug/skeleton.rst | 2 +- doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- drivers/bus/dpaa/include/fman.h | 2 +- drivers/bus/dpaa/include/netcfg.h | 4 +- drivers/net/af_packet/rte_eth_af_packet.c | 2 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +- drivers/net/ark/ark_ethdev.c | 14 +- drivers/net/ark/ark_ext.h | 4 +- drivers/net/ark/ark_global.h | 5 +- drivers/net/atlantic/atl_ethdev.c | 12 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- drivers/net/avp/avp_ethdev.c | 6 +- drivers/net/axgbe/axgbe_ethdev.h | 2 +- drivers/net/bnx2x/bnx2x.c | 8 +- drivers/net/bnx2x/bnx2x_ethdev.c | 5 +- drivers/net/bnx2x/bnx2x_ethdev.h | 3 +- drivers/net/bnx2x/bnx2x_vfpf.c | 2 +- drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 7 +- drivers/net/bnxt/bnxt_hwrm.c | 4 +- drivers/net/bnxt/bnxt_hwrm.h | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 6 +- drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- drivers/net/bonding/rte_eth_bond.h | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 6 +- drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- drivers/net/bonding/rte_eth_bond_8023ad_private.h | 2 +- drivers/net/bonding/rte_eth_bond_alb.c | 28 ++-- drivers/net/bonding/rte_eth_bond_alb.h | 10 +- drivers/net/bonding/rte_eth_bond_api.c | 2 +- drivers/net/bonding/rte_eth_bond_args.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 93 +++++++----- drivers/net/bonding/rte_eth_bond_private.h | 8 +- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_ethdev.c | 2 +- drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- drivers/net/dpaa/dpaa_ethdev.c | 4 +- drivers/net/dpaa/dpaa_rxtx.c | 3 +- drivers/net/dpaa2/dpaa2_ethdev.c | 19 +-- drivers/net/dpaa2/dpaa2_flow.c | 18 +-- drivers/net/e1000/em_ethdev.c | 17 ++- drivers/net/e1000/igb_ethdev.c | 26 ++-- drivers/net/e1000/igb_pf.c | 4 +- drivers/net/ena/ena_ethdev.c | 8 +- drivers/net/enetc/enetc_ethdev.c | 2 +- drivers/net/enic/enic.h | 2 +- drivers/net/enic/enic_ethdev.c | 12 +- drivers/net/enic/enic_flow.c | 34 ++--- drivers/net/enic/enic_main.c | 4 +- drivers/net/failsafe/failsafe.c | 2 +- drivers/net/failsafe/failsafe_args.c | 2 +- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/failsafe/failsafe_private.h | 4 +- drivers/net/fm10k/fm10k_ethdev.c | 8 +- drivers/net/i40e/i40e_ethdev.c | 58 +++---- drivers/net/i40e/i40e_ethdev.h | 21 +-- drivers/net/i40e/i40e_ethdev_vf.c | 32 ++-- drivers/net/i40e/i40e_fdir.c | 8 +- drivers/net/i40e/i40e_flow.c | 8 +- drivers/net/i40e/i40e_pf.c | 10 +- drivers/net/i40e/i40e_vf_representor.c | 2 +- drivers/net/i40e/rte_pmd_i40e.c | 15 +- drivers/net/i40e/rte_pmd_i40e.h | 8 +- drivers/net/iavf/iavf.h | 2 +- drivers/net/iavf/iavf_ethdev.c | 23 +-- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_ethdev.c | 31 ++-- drivers/net/ice/ice_ethdev.h | 4 +- drivers/net/ipn3ke/ipn3ke_ethdev.h | 4 +- drivers/net/ipn3ke/ipn3ke_representor.c | 4 +- drivers/net/ixgbe/ixgbe_ethdev.c | 52 ++++--- drivers/net/ixgbe/ixgbe_pf.c | 2 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 4 +- drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 3 +- drivers/net/mlx4/mlx4.c | 2 +- drivers/net/mlx4/mlx4.h | 8 +- drivers/net/mlx4/mlx4_ethdev.c | 6 +- drivers/net/mlx4/mlx4_flow.c | 4 +- drivers/net/mlx5/mlx5.c | 2 +- drivers/net/mlx5/mlx5.h | 13 +- drivers/net/mlx5/mlx5_flow_dv.c | 16 +- drivers/net/mlx5/mlx5_flow_tcf.c | 10 +- drivers/net/mlx5/mlx5_mac.c | 10 +- drivers/net/mlx5/mlx5_nl.c | 14 +- drivers/net/mlx5/mlx5_rxtx.h | 2 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mvneta/mvneta_ethdev.c | 4 +- drivers/net/mvpp2/mrvl_ethdev.c | 4 +- drivers/net/mvpp2/mrvl_flow.c | 2 +- drivers/net/netvsc/hn_ethdev.c | 2 +- drivers/net/netvsc/hn_rxtx.c | 4 +- drivers/net/netvsc/hn_var.h | 4 +- drivers/net/netvsc/hn_vf.c | 6 +- drivers/net/nfb/nfb_ethdev.c | 8 +- drivers/net/nfp/nfp_net.c | 9 +- drivers/net/null/rte_eth_null.c | 4 +- drivers/net/octeontx/octeontx_ethdev.c | 2 +- drivers/net/pcap/rte_eth_pcap.c | 4 +- drivers/net/qede/qede_ethdev.c | 34 +++-- drivers/net/qede/qede_ethdev.h | 6 +- drivers/net/qede/qede_filter.c | 4 +- drivers/net/qede/qede_if.h | 2 +- drivers/net/qede/qede_rxtx.c | 14 +- drivers/net/ring/rte_eth_ring.c | 4 +- drivers/net/sfc/sfc.h | 2 +- drivers/net/sfc/sfc_ethdev.c | 12 +- drivers/net/sfc/sfc_port.c | 6 +- drivers/net/softnic/parser.c | 12 +- drivers/net/softnic/parser.h | 2 +- drivers/net/softnic/rte_eth_softnic.c | 2 +- drivers/net/szedata2/rte_eth_szedata2.c | 6 +- drivers/net/tap/rte_eth_tap.c | 21 +-- drivers/net/tap/rte_eth_tap.h | 4 +- drivers/net/tap/tap_bpf_program.c | 8 +- drivers/net/thunderx/base/nicvf_plat.h | 3 + drivers/net/thunderx/nicvf_ethdev.c | 4 +- drivers/net/vdev_netvsc/vdev_netvsc.c | 12 +- drivers/net/vhost/rte_eth_vhost.c | 8 +- drivers/net/virtio/virtio_ethdev.c | 18 +-- drivers/net/virtio/virtio_rxtx.c | 4 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 8 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 6 +- examples/bbdev_app/main.c | 39 ++--- examples/bond/main.c | 30 ++-- examples/distributor/main.c | 2 +- examples/ethtool/ethtool-app/ethapp.c | 4 +- examples/ethtool/ethtool-app/main.c | 6 +- examples/ethtool/lib/rte_ethtool.c | 6 +- examples/ethtool/lib/rte_ethtool.h | 7 +- examples/eventdev_pipeline/main.c | 2 +- examples/eventdev_pipeline/pipeline_common.h | 6 +- examples/flow_classify/flow_classify.c | 12 +- examples/flow_filtering/main.c | 6 +- examples/ip_fragmentation/main.c | 19 +-- examples/ip_pipeline/cli.c | 4 +- examples/ip_pipeline/parser.c | 12 +- examples/ip_pipeline/parser.h | 2 +- examples/ip_reassembly/main.c | 13 +- examples/ipsec-secgw/ipsec-secgw.c | 19 +-- examples/ipsec-secgw/ipsec.h | 2 +- examples/ipsec-secgw/parser.c | 4 +- examples/ipv4_multicast/main.c | 16 +- examples/kni/main.c | 8 +- examples/l2fwd-cat/l2fwd-cat.c | 2 +- examples/l2fwd-crypto/main.c | 12 +- examples/l2fwd-jobstats/main.c | 6 +- examples/l2fwd-keepalive/main.c | 6 +- examples/l2fwd/main.c | 6 +- examples/l3fwd-acl/main.c | 20 +-- examples/l3fwd-power/main.c | 16 +- examples/l3fwd-vf/main.c | 10 +- examples/l3fwd/l3fwd.h | 2 +- examples/l3fwd/l3fwd_altivec.h | 12 +- examples/l3fwd/l3fwd_em.c | 6 +- examples/l3fwd/l3fwd_em.h | 8 +- examples/l3fwd/l3fwd_em_hlm.h | 11 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 8 +- examples/l3fwd/l3fwd_em_hlm_sse.h | 8 +- examples/l3fwd/l3fwd_em_sequential.h | 11 +- examples/l3fwd/l3fwd_lpm.c | 14 +- examples/l3fwd/l3fwd_lpm.h | 8 +- examples/l3fwd/l3fwd_lpm_altivec.h | 10 +- examples/l3fwd/l3fwd_lpm_neon.h | 20 +-- examples/l3fwd/l3fwd_lpm_sse.h | 10 +- examples/l3fwd/l3fwd_neon.h | 12 +- examples/l3fwd/l3fwd_sse.h | 12 +- examples/l3fwd/main.c | 8 +- examples/link_status_interrupt/main.c | 6 +- examples/load_balancer/runtime.c | 6 +- .../client_server_mp/mp_server/main.c | 2 +- examples/packet_ordering/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 136 ++++++++--------- examples/ptpclient/ptpclient.c | 28 ++-- examples/qos_meter/main.c | 3 +- examples/quota_watermark/qw/main.c | 6 +- examples/rxtx_callbacks/main.c | 2 +- examples/server_node_efd/node/node.c | 2 +- examples/server_node_efd/server/main.c | 4 +- examples/skeleton/basicfwd.c | 2 +- examples/tep_termination/main.c | 2 +- examples/tep_termination/main.h | 2 +- examples/tep_termination/vxlan.c | 44 +++--- examples/tep_termination/vxlan.h | 6 +- examples/tep_termination/vxlan_setup.c | 6 +- examples/tep_termination/vxlan_setup.h | 2 +- examples/vhost/main.c | 26 ++-- examples/vhost/main.h | 2 +- examples/vm_power_manager/channel_monitor.c | 6 +- .../guest_cli/vm_power_cli_guest.c | 2 +- examples/vm_power_manager/main.c | 4 +- examples/vmdq/main.c | 10 +- examples/vmdq_dcb/main.c | 10 +- lib/librte_ethdev/rte_class_eth.c | 2 +- lib/librte_ethdev/rte_eth_ctrl.h | 12 +- lib/librte_ethdev/rte_ethdev.c | 20 +-- lib/librte_ethdev/rte_ethdev.h | 13 +- lib/librte_ethdev/rte_ethdev_core.h | 12 +- lib/librte_ethdev/rte_flow.h | 12 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 7 +- lib/librte_gro/gro_tcp4.c | 4 +- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 12 +- lib/librte_gro/gro_vxlan_tcp4.h | 6 +- lib/librte_gso/rte_gso.h | 4 +- lib/librte_kni/rte_kni.c | 2 +- lib/librte_net/rte_arp.c | 7 +- lib/librte_net/rte_arp.h | 6 +- lib/librte_net/rte_ether.h | 64 ++++---- lib/librte_net/rte_net.c | 20 +-- lib/librte_pipeline/rte_table_action.c | 60 ++++---- lib/librte_pipeline/rte_table_action.h | 4 +- lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/virtio_net.c | 11 +- 261 files changed, 1480 insertions(+), 1372 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index 3d208548f..80dc924cf 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -549,7 +549,7 @@ signal_handler(int sig_num) static inline int configure_vdev(uint16_t port_id) { - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rxRings = 0, txRings = 1; int ret; uint16_t q; diff --git a/app/test-pipeline/pipeline_acl.c b/app/test-pipeline/pipeline_acl.c index 524d2212d..e53e5ecef 100644 --- a/app/test-pipeline/pipeline_acl.c +++ b/app/test-pipeline/pipeline_acl.c @@ -39,7 +39,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, { @@ -47,7 +47,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, { @@ -55,7 +55,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, { @@ -63,15 +63,16 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr), + .offset = sizeof(struct rte_ether_hdr) + + sizeof(struct ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, - .offset = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + - sizeof(uint16_t), + .offset = sizeof(struct rte_ether_hdr) + + sizeof(struct ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index c20147234..3e4a0a1bb 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -441,14 +441,14 @@ app_main_loop_rx_metadata(void) { if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip_hdr = (struct ipv4_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { ipv6_hdr = (struct ipv6_hdr *) - &m_data[sizeof(struct ether_hdr)]; + &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; memcpy(key, ipv6_dst, 16); diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index c1042dd98..90e35022e 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6124,7 +6124,7 @@ struct cmd_set_bond_mac_addr_result { cmdline_fixed_string_t bonding; cmdline_fixed_string_t mac_addr; uint16_t port_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_set_bond_mac_addr_parsed(void *parsed_result, @@ -7897,7 +7897,7 @@ struct cmd_mac_addr_result { cmdline_fixed_string_t mac_addr_cmd; cmdline_fixed_string_t what; uint16_t port_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_mac_addr_parsed(void *parsed_result, @@ -8096,7 +8096,7 @@ struct cmd_set_uc_hash_table { cmdline_fixed_string_t port; portid_t port_id; cmdline_fixed_string_t what; - struct ether_addr address; + struct rte_ether_addr address; cmdline_fixed_string_t mode; }; @@ -8220,7 +8220,7 @@ struct cmd_set_vf_macvlan_filter { portid_t port_id; cmdline_fixed_string_t vf; uint8_t vf_id; - struct ether_addr address; + struct rte_ether_addr address; cmdline_fixed_string_t filter_type; cmdline_fixed_string_t mode; }; @@ -8479,7 +8479,7 @@ struct cmd_vf_mac_addr_result { uint16_t port_num; cmdline_fixed_string_t vf; uint8_t vf_num; - struct ether_addr address; + struct rte_ether_addr address; }; static void cmd_vf_mac_addr_parsed(void *parsed_result, @@ -8792,8 +8792,8 @@ struct cmd_tunnel_filter_result { cmdline_fixed_string_t cmd; cmdline_fixed_string_t what; portid_t port_id; - struct ether_addr outer_mac; - struct ether_addr inner_mac; + struct rte_ether_addr outer_mac; + struct rte_ether_addr inner_mac; cmdline_ipaddr_t ip_value; uint16_t inner_vlan; cmdline_fixed_string_t tunnel_type; @@ -10583,7 +10583,7 @@ struct cmd_ethertype_filter_result { portid_t port_id; cmdline_fixed_string_t ops; cmdline_fixed_string_t mac; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; cmdline_fixed_string_t ethertype; uint16_t ethertype_value; cmdline_fixed_string_t drop; @@ -10643,7 +10643,7 @@ cmd_ethertype_filter_parsed(void *parsed_result, if (!strcmp(res->mac, "mac_addr")) { filter.flags |= RTE_ETHTYPE_FLAGS_MAC; rte_memcpy(&filter.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } if (!strcmp(res->drop, "drop")) filter.flags |= RTE_ETHTYPE_FLAGS_DROP; @@ -10722,7 +10722,7 @@ struct cmd_flow_director_result { cmdline_fixed_string_t fd_id; uint32_t fd_id_value; cmdline_fixed_string_t mac; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; cmdline_fixed_string_t tunnel; cmdline_fixed_string_t tunnel_type; cmdline_fixed_string_t tunnel_id; @@ -11025,12 +11025,12 @@ cmd_flow_director_filter_parsed(void *parsed_result, if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) rte_memcpy(&entry.input.flow.mac_vlan_flow.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); if (fdir_conf.mode == RTE_FDIR_MODE_PERFECT_TUNNEL) { rte_memcpy(&entry.input.flow.tunnel_flow.mac_addr, &res->mac_addr, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); entry.input.flow.tunnel_flow.tunnel_type = str2fdir_tunneltype(res->tunnel_type); entry.input.flow.tunnel_flow.tunnel_id = @@ -12463,7 +12463,7 @@ struct cmd_mcast_addr_result { cmdline_fixed_string_t mcast_addr_cmd; cmdline_fixed_string_t what; uint16_t port_num; - struct ether_addr mc_addr; + struct rte_ether_addr mc_addr; }; static void cmd_mcast_addr_parsed(void *parsed_result, @@ -13882,7 +13882,7 @@ struct cmd_set_vf_mac_addr_result { cmdline_fixed_string_t addr; portid_t port_id; uint16_t vf_id; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; @@ -14187,7 +14187,7 @@ struct cmd_macsec_sc_result { cmdline_fixed_string_t sc; cmdline_fixed_string_t tx_rx; portid_t port_id; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t pi; }; @@ -15188,8 +15188,8 @@ struct cmd_set_vxlan_result { uint16_t tci; uint8_t tos; uint8_t ttl; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_vxlan_set = @@ -15411,8 +15411,8 @@ struct cmd_set_nvgre_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_nvgre_set = @@ -15557,8 +15557,8 @@ struct cmd_set_l2_encap_result { cmdline_fixed_string_t ip_version; uint32_t vlan_present:1; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_l2_encap_set = @@ -15714,8 +15714,8 @@ struct cmd_set_mplsogre_encap_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_mplsogre_encap_set = @@ -15938,8 +15938,8 @@ struct cmd_set_mplsoudp_encap_result { cmdline_ipaddr_t ip_src; cmdline_ipaddr_t ip_dst; uint16_t tci; - struct ether_addr eth_src; - struct ether_addr eth_dst; + struct rte_ether_addr eth_src; + struct rte_ether_addr eth_dst; }; cmdline_parse_token_string_t cmd_set_mplsoudp_encap_set = diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 3070e0e0d..2e274f9b1 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -4613,7 +4613,7 @@ parse_mac_addr(struct context *ctx, const struct token *token, void *buf, unsigned int size) { const struct arg *arg = pop_args(ctx); - struct ether_addr tmp; + struct rte_ether_addr tmp; int ret; (void)token; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index f9cb12964..03ce502ba 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -108,7 +108,7 @@ const struct rss_type_info rss_type_table[] = { }; static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -391,7 +391,7 @@ void port_infos_display(portid_t port_id) { struct rte_port *port; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link link; struct rte_eth_dev_info dev_info; int vlan_offload; @@ -538,7 +538,7 @@ port_summary_header_display(void) void port_summary_display(portid_t port_id) { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link link; struct rte_eth_dev_info dev_info; char name[RTE_ETH_NAME_MAX_LEN]; @@ -2519,7 +2519,8 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) * Check that each segment length is greater or equal than * the mbuf data sise. * Check also that the total packet length is greater or equal than the - * size of an empty UDP/IP packet (sizeof(struct ether_hdr) + 20 + 8). + * size of an empty UDP/IP packet (sizeof(struct rte_ether_hdr) + + * 20 + 8). */ tx_pkt_len = 0; for (i = 0; i < nb_segs; i++) { @@ -2530,10 +2531,10 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) } tx_pkt_len = (uint16_t)(tx_pkt_len + seg_lengths[i]); } - if (tx_pkt_len < (sizeof(struct ether_hdr) + 20 + 8)) { + if (tx_pkt_len < (sizeof(struct rte_ether_hdr) + 20 + 8)) { printf("total packet length=%u < %d - give up\n", (unsigned) tx_pkt_len, - (int)(sizeof(struct ether_hdr) + 20 + 8)); + (int)(sizeof(struct rte_ether_hdr) + 20 + 8)); return; } @@ -3453,7 +3454,7 @@ set_vf_rate_limit(portid_t port_id, uint16_t vf, uint16_t rate, uint64_t q_msk) static int mcast_addr_pool_extend(struct rte_port *port) { - struct ether_addr *mc_pool; + struct rte_ether_addr *mc_pool; size_t mc_pool_size; /* @@ -3470,9 +3471,9 @@ mcast_addr_pool_extend(struct rte_port *port) * The previous test guarantees that port->mc_addr_nb is a multiple * of MCAST_POOL_INC. */ - mc_pool_size = sizeof(struct ether_addr) * (port->mc_addr_nb + + mc_pool_size = sizeof(struct rte_ether_addr) * (port->mc_addr_nb + MCAST_POOL_INC); - mc_pool = (struct ether_addr *) realloc(port->mc_addr_pool, + mc_pool = (struct rte_ether_addr *) realloc(port->mc_addr_pool, mc_pool_size); if (mc_pool == NULL) { printf("allocation of pool of %u multicast addresses failed\n", @@ -3501,7 +3502,7 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx) } memmove(&port->mc_addr_pool[addr_idx], &port->mc_addr_pool[addr_idx + 1], - sizeof(struct ether_addr) * (port->mc_addr_nb - addr_idx)); + sizeof(struct rte_ether_addr) * (port->mc_addr_nb - addr_idx)); } static void @@ -3520,7 +3521,7 @@ eth_port_multicast_addr_list_set(portid_t port_id) } void -mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr) +mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) { struct rte_port *port; uint32_t i; @@ -3548,7 +3549,7 @@ mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr) } void -mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr) +mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr) { struct rte_port *port; uint32_t i; diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index f4f2a7b29..481b91a26 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -142,18 +142,19 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) * header. The l4_len argument is only set in case of TCP (useful for TSO). */ static void -parse_ethernet(struct ether_hdr *eth_hdr, struct testpmd_offload_info *info) +parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - info->l2_len = sizeof(struct ether_hdr); + info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; if (info->ethertype == _htons(ETHER_TYPE_VLAN)) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = ( + struct rte_vlan_hdr *)(eth_hdr + 1); - info->l2_len += sizeof(struct vlan_hdr); + info->l2_len += sizeof(struct rte_vlan_hdr); info->ethertype = vlan_hdr->eth_proto; } @@ -180,7 +181,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info, uint32_t pkt_type) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; /* check udp destination port, 4789 is the default vxlan port * (rfc7348) or that the rx offload flag is set (i40e only @@ -195,9 +196,9 @@ parse_vxlan(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)udp_hdr + + eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr) + - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); info->l2_len += ETHER_VXLAN_HLEN; /* add udp + vxlan */ @@ -208,17 +209,17 @@ static void parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - struct vxlan_gpe_hdr *vxlan_gpe_hdr; + struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); /* Check udp destination port. */ if (udp_hdr->dst_port != _htons(vxlan_gpe_udp_port)) return; - vxlan_gpe_hdr = (struct vxlan_gpe_hdr *)((char *)udp_hdr + + vxlan_gpe_hdr = (struct rte_vxlan_gpe_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == @@ -257,7 +258,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)vxlan_gpe_hdr + + eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ethernet(eth_hdr, info); @@ -271,7 +272,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; @@ -318,7 +319,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - eth_hdr = (struct ether_hdr *)((char *)gre_hdr + gre_len); + eth_hdr = (struct rte_ether_hdr *)((char *)gre_hdr + gre_len); parse_ethernet(eth_hdr, info); } else @@ -691,7 +692,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) struct rte_mbuf **tx_pkts_burst; struct rte_port *txp; struct rte_mbuf *m, *p; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; void *l3_hdr = NULL, *outer_l3_hdr = NULL; /* can be IPv4 or IPv6 */ void **gro_ctx; uint16_t gro_pkts_num; @@ -765,7 +766,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* step 1: dissect packet, parsing optional vlan, ip4/ip6, vxlan * and inner headers */ - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 3214e3c95..ac56ca1d8 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -76,9 +76,9 @@ static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; -static struct ether_addr cfg_ether_src = +static struct rte_ether_addr cfg_ether_src = {{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x00 }}; -static struct ether_addr cfg_ether_dst = +static struct rte_ether_addr cfg_ether_dst = {{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x01 }}; #define IP_DEFTTL 64 /* from RFC 1340. */ @@ -119,7 +119,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mempool *mbp; struct rte_mbuf *pkt; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; @@ -170,7 +170,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->next = NULL; /* Initialize Ethernet header. */ - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); eth_hdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4); @@ -205,7 +205,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; - pkt->l2_len = sizeof(struct ether_hdr); + pkt->l2_len = sizeof(struct rte_ether_hdr); pkt->l3_len = sizeof(struct ipv4_hdr); pkts_burst[nb_pkt] = pkt; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index b0767f22b..3cc4d25a4 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -221,7 +221,7 @@ ipv4_addr_to_dot(uint32_t be_ipv4_addr, char *buf) } static void -ether_addr_dump(const char *what, const struct ether_addr *ea) +ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { char buf[ETHER_ADDR_FMT_SIZE]; @@ -275,12 +275,12 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_mbuf *pkt; - struct ether_hdr *eth_h; - struct vlan_hdr *vlan_h; + struct rte_ether_hdr *eth_h; + struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; struct icmp_hdr *icmp_h; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; uint16_t nb_rx; @@ -321,9 +321,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); pkt = pkts_burst[i]; - eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_h->ether_type); - l2_len = sizeof(struct ether_hdr); + l2_len = sizeof(struct rte_ether_hdr); if (verbose_level > 0) { printf("\nPort %d pkt-len=%u nb-segs=%u\n", fs->rx_port, pkt->pkt_len, pkt->nb_segs); @@ -331,9 +331,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ether_addr_dump(" dst=", ð_h->d_addr); } if (eth_type == ETHER_TYPE_VLAN) { - vlan_h = (struct vlan_hdr *) - ((char *)eth_h + sizeof(struct ether_hdr)); - l2_len += sizeof(struct vlan_hdr); + vlan_h = (struct rte_vlan_hdr *) + ((char *)eth_h + sizeof(struct rte_ether_hdr)); + l2_len += sizeof(struct rte_vlan_hdr); eth_type = rte_be_to_cpu_16(vlan_h->eth_proto); if (verbose_level > 0) { vlan_id = rte_be_to_cpu_16(vlan_h->vlan_tci) diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index 6ae802c86..c6aa3c618 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -93,8 +93,8 @@ static void ieee1588_packet_fwd(struct fwd_stream *fs) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; - struct ether_addr addr; + struct rte_ether_hdr *eth_hdr; + struct rte_ether_addr addr; struct ptpv2_msg *ptp_hdr; uint16_t eth_type; uint32_t timesync_index; @@ -111,7 +111,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * Check that the received packet is a PTP packet that was detected * by the hardware. */ - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (! (mb->ol_flags & PKT_RX_IEEE1588_PTP)) { @@ -141,7 +141,7 @@ ieee1588_packet_fwd(struct fwd_stream *fs) * PTP_SYNC_MESSAGE. */ ptp_hdr = (struct ptpv2_msg *) (rte_pktmbuf_mtod(mb, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (ptp_hdr->version != 0x02) { printf("Port %u Received PTP V2 Ethernet frame with wrong PTP" " protocol version 0x%x (should be 0x02)\n", diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 7cac757a0..631f86f3e 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -49,7 +49,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; struct rte_port *txp; struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t retry; uint16_t nb_rx; uint16_t nb_tx; @@ -91,14 +91,14 @@ pkt_burst_mac_forward(struct fwd_stream *fs) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i + 1], void *)); mb = pkts_burst[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; - mb->l2_len = sizeof(struct ether_hdr); + mb->l2_len = sizeof(struct rte_ether_hdr); mb->l3_len = sizeof(struct ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; diff --git a/app/test-pmd/macswap.h b/app/test-pmd/macswap.h index bfa9b0eda..d53e5d482 100644 --- a/app/test-pmd/macswap.h +++ b/app/test-pmd/macswap.h @@ -11,9 +11,9 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_mbuf *mb; - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t ol_flags; int i; @@ -26,7 +26,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb = pkts[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ ether_addr_copy(ð_hdr->d_addr, &addr); diff --git a/app/test-pmd/macswap_common.h b/app/test-pmd/macswap_common.h index 19754cdd1..56f86baad 100644 --- a/app/test-pmd/macswap_common.h +++ b/app/test-pmd/macswap_common.h @@ -39,7 +39,7 @@ mbuf_field_set(struct rte_mbuf *mb, uint64_t ol_flags) { mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; - mb->l2_len = sizeof(struct ether_hdr); + mb->l2_len = sizeof(struct rte_ether_hdr); mb->l3_len = sizeof(struct ipv4_hdr); } diff --git a/app/test-pmd/macswap_neon.h b/app/test-pmd/macswap_neon.h index bdf416aa2..df6c260cd 100644 --- a/app/test-pmd/macswap_neon.h +++ b/app/test-pmd/macswap_neon.h @@ -16,7 +16,7 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr[4]; + struct rte_ether_hdr *eth_hdr[4]; struct rte_mbuf *mb[4]; uint64_t ol_flags; int i; @@ -46,16 +46,16 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, } mb[0] = pkts[i++]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); mb[1] = pkts[i++]; - eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct rte_ether_hdr *); mb[2] = pkts[i++]; - eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct rte_ether_hdr *); mb[3] = pkts[i++]; - eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct rte_ether_hdr *); v0 = vld1q_u8((uint8_t const *)eth_hdr[0]); v1 = vld1q_u8((uint8_t const *)eth_hdr[1]); @@ -83,7 +83,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, if (i < nb - 1) rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb[0] = pkts[i]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ v0 = vld1q_u8((uint8_t const *)eth_hdr[0]); diff --git a/app/test-pmd/macswap_sse.h b/app/test-pmd/macswap_sse.h index 2b6e7324d..223f87a53 100644 --- a/app/test-pmd/macswap_sse.h +++ b/app/test-pmd/macswap_sse.h @@ -11,7 +11,7 @@ static inline void do_macswap(struct rte_mbuf *pkts[], uint16_t nb, struct rte_port *txp) { - struct ether_hdr *eth_hdr[4]; + struct rte_ether_hdr *eth_hdr[4]; struct rte_mbuf *mb[4]; uint64_t ol_flags; int i; @@ -43,20 +43,20 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, } mb[0] = pkts[i++]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); addr0 = _mm_loadu_si128((__m128i *)eth_hdr[0]); mb[1] = pkts[i++]; - eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(mb[1], struct rte_ether_hdr *); addr1 = _mm_loadu_si128((__m128i *)eth_hdr[1]); mb[2] = pkts[i++]; - eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(mb[2], struct rte_ether_hdr *); addr2 = _mm_loadu_si128((__m128i *)eth_hdr[2]); mb[3] = pkts[i++]; - eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(mb[3], struct rte_ether_hdr *); addr3 = _mm_loadu_si128((__m128i *)eth_hdr[3]); addr0 = _mm_shuffle_epi8(addr0, shfl_msk); @@ -80,7 +80,7 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, if (i < nb - 1) rte_prefetch0(rte_pktmbuf_mtod(pkts[i+1], void *)); mb[0] = pkts[i]; - eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(mb[0], struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ addr0 = _mm_loadu_si128((__m128i *)eth_hdr[0]); diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index f0061d99f..2c736ecac 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -137,7 +137,7 @@ uint8_t txring_numa[RTE_MAX_ETHPORTS]; * Must be instantiated with the ethernet addresses of peer traffic generator * ports. */ -struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; +struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; portid_t nb_peer_eth_addrs = 0; /* @@ -2018,7 +2018,7 @@ start_port(portid_t pid) portid_t pi; queueid_t qi; struct rte_port *port; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; if (port_id_is_invalid(pid, ENABLED_WARN)) return 0; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1d9b7a245..abee0a952 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -162,7 +162,7 @@ struct softnic_port { struct rte_port { struct rte_eth_dev_info dev_info; /**< PCI info + driver name */ struct rte_eth_conf dev_conf; /**< Port configuration. */ - struct ether_addr eth_addr; /**< Port ethernet address */ + struct rte_ether_addr eth_addr; /**< Port ethernet address */ struct rte_eth_stats stats; /**< Last port statistics */ unsigned int socket_id; /**< For NUMA support */ uint16_t parse_tunnel:1; /**< Parse internal headers */ @@ -182,7 +182,7 @@ struct rte_port { uint16_t nb_tx_desc[MAX_QUEUE_ID+1]; /**< per queue tx desc number */ struct rte_eth_rxconf rx_conf[MAX_QUEUE_ID+1]; /**< per queue rx configuration */ struct rte_eth_txconf tx_conf[MAX_QUEUE_ID+1]; /**< per queue tx configuration */ - struct ether_addr *mc_addr_pool; /**< pool of multicast addrs */ + struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ uint8_t slave_flag; /**< bonding slave port */ struct port_flow *flow_list; /**< Associated flows. */ @@ -460,7 +460,7 @@ extern struct fwd_stream **fwd_streams; extern uint16_t vxlan_gpe_udp_port; /**< UDP port of tunnel VXLAN-GPE. */ extern portid_t nb_peer_eth_addrs; /**< Number of peer ethernet addresses. */ -extern struct ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for mac-retry. */ extern uint32_t burst_tx_retry_num; /**< Burst tx retry number for mac-retry. */ @@ -819,8 +819,8 @@ void show_gro(portid_t port_id); void setup_gso(const char *mode, portid_t port_id); /* Functions to manage the set of filtered Multicast MAC addresses */ -void mcast_addr_add(portid_t port_id, struct ether_addr *mc_addr); -void mcast_addr_remove(portid_t port_id, struct ether_addr *mc_addr); +void mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr); +void mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr); void port_dcb_info_display(portid_t port_id); uint8_t *open_file(const char *file_path, uint32_t *size); diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index fdfca14cb..e558b4018 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -152,7 +152,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, static inline bool pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, - struct ether_hdr *eth_hdr, const uint16_t vlan_tci, + struct rte_ether_hdr *eth_hdr, const uint16_t vlan_tci, const uint16_t vlan_tci_outer, const uint64_t ol_flags) { struct rte_mbuf *pkt_segs[RTE_MAX_SEGS_PER_PKT]; @@ -176,7 +176,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, pkt->ol_flags = ol_flags; pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; - pkt->l2_len = sizeof(struct ether_hdr); + pkt->l2_len = sizeof(struct rte_ether_hdr); pkt->l3_len = sizeof(struct ipv4_hdr); pkt_len = pkt->data_len; @@ -193,14 +193,14 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, */ copy_buf_to_pkt(eth_hdr, sizeof(*eth_hdr), pkt, 0); copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (txonly_multi_flow) { struct ipv4_hdr *ip_hdr; uint32_t addr; ip_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* * Generate multiple flows by varying IP src addr. This * enables packets are well distributed by RSS in @@ -212,7 +212,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, ip_hdr->src_addr = rte_cpu_to_be_32(addr); } copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr)); /* * Complete first mbuf of packet and append it to the @@ -234,7 +234,7 @@ pkt_burst_transmit(struct fwd_stream *fs) struct rte_port *txp; struct rte_mbuf *pkt; struct rte_mempool *mbp; - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; uint16_t nb_tx; uint16_t nb_pkt; uint16_t vlan_tci, vlan_tci_outer; @@ -347,9 +347,10 @@ tx_only_begin(__attribute__((unused)) portid_t pi) { uint16_t pkt_data_len; - pkt_data_len = (uint16_t) (tx_pkt_length - (sizeof(struct ether_hdr) + - sizeof(struct ipv4_hdr) + - sizeof(struct udp_hdr))); + pkt_data_len = (uint16_t) (tx_pkt_length - ( + sizeof(struct rte_ether_hdr) + + sizeof(struct ipv4_hdr) + + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 6b0791daa..0544b8e53 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -14,7 +14,7 @@ #include "testpmd.h" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -26,7 +26,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, int is_rx) { struct rte_mbuf *mb; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; uint64_t ol_flags; uint16_t i, packet_type; @@ -46,7 +46,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], (unsigned int) nb_pkts); for (i = 0; i < nb_pkts; i++) { mb = pkts[i]; - eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); eth_type = RTE_BE_TO_CPU_16(eth_hdr->ether_type); ol_flags = mb->ol_flags; packet_type = mb->packet_type; @@ -110,9 +110,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint8_t l3_len; uint8_t l4_len; uint8_t l4_proto; - struct vxlan_hdr *vxlan_hdr; + struct rte_vxlan_hdr *vxlan_hdr; - l2_len = sizeof(struct ether_hdr); + l2_len = sizeof(struct rte_ether_hdr); /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { @@ -134,7 +134,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], l2_len + l3_len); l4_len = sizeof(struct udp_hdr); vxlan_hdr = rte_pktmbuf_mtod_offset(mb, - struct vxlan_hdr *, + struct rte_vxlan_hdr *, l2_len + l3_len + l4_len); udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port); vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index ccc0bd591..a05e3c86c 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -53,16 +53,17 @@ copy_buf_to_pkt(void *buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } void -initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t ether_type, +initialize_eth_header(struct rte_ether_hdr *eth_hdr, + struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id) { ether_addr_copy(dst_mac, ð_hdr->d_addr); ether_addr_copy(src_mac, ð_hdr->s_addr); if (vlan_enabled) { - struct vlan_hdr *vhdr = (struct vlan_hdr *)((uint8_t *)eth_hdr + - sizeof(struct ether_hdr)); + 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); @@ -74,8 +75,10 @@ initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, } void -initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, +initialize_arp_header(struct rte_arp_hdr *arp_hdr, + struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, + uint32_t src_ip, uint32_t dst_ip, uint32_t opcode) { arp_hdr->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); @@ -256,9 +259,9 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, - uint8_t pkt_len, uint8_t nb_pkt_segs) + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, + void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, + int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { int i, nb_pkt = 0; size_t eth_hdr_size; @@ -293,9 +296,10 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, * Copy headers in first packet segment(s). */ if (vlan_enabled) - eth_hdr_size = sizeof(struct ether_hdr) + sizeof(struct vlan_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr); else - eth_hdr_size = sizeof(struct ether_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr); copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); @@ -333,8 +337,8 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, int generate_packet_burst_proto(struct rte_mempool *mp, - struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, + uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, uint8_t proto, void *proto_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { @@ -371,10 +375,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, * Copy headers in first packet segment(s). */ if (vlan_enabled) - eth_hdr_size = sizeof(struct ether_hdr) + - sizeof(struct vlan_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr); else - eth_hdr_size = sizeof(struct ether_hdr); + eth_hdr_size = sizeof(struct rte_ether_hdr); copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index b6e013a11..744e21a1f 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -24,14 +24,15 @@ extern "C" { #define PACKET_BURST_GEN_PKT_LEN_128 128 void -initialize_eth_header(struct ether_hdr *eth_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t ether_type, +initialize_eth_header(struct rte_ether_hdr *eth_hdr, + struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id); void -initialize_arp_header(struct rte_arp_hdr *arp_hdr, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint32_t src_ip, uint32_t dst_ip, - uint32_t opcode); +initialize_arp_header(struct rte_arp_hdr *arp_hdr, + struct rte_ether_addr *src_mac, struct rte_ether_addr *dst_mac, + uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); uint16_t initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, @@ -59,14 +60,14 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, - uint8_t ipv4, struct udp_hdr *udp_hdr, int nb_pkt_per_burst, - uint8_t pkt_len, uint8_t nb_pkt_segs); + struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, + void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, + int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); int generate_packet_burst_proto(struct rte_mempool *mp, - struct rte_mbuf **pkts_burst, - struct ether_hdr *eth_hdr, uint8_t vlan_enabled, void *ip_hdr, + struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, + uint8_t vlan_enabled, void *ip_hdr, uint8_t ipv4, uint8_t proto, void *proto_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); diff --git a/app/test/test_cmdline_etheraddr.c b/app/test/test_cmdline_etheraddr.c index 086108ab2..90943c2b4 100644 --- a/app/test/test_cmdline_etheraddr.c +++ b/app/test/test_cmdline_etheraddr.c @@ -82,7 +82,7 @@ const char * ether_addr_invalid_strs[] = { static int -is_addr_different(const struct ether_addr addr, uint64_t num) +is_addr_different(const struct rte_ether_addr addr, uint64_t num) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++, num >>= 8) @@ -97,7 +97,7 @@ int test_parse_etheraddr_invalid_param(void) { char buf[CMDLINE_TEST_BUFSIZE]; - struct ether_addr result; + struct rte_ether_addr result; int ret = 0; /* try all null */ @@ -148,12 +148,12 @@ test_parse_etheraddr_invalid_data(void) { int ret = 0; unsigned i; - struct ether_addr result; + struct rte_ether_addr result; /* test full strings */ for (i = 0; i < ETHERADDR_INVALID_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_invalid_strs[i], (void*)&result, sizeof(result)); @@ -173,12 +173,12 @@ test_parse_etheraddr_valid(void) { int ret = 0; unsigned i; - struct ether_addr result; + struct rte_ether_addr result; /* test full strings */ for (i = 0; i < ETHERADDR_VALID_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_valid_strs[i].str, (void*)&result, sizeof(result)); @@ -197,7 +197,7 @@ test_parse_etheraddr_valid(void) /* test garbage strings */ for (i = 0; i < ETHERADDR_GARBAGE_STRS_SIZE; i++) { - memset(&result, 0, sizeof(struct ether_addr)); + memset(&result, 0, sizeof(struct rte_ether_addr)); ret = cmdline_parse_etheraddr(NULL, ether_addr_garbage_strs[i], (void*)&result, sizeof(result)); diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index 38f5c039f..953b82745 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -78,7 +78,7 @@ port_init_common(uint16_t port, const struct rte_eth_conf *port_conf, return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c index c26c5152c..208d20c53 100644 --- a/app/test/test_event_eth_tx_adapter.c +++ b/app/test/test_event_eth_tx_adapter.c @@ -84,7 +84,7 @@ port_init_common(uint8_t port, const struct rte_eth_conf *port_conf, return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 5f5beeee7..f81bbba3a 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -39,7 +39,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -49,7 +49,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -59,7 +59,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -72,7 +72,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -82,7 +82,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -489,7 +489,7 @@ static int init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); @@ -503,9 +503,9 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, printf("Set up IPv4 UDP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, src_addr, dst_addr, @@ -526,7 +526,7 @@ static int init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); @@ -540,9 +540,9 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, printf("Set up IPv4 TCP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, @@ -563,7 +563,7 @@ static int init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); @@ -577,9 +577,9 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, printf("Set up IPv4 SCTP traffic\n"); initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); - pktlen = (uint16_t)(sizeof(struct ether_hdr)); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + pktlen = (uint16_t)(sizeof(struct rte_ether_hdr)); printf("ETH pktlen %u\n", pktlen); pktlen = initialize_ipv4_header_proto(&pkt_ipv4_hdr, src_addr, diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 451c693d6..e4946dcca 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -73,11 +73,11 @@ struct link_bonding_unittest_params { struct rte_mempool *mbuf_pool; - struct ether_addr *default_slave_mac; - struct ether_addr *default_bonded_mac; + struct rte_ether_addr *default_slave_mac; + struct rte_ether_addr *default_bonded_mac; /* Packet Headers */ - struct ether_hdr *pkt_eth_hdr; + struct rte_ether_hdr *pkt_eth_hdr; struct ipv4_hdr *pkt_ipv4_hdr; struct ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; @@ -99,8 +99,8 @@ static struct link_bonding_unittest_params default_params = { .mbuf_pool = NULL, - .default_slave_mac = (struct ether_addr *)slave_mac, - .default_bonded_mac = (struct ether_addr *)bonded_mac, + .default_slave_mac = (struct rte_ether_addr *)slave_mac, + .default_bonded_mac = (struct rte_ether_addr *)bonded_mac, .pkt_eth_hdr = NULL, .pkt_ipv4_hdr = &pkt_ipv4_hdr, @@ -211,12 +211,12 @@ static int test_setup(void) { int i, nb_mbuf_per_pool; - struct ether_addr *mac_addr = (struct ether_addr *)slave_mac; + struct rte_ether_addr *mac_addr = (struct rte_ether_addr *)slave_mac; /* Allocate ethernet packet header with space for VLAN header */ if (test_params->pkt_eth_hdr == NULL) { - test_params->pkt_eth_hdr = malloc(sizeof(struct ether_hdr) + - sizeof(struct vlan_hdr)); + test_params->pkt_eth_hdr = malloc(sizeof(struct rte_ether_hdr) + + sizeof(struct rte_vlan_hdr)); TEST_ASSERT_NOT_NULL(test_params->pkt_eth_hdr, "Ethernet header struct allocation failed!"); @@ -377,7 +377,7 @@ static int test_remove_slave_from_bonded_device(void) { int current_slave_count; - struct ether_addr read_mac_addr, *mac_addr; + struct rte_ether_addr read_mac_addr, *mac_addr; uint16_t slaves[RTE_MAX_ETHPORTS]; TEST_ASSERT_SUCCESS(rte_eth_bond_slave_remove(test_params->bonded_port_id, @@ -395,7 +395,7 @@ test_remove_slave_from_bonded_device(void) current_slave_count, test_params->bonded_slave_count - 1); - mac_addr = (struct ether_addr *)slave_mac; + mac_addr = (struct rte_ether_addr *)slave_mac; mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = test_params->bonded_slave_count-1; @@ -700,8 +700,8 @@ static int test_set_primary_slave(void) { int i, j, retval; - struct ether_addr read_mac_addr; - struct ether_addr *expected_mac_addr; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr *expected_mac_addr; /* Add 4 slaves to bonded device */ for (i = test_params->bonded_slave_count; i < 4; i++) @@ -751,7 +751,7 @@ test_set_primary_slave(void) "Failed to start bonded port %d", test_params->bonded_port_id); - expected_mac_addr = (struct ether_addr *)&slave_mac; + expected_mac_addr = (struct rte_ether_addr *)&slave_mac; expected_mac_addr->addr_bytes[ETHER_ADDR_LEN-1] = i; /* Check primary slave MAC */ @@ -802,12 +802,12 @@ static int test_set_explicit_bonded_mac(void) { int i; - struct ether_addr read_mac_addr; - struct ether_addr *mac_addr; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr *mac_addr; uint8_t explicit_bonded_mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x00, 0x01 }; - mac_addr = (struct ether_addr *)explicit_bonded_mac; + mac_addr = (struct rte_ether_addr *)explicit_bonded_mac; /* Invalid port ID */ TEST_ASSERT_FAIL(rte_eth_bond_mac_address_set(INVALID_PORT_ID, mac_addr), @@ -880,11 +880,11 @@ test_set_bonded_port_initialization_mac_assignment(void) static int bonded_port_id = -1; static int slave_port_ids[BONDED_INIT_MAC_ASSIGNMENT_SLAVE_COUNT]; - struct ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; + struct rte_ether_addr slave_mac_addr, bonded_mac_addr, read_mac_addr; /* Initialize default values for MAC addresses */ - memcpy(&slave_mac_addr, slave_mac, sizeof(struct ether_addr)); - memcpy(&bonded_mac_addr, slave_mac, sizeof(struct ether_addr)); + memcpy(&slave_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); + memcpy(&bonded_mac_addr, slave_mac, sizeof(struct rte_ether_addr)); /* * 1. a - Create / configure bonded / slave ethdevs @@ -1277,11 +1277,13 @@ generate_test_burst(struct rte_mbuf **pkts_burst, uint16_t burst_size, if (toggle_dst_mac) initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1, + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_1, ether_type, vlan, vlan_id); else initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_0, ether_type, vlan, vlan_id); @@ -1672,7 +1674,8 @@ test_roundrobin_rx_burst_on_multiple_slaves(void) static int test_roundrobin_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_2; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_2; int i; @@ -1731,7 +1734,8 @@ test_roundrobin_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, + (struct rte_ether_addr *)bonded_mac), "Failed to set MAC"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -1940,7 +1944,8 @@ int polling_test_slaves[TEST_RR_POLLING_LINK_STATUS_SLAVE_COUNT] = { -1, -1 }; static int test_roundrobin_verfiy_polling_slave_link_status_change(void) { - struct ether_addr *mac_addr = (struct ether_addr *)polling_slave_mac; + struct rte_ether_addr *mac_addr = + (struct rte_ether_addr *)polling_slave_mac; char slave_name[RTE_ETH_NAME_MAX_LEN]; int i; @@ -2039,7 +2044,8 @@ test_activebackup_tx_burst(void) "Failed to initialize bonded device with slaves"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -2246,7 +2252,8 @@ test_activebackup_verify_promiscuous_enable_disable(void) static int test_activebackup_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -2328,7 +2335,8 @@ test_activebackup_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, + (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -2573,7 +2581,8 @@ test_balance_l2_tx_burst(void) "Failed to set balance xmit policy."); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -2588,7 +2597,8 @@ test_balance_l2_tx_burst(void) "failed to generate packet burst"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_1, + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_1, ETHER_TYPE_IPv4, 0, 0); /* Generate a burst 2 of packets to transmit */ @@ -3138,7 +3148,8 @@ test_balance_verify_promiscuous_enable_disable(void) static int test_balance_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -3220,7 +3231,8 @@ test_balance_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, + (struct rte_ether_addr *)bonded_mac), "failed to set MAC"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -3411,7 +3423,8 @@ test_broadcast_tx_burst(void) "Failed to initialise bonded device"); initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, (struct ether_addr *)dst_mac_0, + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, @@ -3722,7 +3735,8 @@ test_broadcast_verify_promiscuous_enable_disable(void) static int test_broadcast_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; int i; @@ -3783,7 +3797,8 @@ test_broadcast_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, + (struct rte_ether_addr *)bonded_mac), "Failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -3994,12 +4009,14 @@ test_tlb_tx_burst(void) /*test two types of mac src own(bonding) and others */ if (i % 2 == 0) { initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac_0, + ETHER_TYPE_IPv4, 0, 0); } else { initialize_eth_header(test_params->pkt_eth_hdr, - (struct ether_addr *)test_params->default_slave_mac, - (struct ether_addr *)dst_mac_0, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)test_params->default_slave_mac, + (struct rte_ether_addr *)dst_mac_0, + ETHER_TYPE_IPv4, 0, 0); } pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -4210,7 +4227,8 @@ test_tlb_verify_promiscuous_enable_disable(void) static int test_tlb_verify_mac_assignment(void) { - struct ether_addr read_mac_addr, expected_mac_addr_0, expected_mac_addr_1; + struct rte_ether_addr read_mac_addr; + struct rte_ether_addr expected_mac_addr_0, expected_mac_addr_1; rte_eth_macaddr_get(test_params->slave_port_ids[0], &expected_mac_addr_0); rte_eth_macaddr_get(test_params->slave_port_ids[1], &expected_mac_addr_1); @@ -4293,7 +4311,8 @@ test_tlb_verify_mac_assignment(void) /* Set explicit MAC address */ TEST_ASSERT_SUCCESS(rte_eth_bond_mac_address_set( - test_params->bonded_port_id, (struct ether_addr *)bonded_mac), + test_params->bonded_port_id, + (struct rte_ether_addr *)bonded_mac), "failed to set MAC address"); rte_eth_macaddr_get(test_params->bonded_port_id, &read_mac_addr); @@ -4468,14 +4487,14 @@ test_alb_change_mac_in_reply_sent(void) struct rte_mbuf *pkt; struct rte_mbuf *pkts_sent[MAX_PKT_BURST]; - struct ether_hdr *eth_pkt; + struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; int slave_idx, nb_pkts, pkt_idx; int retval = 0; - struct ether_addr bond_mac, client_mac; - struct ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr bond_mac, client_mac; + struct rte_ether_addr *slave_mac1, *slave_mac2; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4501,44 +4520,44 @@ test_alb_change_mac_in_reply_sent(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client1, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client2, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client3, RTE_ARP_OP_REPLY); 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); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &bond_mac, &client_mac, ip_host, ip_client4, RTE_ARP_OP_REPLY); rte_eth_tx_burst(test_params->bonded_port_id, 0, &pkt, 1); @@ -4558,9 +4577,10 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod( + pkts_sent[pkt_idx], struct rte_ether_hdr *); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4584,7 +4604,7 @@ test_alb_change_mac_in_reply_sent(void) static int test_alb_reply_from_client(void) { - struct ether_hdr *eth_pkt; + struct rte_ether_hdr *eth_pkt; struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; @@ -4593,8 +4613,8 @@ test_alb_reply_from_client(void) int slave_idx, nb_pkts, pkt_idx, nb_pkts_sum = 0; int retval = 0; - struct ether_addr bond_mac, client_mac; - struct ether_addr *slave_mac1, *slave_mac2; + struct rte_ether_addr bond_mac, client_mac; + struct rte_ether_addr *slave_mac1, *slave_mac2; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4619,11 +4639,11 @@ test_alb_reply_from_client(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client1, ip_host, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4631,11 +4651,11 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client2, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client2, ip_host, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4643,11 +4663,11 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client3, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client3, ip_host, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4655,11 +4675,11 @@ test_alb_reply_from_client(void) pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client4, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_ARP, 0, 0); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); initialize_arp_header(arp_pkt, &client_mac, &bond_mac, ip_client4, ip_host, RTE_ARP_OP_REPLY); virtual_ethdev_add_mbufs_to_rx_queue(test_params->slave_port_ids[0], &pkt, @@ -4684,9 +4704,10 @@ test_alb_reply_from_client(void) nb_pkts_sum += nb_pkts; for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod( + pkts_sent[pkt_idx], struct rte_ether_hdr *); arp_pkt = (struct rte_arp_hdr *)((char *)eth_pkt + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { @@ -4716,8 +4737,8 @@ test_alb_reply_from_client(void) static int test_alb_receive_vlan_reply(void) { - struct ether_hdr *eth_pkt; - struct vlan_hdr *vlan_pkt; + struct rte_ether_hdr *eth_pkt; + struct rte_vlan_hdr *vlan_pkt; struct rte_arp_hdr *arp_pkt; struct rte_mbuf *pkt; @@ -4726,7 +4747,7 @@ test_alb_receive_vlan_reply(void) int slave_idx, nb_pkts, pkt_idx; int retval = 0; - struct ether_addr bond_mac, client_mac; + struct rte_ether_addr bond_mac, client_mac; TEST_ASSERT_SUCCESS( initialize_bonded_device_with_slaves(BONDING_MODE_ALB, @@ -4750,10 +4771,10 @@ test_alb_receive_vlan_reply(void) */ pkt = rte_pktmbuf_alloc(test_params->mbuf_pool); memcpy(client_mac.addr_bytes, mac_client1, ETHER_ADDR_LEN); - eth_pkt = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_pkt = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); initialize_eth_header(eth_pkt, &bond_mac, &client_mac, ETHER_TYPE_VLAN, 0, 0); - vlan_pkt = (struct vlan_hdr *)((char *)(eth_pkt + 1)); + 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 = vlan_pkt+1; @@ -4777,8 +4798,10 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); for (pkt_idx = 0; pkt_idx < nb_pkts; pkt_idx++) { - eth_pkt = rte_pktmbuf_mtod(pkts_sent[pkt_idx], struct ether_hdr *); - vlan_pkt = (struct vlan_hdr *)((char *)(eth_pkt + 1)); + eth_pkt = rte_pktmbuf_mtod( + pkts_sent[pkt_idx], struct rte_ether_hdr *); + vlan_pkt = (struct rte_vlan_hdr *)( + (char *)(eth_pkt + 1)); if (vlan_pkt->vlan_tci != rte_cpu_to_be_16(1)) { retval = -1; goto test_end; diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index e539f078d..de23dd959 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -54,19 +54,19 @@ #define INVALID_PORT_ID (0xFF) #define INVALID_BONDING_MODE (-1) -static const struct ether_addr slave_mac_default = { +static const struct rte_ether_addr slave_mac_default = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; -static const struct ether_addr parnter_mac_default = { +static const struct rte_ether_addr parnter_mac_default = { { 0x22, 0xBB, 0xFF, 0xBB, 0x00, 0x00 } }; -static const struct ether_addr parnter_system = { +static const struct rte_ether_addr parnter_system = { { 0x33, 0xFF, 0xBB, 0xFF, 0x00, 0x00 } }; -static const struct ether_addr slow_protocol_mac_addr = { +static const struct rte_ether_addr slow_protocol_mac_addr = { { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; @@ -80,8 +80,8 @@ struct slave_conf { }; struct ether_vlan_hdr { - struct ether_hdr pkt_eth_hdr; - struct vlan_hdr vlan_hdr; + struct rte_ether_hdr pkt_eth_hdr; + struct rte_vlan_hdr vlan_hdr; }; struct link_bonding_unittest_params { @@ -224,7 +224,7 @@ configure_ethdev(uint16_t port_id, uint8_t start) static int add_slave(struct slave_conf *slave, uint8_t start) { - struct ether_addr addr, addr_check; + struct rte_ether_addr addr, addr_check; /* Some sanity check */ RTE_VERIFY(test_params.slave_ports <= slave && @@ -293,12 +293,12 @@ remove_slave(struct slave_conf *slave) static void lacp_recv_cb(uint16_t slave_id, struct rte_mbuf *lacp_pkt) { - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; RTE_VERIFY(lacp_pkt != NULL); - hdr = rte_pktmbuf_mtod(lacp_pkt, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(lacp_pkt, struct rte_ether_hdr *); RTE_VERIFY(hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_SLOW)); slow_hdr = rte_pktmbuf_mtod(lacp_pkt, struct slow_protocol_frame *); @@ -474,12 +474,12 @@ testsuite_teardown(void) static int make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) { - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; struct slow_protocol_frame *slow_hdr; struct lacpdu *lacp; /* look for LACP */ - hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); if (hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_SLOW)) return 1; @@ -718,8 +718,8 @@ test_mode4_agg_mode_selection(void) } static int -generate_packets(struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf) +generate_packets(struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t count, struct rte_mbuf **buf) { uint16_t pktlen = PACKET_BURST_GEN_PKT_LEN; uint8_t vlan_enable = 0; @@ -731,7 +731,7 @@ generate_packets(struct ether_addr *src_mac, uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { struct ipv4_hdr v4; @@ -765,8 +765,9 @@ generate_packets(struct ether_addr *src_mac, } static int -generate_and_put_packets(struct slave_conf *slave, struct ether_addr *src_mac, - struct ether_addr *dst_mac, uint16_t count) +generate_and_put_packets(struct slave_conf *slave, + struct rte_ether_addr *src_mac, + struct rte_ether_addr *dst_mac, uint16_t count) { struct rte_mbuf *pkts[MAX_PKT_BURST]; int retval; @@ -796,11 +797,12 @@ test_mode4_rx(void) int retval; unsigned delay; - struct ether_hdr *hdr; + struct rte_ether_hdr *hdr; - struct ether_addr src_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; - struct ether_addr dst_mac; - struct ether_addr bonded_mac; + struct rte_ether_addr src_mac = { + { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; + struct rte_ether_addr dst_mac; + struct rte_ether_addr bonded_mac; retval = initialize_bonded_device_with_slaves(TEST_PROMISC_SLAVE_COUNT, 0); @@ -844,7 +846,7 @@ test_mode4_rx(void) int cnt[2] = { 0, 0 }; for (i = 0; i < expected_pkts_cnt; i++) { - hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; } @@ -888,7 +890,7 @@ test_mode4_rx(void) int eq_cnt = 0; for (i = 0; i < expected_pkts_cnt; i++) { - hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac); } @@ -977,8 +979,9 @@ test_mode4_tx_burst(void) int retval; unsigned delay; - struct ether_addr dst_mac = { { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; - struct ether_addr bonded_mac; + struct rte_ether_addr dst_mac = { + { 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00 } }; + struct rte_ether_addr bonded_mac; retval = initialize_bonded_device_with_slaves(TEST_TX_SLAVE_COUNT, 0); TEST_ASSERT_SUCCESS(retval, "Failed to initialize bonded device"); @@ -1351,7 +1354,7 @@ test_mode4_ext_ctrl(void) uint8_t i; struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; - struct ether_addr src_mac, dst_mac; + struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { .subtype = SLOW_SUBTYPE_LACP, @@ -1405,7 +1408,7 @@ test_mode4_ext_lacp(void) struct rte_mbuf *lacp_tx_buf[SLAVE_COUNT]; struct rte_mbuf *buf[SLAVE_COUNT]; - struct ether_addr src_mac, dst_mac; + struct rte_ether_addr src_mac, dst_mac; struct lacpdu_header lacpdu = { .lacpdu = { .subtype = SLOW_SUBTYPE_LACP, diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c index d82de2cef..4392522ea 100644 --- a/app/test/test_link_bonding_rssconf.c +++ b/app/test/test_link_bonding_rssconf.c @@ -495,7 +495,7 @@ test_setup(void) int port_id; char name[256]; struct slave_conf *port; - struct ether_addr mac_addr = { .addr_bytes = {0} }; + struct rte_ether_addr mac_addr = { .addr_bytes = {0} }; if (test_params.mbuf_pool == NULL) { diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index ed8524a17..b85da914c 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -58,7 +58,7 @@ static struct rte_mempool *mbufpool[NB_SOCKETS]; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static struct rte_eth_conf port_conf = { .rxmode = { @@ -171,7 +171,7 @@ check_all_ports_link_status(uint16_t port_num, uint32_t port_mask) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -182,7 +182,7 @@ static int init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { - struct ether_hdr pkt_eth_hdr; + struct rte_ether_hdr pkt_eth_hdr; struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; @@ -191,8 +191,8 @@ init_traffic(struct rte_mempool *mp, initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + (struct rte_ether_addr *)src_mac, + (struct rte_ether_addr *)dst_mac, 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 4eed8dbde..a782bf3e5 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -78,16 +78,20 @@ create_mempool(void) static void prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) { - struct ether_hdr *eth_hdr; - struct vlan_hdr *vlan1, *vlan2; + struct rte_ether_hdr *eth_hdr; + struct rte_vlan_hdr *vlan1, *vlan2; struct ipv4_hdr *ip_hdr; /* Simulate a classifier */ - eth_hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); - vlan1 = (struct vlan_hdr *)(ð_hdr->ether_type ); - vlan2 = (struct vlan_hdr *)((uintptr_t)ð_hdr->ether_type + sizeof(struct vlan_hdr)); - eth_hdr = (struct ether_hdr *)((uintptr_t)ð_hdr->ether_type + 2 *sizeof(struct vlan_hdr)); - ip_hdr = (struct ipv4_hdr *)((uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); + eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); + vlan1 = (struct rte_vlan_hdr *)(ð_hdr->ether_type); + vlan2 = (struct rte_vlan_hdr *)( + (uintptr_t)ð_hdr->ether_type + sizeof(struct rte_vlan_hdr)); + eth_hdr = (struct rte_ether_hdr *)( + (uintptr_t)ð_hdr->ether_type + + 2 * sizeof(struct rte_vlan_hdr)); + ip_hdr = (struct ipv4_hdr *)( + (uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); vlan2->vlan_tci = rte_cpu_to_be_16(PIPE); diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index f8ddc2db8..15ce64445 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -218,7 +218,7 @@ virtual_ethdev_promiscuous_mode_disable(struct rte_eth_dev *dev __rte_unused) static int virtual_ethdev_mac_address_set(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct ether_addr *addr) + __rte_unused struct rte_ether_addr *addr) { return 0; } @@ -496,7 +496,7 @@ virtual_ethdev_get_mbufs_from_tx_queue(uint16_t port_id, int -virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, +virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support) { struct rte_pci_device *pci_dev = NULL; diff --git a/app/test/virtual_pmd.h b/app/test/virtual_pmd.h index 5ca02bb50..120b58b27 100644 --- a/app/test/virtual_pmd.h +++ b/app/test/virtual_pmd.h @@ -15,7 +15,7 @@ int virtual_ethdev_init(void); int -virtual_ethdev_create(const char *name, struct ether_addr *mac_addr, +virtual_ethdev_create(const char *name, struct rte_ether_addr *mac_addr, uint8_t socket_id, uint8_t isr_support); void diff --git a/doc/guides/prog_guide/bbdev.rst b/doc/guides/prog_guide/bbdev.rst index 658ffd400..038bc6ed1 100644 --- a/doc/guides/prog_guide/bbdev.rst +++ b/doc/guides/prog_guide/bbdev.rst @@ -752,12 +752,12 @@ buffers using (**sw_turbo**) bbdev PMD. for (j = 0; j < op_num; j++) { /* Append the size of the ethernet header */ rte_pktmbuf_append(input_pkts_burst[j], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* set op */ ops_burst[j]->turbo_enc.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); ops_burst[j]->turbo_enc->input.length = rte_pktmbuf_pkt_len(bbdev_pkts[j]); @@ -766,7 +766,7 @@ buffers using (**sw_turbo**) bbdev PMD. input_pkts_burst[j]; ops_burst[j]->turbo_enc->output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); ops_burst[j]->turbo_enc->output.data = output_pkts_burst[j]; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index a6383b3c7..9582b9376 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -91,7 +91,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -101,7 +101,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -111,7 +111,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -124,7 +124,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -134,7 +134,7 @@ initialisation of the ``Flow Classify`` application.. .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -275,7 +275,7 @@ Forwarding application is shown below: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/flow_filtering.rst b/doc/guides/sample_app_ug/flow_filtering.rst index be3d63f90..02fc67550 100644 --- a/doc/guides/sample_app_ug/flow_filtering.rst +++ b/doc/guides/sample_app_ug/flow_filtering.rst @@ -304,7 +304,7 @@ looks like the following: main_loop(void) { struct rte_mbuf *mbufs[32]; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t nb_rx; uint16_t i; uint16_t j; @@ -318,7 +318,7 @@ looks like the following: struct rte_mbuf *m = mbufs[j]; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", @@ -348,7 +348,7 @@ queues and printing for each packet the destination queue: if (nb_rx) { for (j = 0; j < nb_rx; j++) { struct rte_mbuf *m = mbufs[j]; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", ð_hdr->d_addr); printf(" - queue=0x%x", (unsigned int)i); diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index f6efa7f6f..1fe6bf113 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct ether_hdr)); + iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -216,14 +216,14 @@ The actual packet transmission is done in the mcast_send_pkt() function: .. code-block:: c - static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) + static inline void mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t) sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t) sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index dfc1ed9ca..02c1367f5 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -451,13 +451,13 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index e5b28e425..54e5b8022 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -367,13 +367,13 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index 670918c57..2d759170c 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -273,10 +273,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index 571cd2d60..3fd043e82 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -311,11 +311,11 @@ The processing is very simple: processes the TX port from the RX port and then r static void lsi_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port = lsi_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ diff --git a/doc/guides/sample_app_ug/ptpclient.rst b/doc/guides/sample_app_ug/ptpclient.rst index 9d7446d5f..12b4f13d5 100644 --- a/doc/guides/sample_app_ug/ptpclient.rst +++ b/doc/guides/sample_app_ug/ptpclient.rst @@ -212,17 +212,17 @@ PTP IEEE1588 L2 functionality. void parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { struct ptp_header *ptp_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == PTP_PROTOCOL) { ptp_data.m = m; ptp_data.portid = portid; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); switch (ptp_hdr->msgtype) { case SYNC: diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst index 81463d28d..1ca959c55 100644 --- a/doc/guides/sample_app_ug/rxtx_callbacks.rst +++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst @@ -79,7 +79,7 @@ comments: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index adf258c0d..f7dab9e98 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -197,7 +197,7 @@ which tells the node where the packet has to be distributed. for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } @@ -357,7 +357,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst index 11ee521b3..715f5e91a 100644 --- a/doc/guides/sample_app_ug/skeleton.rst +++ b/doc/guides/sample_app_ug/skeleton.rst @@ -115,7 +115,7 @@ Forwarding application is shown below: { struct rte_eth_conf port_conf = port_conf_default; const uint16_t rx_rings = 1, tx_rings = 1; - struct ether_addr addr; + struct rte_ether_addr addr; int retval; uint16_t q; diff --git a/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst b/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst index 707afe91a..8e1774d9e 100644 --- a/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst +++ b/doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst @@ -165,7 +165,7 @@ the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02. }; /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ - static struct ether_addr pool_addr_template = { + static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; @@ -225,7 +225,7 @@ the MAC of VMDQ pool 2 on port 1 is 52:54:00:12:01:02. /* Set mac for each pool.*/ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; mac.addr_bytes[5] = q; diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 15bf73a40..d6eebc877 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -314,7 +314,7 @@ struct fman_if { /* The index of this MAC (within the Fman it belongs to) */ uint8_t mac_idx; /* The MAC address */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; /* The Qman channel to schedule Tx FQs to */ u16 tx_channel_id; /* The hard-coded FQIDs for this interface. Note: this doesn't cover diff --git a/drivers/bus/dpaa/include/netcfg.h b/drivers/bus/dpaa/include/netcfg.h index 7818de68b..bf7bfae8c 100644 --- a/drivers/bus/dpaa/include/netcfg.h +++ b/drivers/bus/dpaa/include/netcfg.h @@ -30,8 +30,8 @@ struct netcfg_info { struct interface_info { char *name; - struct ether_addr mac_addr; - struct ether_addr peer_mac; + struct rte_ether_addr mac_addr; + struct rte_ether_addr peer_mac; int mac_present; int fman_enabled_mac_interface; }; diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 99e13fe48..b5c4befce 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -73,7 +73,7 @@ struct pmd_internals { int if_index; char *if_name; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct tpacket_req req; diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 35c72272c..893c9ed9f 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -109,7 +109,7 @@ struct pmd_internals { int if_index; char if_name[IFNAMSIZ]; uint16_t queue_idx; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct xsk_umem_info *umem; struct rte_mempool *mb_pool_share; @@ -798,7 +798,7 @@ parse_parameters(struct rte_kvargs *kvlist, static int get_iface_info(const char *if_name, - struct ether_addr *eth_addr, + struct rte_ether_addr *eth_addr, int *if_index) { struct ifreq ifr; diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 4f52e2bd1..6a1530aa2 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -41,9 +41,9 @@ static int eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); static void eth_ark_dev_stats_reset(struct rte_eth_dev *dev); static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int eth_ark_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_ark_macaddr_remove(struct rte_eth_dev *dev, @@ -220,14 +220,14 @@ check_for_ext(struct ark_adapter *ark) (void (*)(struct rte_eth_dev *, void *)) dlsym(ark->d_handle, "stats_reset"); ark->user_ext.mac_addr_add = - (void (*)(struct rte_eth_dev *, struct ether_addr *, uint32_t, - uint32_t, void *)) + (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, + uint32_t, uint32_t, void *)) dlsym(ark->d_handle, "mac_addr_add"); ark->user_ext.mac_addr_remove = (void (*)(struct rte_eth_dev *, uint32_t, void *)) dlsym(ark->d_handle, "mac_addr_remove"); ark->user_ext.mac_addr_set = - (void (*)(struct rte_eth_dev *, struct ether_addr *, + (void (*)(struct rte_eth_dev *, struct rte_ether_addr *, void *)) dlsym(ark->d_handle, "mac_addr_set"); ark->user_ext.set_mtu = @@ -833,7 +833,7 @@ eth_ark_dev_stats_reset(struct rte_eth_dev *dev) static int eth_ark_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { @@ -864,7 +864,7 @@ eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) static int eth_ark_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private; diff --git a/drivers/net/ark/ark_ext.h b/drivers/net/ark/ark_ext.h index f5af21538..5a987e4d6 100644 --- a/drivers/net/ark/ark_ext.h +++ b/drivers/net/ark/ark_ext.h @@ -70,7 +70,7 @@ void stats_reset(struct rte_eth_dev *dev, void *user_data); void mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *macadr, + struct rte_ether_addr *macadr, uint32_t index, uint32_t pool, void *user_data); @@ -80,7 +80,7 @@ void mac_addr_remove(struct rte_eth_dev *dev, void *user_data); void mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, void *user_data); int set_mtu(struct rte_eth_dev *dev, diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h index f820091d7..403df5900 100644 --- a/drivers/net/ark/ark_global.h +++ b/drivers/net/ark/ark_global.h @@ -71,12 +71,13 @@ struct ark_user_ext { int (*stats_get)(struct rte_eth_dev *, struct rte_eth_stats *, void *); void (*stats_reset)(struct rte_eth_dev *, void *); void (*mac_addr_add)(struct rte_eth_dev *, - struct ether_addr *, + struct rte_ether_addr *, uint32_t, uint32_t, void *); void (*mac_addr_remove)(struct rte_eth_dev *, uint32_t, void *); - void (*mac_addr_set)(struct rte_eth_dev *, struct ether_addr *, void *); + void (*mac_addr_set)(struct rte_eth_dev *, struct rte_ether_addr *, + void *); int (*set_mtu)(struct rte_eth_dev *, uint16_t, void *); }; diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index c9c1795a1..9460318ae 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -93,14 +93,14 @@ static void atl_dev_interrupt_handler(void *param); static int atl_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); static int atl_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* RSS */ @@ -1575,7 +1575,7 @@ atl_update_mac_addr(struct rte_eth_dev *dev, uint32_t index, } static int -atl_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index __rte_unused, uint32_t pool __rte_unused) { if (is_zero_ether_addr(mac_addr)) { @@ -1593,7 +1593,7 @@ atl_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } static int -atl_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +atl_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { atl_remove_mac_addr(dev, 0); atl_add_mac_addr(dev, addr, 0, 0); @@ -1760,7 +1760,7 @@ atl_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue_id, int on) static int atl_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(dev->data->dev_private); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c index b399ae392..26a53a203 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c @@ -657,8 +657,8 @@ static int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self, mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct ether_addr *)mac_addr, - (struct ether_addr *)mac); + ether_addr_copy((struct rte_ether_addr *)mac_addr, + (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { /* chip revision */ @@ -868,8 +868,8 @@ static int aq_fw1x_set_wol(struct aq_hw_s *self, bool wol_enabled, u8 *mac) prpc->msg_wol.pattern_id = 1U; prpc->msg_wol.wol_packet_type = 2U; /* Magic Packet */ - ether_addr_copy((struct ether_addr *)mac, - (struct ether_addr *)&prpc->msg_wol.wol_pattern); + ether_addr_copy((struct rte_ether_addr *)mac, + (struct rte_ether_addr *)&prpc->msg_wol.wol_pattern); } else { rpc_size = sizeof(prpc->msg_id) + sizeof(prpc->msg_del_id); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c index 5927d90f1..55b5ce3e3 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -228,8 +228,8 @@ int aq_fw2x_get_mac_permanent(struct aq_hw_s *self, u8 *mac) mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct ether_addr *)mac_addr, - (struct ether_addr *)mac); + ether_addr_copy((struct rte_ether_addr *)mac_addr, + (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { unsigned int rnd = (uint32_t)rte_rand(); diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 09388d05f..69a70d2cc 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -159,7 +159,7 @@ static const struct eth_dev_ops avp_eth_dev_ops = { struct avp_dev { uint32_t magic; /**< Memory validation marker */ uint64_t device_id; /**< Unique system identifier */ - struct ether_addr ethaddr; /**< Host specified MAC address */ + struct rte_ether_addr ethaddr; /**< Host specified MAC address */ struct rte_eth_dev_data *dev_data; /**< Back pointer to ethernet device data */ volatile uint32_t flags; /**< Device operational flags */ @@ -1199,7 +1199,7 @@ avp_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, } static inline int -_avp_cmp_ether_addr(struct ether_addr *a, struct ether_addr *b) +_avp_cmp_ether_addr(struct rte_ether_addr *a, struct rte_ether_addr *b) { uint16_t *_a = (uint16_t *)&a->addr_bytes[0]; uint16_t *_b = (uint16_t *)&b->addr_bytes[0]; @@ -1209,7 +1209,7 @@ _avp_cmp_ether_addr(struct ether_addr *a, struct ether_addr *b) static inline int _avp_mac_filter(struct avp_dev *avp, struct rte_mbuf *m) { - struct ether_hdr *eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (likely(_avp_cmp_ether_addr(&avp->ethaddr, ð->d_addr) == 0)) { /* allow all packets destined to our address */ diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index b1cd2980b..810ac4a74 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -539,7 +539,7 @@ struct axgbe_port { /* Hardware features of the device */ struct axgbe_hw_features hw_feat; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; /* Software Tx/Rx structure pointers*/ void **rx_queues; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 3e705c7a1..17b6817b6 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2197,8 +2197,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(pkt_prod); else { - struct ether_hdr *eh = - rte_pktmbuf_mtod(m0, struct ether_hdr *); + struct rte_ether_hdr *eh = + rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); tx_start_bd->vlan_or_ethertype = rte_cpu_to_le_16(rte_be_to_cpu_16(eh->ether_type)); @@ -2208,8 +2208,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) bd_prod = NEXT_TX_BD(bd_prod); if (IS_VF(sc)) { struct eth_tx_parse_bd_e2 *tx_parse_bd; - const struct ether_hdr *eh = - rte_pktmbuf_mtod(m0, struct ether_hdr *); + const struct rte_ether_hdr *eh = + rte_pktmbuf_mtod(m0, struct rte_ether_hdr *); uint8_t mac_type = UNICAST_ADDRESS; tx_parse_bd = diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c index 3063aea64..567dc5560 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.c +++ b/drivers/net/bnx2x/bnx2x_ethdev.c @@ -501,7 +501,7 @@ bnx2x_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) } static int -bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +bnx2x_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct bnx2x_softc *sc = dev->data->dev_private; @@ -654,7 +654,8 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf) } } - eth_dev->data->mac_addrs = (struct ether_addr *)sc->link_params.mac_addr; + eth_dev->data->mac_addrs = + (struct rte_ether_addr *)sc->link_params.mac_addr; if (IS_VF(sc)) { rte_spinlock_init(&sc->vf2pf_lock); diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h index 45958db9a..bd3ef143b 100644 --- a/drivers/net/bnx2x/bnx2x_ethdev.h +++ b/drivers/net/bnx2x/bnx2x_ethdev.h @@ -75,7 +75,8 @@ typedef int bool; /* MAC address operations */ struct bnx2x_mac_ops { - void (*mac_addr_add)(struct rte_eth_dev *dev, struct ether_addr *addr, + void (*mac_addr_add)(struct rte_eth_dev *dev, + struct rte_ether_addr *addr, uint16_t index, uint32_t pool); /* not implemented yet */ void (*mac_addr_remove)(struct rte_eth_dev *dev, uint16_t index); /* not implemented yet */ }; diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index 048bf126f..cd5522d03 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -302,7 +302,7 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ if (is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) ether_addr_copy(&sc_resp.resc.current_mac_addr, - (struct ether_addr *)sc->link_params.mac_addr); + (struct rte_ether_addr *)sc->link_params.mac_addr); else eth_random_addr(sc->link_params.mac_addr); diff --git a/drivers/net/bnx2x/bnx2x_vfpf.h b/drivers/net/bnx2x/bnx2x_vfpf.h index cc6fef956..6964c9d98 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.h +++ b/drivers/net/bnx2x/bnx2x_vfpf.h @@ -115,7 +115,7 @@ struct vf_resc { uint8_t num_vlan_filters; uint8_t num_mc_filters; uint8_t permanent_mac_addr[ETH_ALEN]; - struct ether_addr current_mac_addr; + struct rte_ether_addr current_mac_addr; uint16_t pf_link_speed; uint32_t pf_link_supported; }; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index da0de211d..c64315053 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -760,7 +760,7 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, } static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; @@ -1451,7 +1451,8 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) } static int -bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) +bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, + struct rte_ether_addr *addr) { struct bnxt *bp = (struct bnxt *)dev->data->dev_private; /* Default Filter is tied to VNIC 0 */ @@ -1489,7 +1490,7 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) static int bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index eb5c41ebb..59e75b0be 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2578,7 +2578,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, struct hwrm_func_cfg_input *cfg_req, int vf) { - struct ether_addr mac; + struct rte_ether_addr mac; if (bnxt_hwrm_func_qcfg_vf_default_mac(bp, vf, &mac)) return; @@ -3112,7 +3112,7 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id, } int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac) + struct rte_ether_addr *mac) { struct hwrm_func_qcfg_input req = {0}; struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index ec9b3e007..53d79f046 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -130,7 +130,7 @@ int bnxt_hwrm_func_bw_cfg(struct bnxt *bp, uint16_t vf, uint16_t max_bw, uint16_t enables); int bnxt_hwrm_set_vf_vlan(struct bnxt *bp, int vf); int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf, - struct ether_addr *mac); + struct rte_ether_addr *mac); int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf); int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, uint16_t port, uint8_t tunnel_type); diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c index c298de83c..5e3d1bfb1 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.c +++ b/drivers/net/bnxt/rte_pmd_bnxt.c @@ -132,7 +132,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on) } int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct rte_eth_dev_info dev_info; @@ -647,7 +647,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, count); } -int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr, +int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr, uint32_t vf_id) { struct rte_eth_dev *dev; @@ -655,7 +655,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *addr, struct bnxt *bp; struct bnxt_filter_info *filter; struct bnxt_vnic_info vnic; - struct ether_addr dflt_mac; + struct rte_ether_addr dflt_mac; int rc; dev = &rte_eth_devices[port]; diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h index 68fbe34d6..2e893cc7b 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.h +++ b/drivers/net/bnxt/rte_pmd_bnxt.h @@ -67,7 +67,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on); * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable vf vlan strip for all queues in a pool @@ -303,7 +303,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id, * - (-ENOTSUP) Ethernet device is not a PF * - (-ENOMEM) on an allocation failure */ -int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct ether_addr *mac_addr, +int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *mac_addr, uint32_t vf_id); /** diff --git a/drivers/net/bonding/rte_eth_bond.h b/drivers/net/bonding/rte_eth_bond.h index b668ff9ad..874aa91a5 100644 --- a/drivers/net/bonding/rte_eth_bond.h +++ b/drivers/net/bonding/rte_eth_bond.h @@ -225,7 +225,7 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], */ int rte_eth_bond_mac_address_set(uint16_t bonded_port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Reset bonded device to use MAC from primary slave on bonded device and it's diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 1e6a3fc7c..51bf3f52e 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -126,7 +126,7 @@ bond_print_lacp(struct lacpdu *l) #define MODE4_DEBUG(fmt, ...) do { } while (0) #endif -static const struct ether_addr lacp_mac_addr = { +static const struct rte_ether_addr lacp_mac_addr = { .addr_bytes = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x02 } }; @@ -810,7 +810,7 @@ bond_mode_8023ad_periodic_cb(void *arg) struct bond_dev_private *internals = bond_dev->data->dev_private; struct port *port; struct rte_eth_link link_info; - struct ether_addr slave_addr; + struct rte_ether_addr slave_addr; struct rte_mbuf *lacp_pkt = NULL; uint16_t slave_id; uint16_t i; @@ -1044,7 +1044,7 @@ void bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) { struct bond_dev_private *internals = bond_dev->data->dev_private; - struct ether_addr slave_addr; + struct rte_ether_addr slave_addr; struct port *slave, *agg_slave; uint16_t slave_id, i, j; diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h index d8b5dbc21..cbad59aa7 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad.h @@ -58,14 +58,14 @@ struct slow_protocol { /** Generic slow protocol frame type structure */ struct slow_protocol_frame { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct slow_protocol slow_protocol; } __attribute__((__packed__)); struct port_params { uint16_t system_priority; /**< System priority (unused in current implementation) */ - struct ether_addr system; + struct rte_ether_addr system; /**< System ID - Slave MAC address, same as bonding MAC address */ uint16_t key; /**< Speed information (implementation dependednt) and duplex. */ @@ -103,7 +103,7 @@ struct lacpdu { /** LACPDU frame: Contains ethernet header and LACPDU. */ struct lacpdu_header { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct lacpdu lacpdu; } __attribute__((__packed__)); @@ -114,7 +114,7 @@ struct marker { uint8_t tlv_type_marker; uint8_t info_length; uint16_t requester_port; - struct ether_addr requester_system; + struct rte_ether_addr requester_system; uint32_t requester_transaction_id; uint8_t reserved_2[2]; @@ -124,7 +124,7 @@ struct marker { } __attribute__((__packed__)); struct marker_header { - struct ether_hdr eth_hdr; + struct rte_ether_hdr eth_hdr; struct marker marker; } __attribute__((__packed__)); diff --git a/drivers/net/bonding/rte_eth_bond_8023ad_private.h b/drivers/net/bonding/rte_eth_bond_8023ad_private.h index f91902ebd..d905de425 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad_private.h +++ b/drivers/net/bonding/rte_eth_bond_8023ad_private.h @@ -150,7 +150,7 @@ struct mode8023ad_private { uint64_t update_timeout_us; rte_eth_bond_8023ad_ext_slowrx_fn slowrx_cb; uint8_t external_sm; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link slave_link; /***< slave link properties */ diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index f16ae8f21..da0b062a0 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -72,8 +72,9 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) return -ENOMEM; } -void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, - struct bond_dev_private *internals) { +void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, + struct bond_dev_private *internals) +{ struct rte_arp_hdr *arp; struct client_data *hash_table = internals->mode6.client_table; @@ -102,7 +103,7 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, client_info->app_ip != arp->arp_data.arp_tip || client_info->cli_ip != arp->arp_data.arp_sip || !is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || - client_info->vlan_count != offset / sizeof(struct vlan_hdr) || + client_info->vlan_count != offset / sizeof(struct rte_vlan_hdr) || memcmp(client_info->vlan, eth_h + 1, offset) != 0 ) { client_info->in_use = 1; @@ -113,14 +114,14 @@ void bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); } internals->mode6.ntt = 1; rte_spinlock_unlock(&internals->mode6.lock); } uint16_t -bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals) { struct rte_arp_hdr *arp; @@ -130,7 +131,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, uint8_t hash_index; - struct ether_addr bonding_mac; + struct rte_ether_addr bonding_mac; arp = (struct rte_arp_hdr *)((char *)(eth_h + 1) + offset); @@ -163,7 +164,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); return client_info->slave_idx; } @@ -179,7 +180,7 @@ bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); - client_info->vlan_count = offset / sizeof(struct vlan_hdr); + client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); return client_info->slave_idx; } @@ -195,12 +196,12 @@ uint16_t bond_mode_alb_arp_upd(struct client_data *client_info, struct rte_mbuf *pkt, struct bond_dev_private *internals) { - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; struct rte_arp_hdr *arp_h; uint16_t slave_idx; rte_spinlock_lock(&internals->mode6.lock); - eth_h = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ether_addr_copy(&client_info->app_mac, ð_h->s_addr); ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); @@ -209,11 +210,12 @@ bond_mode_alb_arp_upd(struct client_data *client_info, else eth_h->ether_type = rte_cpu_to_be_16(ETHER_TYPE_ARP); - arp_h = (struct rte_arp_hdr *)((char *)eth_h + sizeof(struct ether_hdr) - + client_info->vlan_count * sizeof(struct vlan_hdr)); + arp_h = (struct rte_arp_hdr *)( + (char *)eth_h + sizeof(struct rte_ether_hdr) + + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); memcpy(eth_h + 1, client_info->vlan, - client_info->vlan_count * sizeof(struct vlan_hdr)); + client_info->vlan_count * sizeof(struct rte_vlan_hdr)); ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); arp_h->arp_data.arp_sip = client_info->app_ip; diff --git a/drivers/net/bonding/rte_eth_bond_alb.h b/drivers/net/bonding/rte_eth_bond_alb.h index 4640fd24e..386e70c59 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.h +++ b/drivers/net/bonding/rte_eth_bond_alb.h @@ -13,11 +13,11 @@ struct client_data { /** ARP data of single client */ - struct ether_addr app_mac; + struct rte_ether_addr app_mac; /**< MAC address of application running DPDK */ uint32_t app_ip; /**< IP address of application running DPDK */ - struct ether_addr cli_mac; + struct rte_ether_addr cli_mac; /**< Client MAC address */ uint32_t cli_ip; /**< Client IP address */ @@ -29,7 +29,7 @@ struct client_data { uint8_t ntt; /**< Flag indicating if we need to send update to this client on next tx */ - struct vlan_hdr vlan[2]; + struct rte_vlan_hdr vlan[2]; /**< Content of vlan headers */ uint8_t vlan_count; /**< Number of nested vlan headers */ @@ -68,7 +68,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev); * @param internals Bonding data. */ void -bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** @@ -85,7 +85,7 @@ bond_mode_alb_arp_recv(struct ether_hdr *eth_h, uint16_t offset, * Index of slave on which packet should be sent. */ uint16_t -bond_mode_alb_arp_xmit(struct ether_hdr *eth_h, uint16_t offset, +bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, struct bond_dev_private *internals); /** diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index a23988dc7..0fc4c5eda 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -840,7 +840,7 @@ rte_eth_bond_active_slaves_get(uint16_t bonded_port_id, uint16_t slaves[], int rte_eth_bond_mac_address_set(uint16_t bonded_port_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *bonded_eth_dev; struct bond_dev_private *internals; diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index b60fde6a8..01bbb06c1 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -282,7 +282,7 @@ bond_ethdev_parse_bond_mac_addr_kvarg(const char *key __rte_unused, /* Parse MAC */ return cmdline_parse_etheraddr(NULL, value, extra_args, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } int diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index b5300df12..d960e7ff6 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -33,21 +33,22 @@ static uint64_t tlb_last_obytets[RTE_MAX_ETHPORTS]; static inline size_t -get_vlan_offset(struct ether_hdr *eth_hdr, uint16_t *proto) +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) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = + (struct rte_vlan_hdr *)(eth_hdr + 1); - vlan_offset = sizeof(struct vlan_hdr); + vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; - vlan_offset += sizeof(struct vlan_hdr); + vlan_offset += sizeof(struct rte_vlan_hdr); } } return vlan_offset; @@ -394,8 +395,8 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, struct bond_dev_private *internals = bd_rx_q->dev_private; struct rte_eth_dev *bonded_eth_dev = &rte_eth_devices[internals->port_id]; - struct ether_addr *bond_mac = bonded_eth_dev->data->mac_addrs; - struct ether_hdr *hdr; + 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); uint16_t num_rx_total = 0; /* Total number of received packets */ @@ -444,7 +445,7 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, if (j + 3 < num_rx_total) rte_prefetch0(rte_pktmbuf_mtod(bufs[j + 3], void *)); - hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *); + hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); subtype = ((struct slow_protocol_frame *)hdr)->slow_protocol.subtype; /* Remove packet from array if it is slow packet or slave is not @@ -584,8 +585,9 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) #endif static void -mode6_debug(const char __attribute__((unused)) *info, struct ether_hdr *eth_h, - uint16_t port, uint32_t __attribute__((unused)) *burstnumber) +mode6_debug(const char __attribute__((unused)) *info, + struct rte_ether_hdr *eth_h, uint16_t port, + uint32_t __attribute__((unused)) *burstnumber) { struct ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB @@ -630,7 +632,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; uint16_t ether_type, offset; uint16_t nb_recv_pkts; int i; @@ -638,7 +640,7 @@ bond_ethdev_rx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) nb_recv_pkts = bond_ethdev_rx_burst(queue, bufs, nb_pkts); for (i = 0; i < nb_recv_pkts; i++) { - eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(bufs[i], struct rte_ether_hdr *); ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); @@ -738,7 +740,7 @@ bond_ethdev_tx_burst_active_backup(void *queue, } static inline uint16_t -ether_hash(struct ether_hdr *eth_hdr) +ether_hash(struct rte_ether_hdr *eth_hdr) { unaligned_uint16_t *word_src_addr = (unaligned_uint16_t *)eth_hdr->s_addr.addr_bytes; @@ -775,12 +777,12 @@ void burst_xmit_l2_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t hash; int i; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); hash = ether_hash(eth_hdr); @@ -793,13 +795,13 @@ burst_xmit_l23_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { uint16_t i; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t proto; size_t vlan_offset; uint32_t hash, l3hash; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); l3hash = 0; proto = eth_hdr->ether_type; @@ -830,7 +832,7 @@ void burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint16_t slave_count, uint16_t *slaves) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t proto; size_t vlan_offset; int i; @@ -840,7 +842,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { - eth_hdr = rte_pktmbuf_mtod(buf[i], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(buf[i], struct rte_ether_hdr *); size_t pkt_end = (size_t)eth_hdr + rte_pktmbuf_data_len(buf[i]); proto = eth_hdr->ether_type; vlan_offset = get_vlan_offset(eth_hdr, &proto); @@ -1008,9 +1010,9 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) uint16_t num_of_slaves = internals->active_slave_count; uint16_t slaves[RTE_MAX_ETHPORTS]; - struct ether_hdr *ether_hdr; - struct ether_addr primary_slave_addr; - struct ether_addr active_slave_addr; + struct rte_ether_hdr *ether_hdr; + struct rte_ether_addr primary_slave_addr; + struct rte_ether_addr active_slave_addr; if (num_of_slaves < 1) return num_tx_total; @@ -1032,7 +1034,8 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (j + 3 < nb_pkts) rte_prefetch0(rte_pktmbuf_mtod(bufs[j+3], void*)); - ether_hdr = rte_pktmbuf_mtod(bufs[j], struct ether_hdr *); + ether_hdr = rte_pktmbuf_mtod(bufs[j], + struct rte_ether_hdr *); if (is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) @@ -1068,7 +1071,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct bond_tx_queue *bd_tx_q = (struct bond_tx_queue *)queue; struct bond_dev_private *internals = bd_tx_q->dev_private; - struct ether_hdr *eth_h; + struct rte_ether_hdr *eth_h; uint16_t ether_type, offset; struct client_data *client_info; @@ -1098,7 +1101,7 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) /* Search tx buffer for ARP packets and forward them to alb */ for (i = 0; i < nb_pkts; i++) { - eth_h = rte_pktmbuf_mtod(bufs[i], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(bufs[i], struct rte_ether_hdr *); ether_type = eth_h->ether_type; offset = get_vlan_offset(eth_h, ðer_type); @@ -1132,10 +1135,10 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) "Failed to allocate ARP packet from pool"); continue; } - pkt_size = sizeof(struct ether_hdr) + + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr) + client_info->vlan_count * - sizeof(struct vlan_hdr); + sizeof(struct rte_vlan_hdr); upd_pkt->data_len = pkt_size; upd_pkt->pkt_len = pkt_size; @@ -1166,7 +1169,8 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) /* Print TX stats including update packets */ for (j = 0; j < slave_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(slave_bufs[i][j], + struct rte_ether_hdr *); mode6_debug("TX ARP:", eth_h, i, &burstnumberTX); } #endif @@ -1183,7 +1187,8 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) for (j = 0; j < update_bufs_pkts[i]; j++) { - eth_h = rte_pktmbuf_mtod(update_bufs[i][j], struct ether_hdr *); + eth_h = rte_pktmbuf_mtod(update_bufs[i][j], + struct rte_ether_hdr *); mode6_debug("TX ARPupd:", eth_h, i, &burstnumberTX); } #endif @@ -1501,9 +1506,10 @@ link_properties_valid(struct rte_eth_dev *ethdev, } int -mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) +mac_address_get(struct rte_eth_dev *eth_dev, + struct rte_ether_addr *dst_mac_addr) { - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); @@ -1522,9 +1528,10 @@ mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr) } int -mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) +mac_address_set(struct rte_eth_dev *eth_dev, + struct rte_ether_addr *new_mac_addr) { - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; if (eth_dev == NULL) { RTE_BOND_LOG(ERR, "NULL pointer eth_dev specified"); @@ -1545,7 +1552,7 @@ mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr) return 0; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; /* * Add additional MAC addresses to the slave @@ -1555,7 +1562,7 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, uint16_t slave_port_id) { int i, ret; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; @@ -1583,7 +1590,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, uint16_t slave_port_id) { int i, rc, ret; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; rc = 0; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { @@ -2006,7 +2013,7 @@ slave_add(struct bond_dev_private *internals, slave_details->link_status_wait_to_complete = 0; /* clean tlb_last_obytes when adding port for bonding device */ memcpy(&(slave_details->persisted_mac_addr), slave_eth_dev->data->mac_addrs, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } void @@ -2052,7 +2059,7 @@ bond_ethdev_start(struct rte_eth_dev *eth_dev) } if (internals->user_defined_mac == 0) { - struct ether_addr *new_mac_addr = NULL; + struct rte_ether_addr *new_mac_addr = NULL; for (i = 0; i < internals->slave_count; i++) if (internals->slaves[i].port_id == internals->primary_port) @@ -2938,7 +2945,8 @@ bond_ethdev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } static int -bond_ethdev_mac_address_set(struct rte_eth_dev *dev, struct ether_addr *addr) +bond_ethdev_mac_address_set(struct rte_eth_dev *dev, + struct rte_ether_addr *addr) { if (mac_address_set(dev, addr)) { RTE_BOND_LOG(ERR, "Failed to update MAC address"); @@ -2960,8 +2968,9 @@ bond_filter_ctrl(struct rte_eth_dev *dev __rte_unused, } static int -bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, - __rte_unused uint32_t index, uint32_t vmdq) +bond_ethdev_mac_addr_add(struct rte_eth_dev *dev, + struct rte_ether_addr *mac_addr, + __rte_unused uint32_t index, uint32_t vmdq) { struct rte_eth_dev *slave_eth_dev; struct bond_dev_private *internals = dev->data->dev_private; @@ -3011,7 +3020,7 @@ bond_ethdev_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) goto end; } - struct ether_addr *mac_addr = &dev->data->mac_addrs[index]; + struct rte_ether_addr *mac_addr = &dev->data->mac_addrs[index]; for (i = 0; i < internals->slave_count; i++) rte_eth_dev_mac_addr_remove(internals->slaves[i].port_id, @@ -3389,7 +3398,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) /* Parse MAC address for bonded device */ arg_count = rte_kvargs_count(kvlist, PMD_BOND_MAC_ADDR_KVARG); if (arg_count == 1) { - struct ether_addr bond_mac; + struct rte_ether_addr bond_mac; if (rte_kvargs_process(kvlist, PMD_BOND_MAC_ADDR_KVARG, &bond_ethdev_parse_bond_mac_addr_kvarg, &bond_mac) < 0) { diff --git a/drivers/net/bonding/rte_eth_bond_private.h b/drivers/net/bonding/rte_eth_bond_private.h index 8afef39ba..55c0b227b 100644 --- a/drivers/net/bonding/rte_eth_bond_private.h +++ b/drivers/net/bonding/rte_eth_bond_private.h @@ -85,7 +85,7 @@ struct bond_slave_details { uint8_t link_status_wait_to_complete; uint8_t last_link_status; /**< Port Id of slave eth_dev */ - struct ether_addr persisted_mac_addr; + struct rte_ether_addr persisted_mac_addr; uint16_t reta_size; }; @@ -223,10 +223,12 @@ void activate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id); int -mac_address_set(struct rte_eth_dev *eth_dev, struct ether_addr *new_mac_addr); +mac_address_set(struct rte_eth_dev *eth_dev, + struct rte_ether_addr *new_mac_addr); int -mac_address_get(struct rte_eth_dev *eth_dev, struct ether_addr *dst_mac_addr); +mac_address_get(struct rte_eth_dev *eth_dev, + struct rte_ether_addr *dst_mac_addr); int mac_address_slaves_update(struct rte_eth_dev *bonded_eth_dev); diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index fb8af5250..b54f75ebc 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -671,7 +671,7 @@ static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx, { struct port_info *pi = adap2pinfo(adapter, port_idx); - ether_addr_copy((struct ether_addr *)hw_addr, + ether_addr_copy((struct rte_ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0]); } diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 01d256da0..e36936959 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -1056,7 +1056,7 @@ static int cxgbe_get_regs(struct rte_eth_dev *eth_dev, return 0; } -int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct port_info *pi = (struct port_info *)(dev->data->dev_private); int ret; diff --git a/drivers/net/cxgbe/cxgbe_pfvf.h b/drivers/net/cxgbe/cxgbe_pfvf.h index 8d0a105aa..03145cea6 100644 --- a/drivers/net/cxgbe/cxgbe_pfvf.h +++ b/drivers/net/cxgbe/cxgbe_pfvf.h @@ -16,7 +16,7 @@ void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev); void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev); -int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr); +int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr); int cxgbe_dev_configure(struct rte_eth_dev *eth_dev); int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 2e043feb2..0e1dc1ae8 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -934,7 +934,7 @@ dpaa_flow_ctrl_get(struct rte_eth_dev *dev, static int dpaa_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, __rte_unused uint32_t pool) { @@ -964,7 +964,7 @@ dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev, static int dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { int ret; struct dpaa_if *dpaa_intf = dev->data->dev_private; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index a4085f47e..7f174f7fb 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -198,7 +198,8 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr) static inline void dpaa_checksum(struct rte_mbuf *mbuf) { - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); + struct rte_ether_hdr *eth_hdr = + rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 900182f66..ae4d7e1cc 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1124,7 +1124,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int dpaa2_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -1155,7 +1155,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev, struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; PMD_INIT_FUNC_TRACE(); @@ -1175,7 +1175,7 @@ dpaa2_dev_remove_mac_addr(struct rte_eth_dev *dev, static int dpaa2_dev_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { int ret; struct dpaa2_dev_priv *priv = dev->data->dev_private; @@ -1992,13 +1992,13 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { */ static int populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, - struct ether_addr *mac_entry) + struct rte_ether_addr *mac_entry) { int ret; - struct ether_addr phy_mac, prime_mac; + struct rte_ether_addr phy_mac, prime_mac; - memset(&phy_mac, 0, sizeof(struct ether_addr)); - memset(&prime_mac, 0, sizeof(struct ether_addr)); + memset(&phy_mac, 0, sizeof(struct rte_ether_addr)); + memset(&prime_mac, 0, sizeof(struct rte_ether_addr)); /* Get the physical device MAC address */ ret = dpni_get_port_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, @@ -2032,7 +2032,8 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, ret); goto cleanup; } - memcpy(&prime_mac, &phy_mac, sizeof(struct ether_addr)); + memcpy(&prime_mac, &phy_mac, + sizeof(struct rte_ether_addr)); } } else if (is_zero_ether_addr(&prime_mac)) { /* In case phys and prime, both are zero, create random MAC */ @@ -2047,7 +2048,7 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, } /* prime_mac the final MAC address */ - memcpy(mac_entry, &prime_mac, sizeof(struct ether_addr)); + memcpy(mac_entry, &prime_mac, sizeof(struct rte_ether_addr)); return 0; cleanup: diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c index 9ef46d47e..572eb8462 100644 --- a/drivers/net/dpaa2/dpaa2_flow.c +++ b/drivers/net/dpaa2/dpaa2_flow.c @@ -214,27 +214,27 @@ dpaa2_configure_flow_eth(struct rte_flow *flow, /* Key rule */ key_iova = flow->rule.key_iova + DPAA2_CLS_RULE_OFFSET_ETH; memcpy((void *)key_iova, (const void *)(spec->src.addr_bytes), - sizeof(struct ether_addr)); - key_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + key_iova += sizeof(struct rte_ether_addr); memcpy((void *)key_iova, (const void *)(spec->dst.addr_bytes), - sizeof(struct ether_addr)); - key_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + key_iova += sizeof(struct rte_ether_addr); memcpy((void *)key_iova, (const void *)(&spec->type), sizeof(rte_be16_t)); /* Key mask */ mask_iova = flow->rule.mask_iova + DPAA2_CLS_RULE_OFFSET_ETH; memcpy((void *)mask_iova, (const void *)(mask->src.addr_bytes), - sizeof(struct ether_addr)); - mask_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + mask_iova += sizeof(struct rte_ether_addr); memcpy((void *)mask_iova, (const void *)(mask->dst.addr_bytes), - sizeof(struct ether_addr)); - mask_iova += sizeof(struct ether_addr); + sizeof(struct rte_ether_addr)); + mask_iova += sizeof(struct rte_ether_addr); memcpy((void *)mask_iova, (const void *)(&mask->type), sizeof(rte_be16_t)); flow->rule.key_size = (DPAA2_CLS_RULE_OFFSET_ETH + - ((2 * sizeof(struct ether_addr)) + + ((2 * sizeof(struct rte_ether_addr)) + sizeof(rte_be16_t))); return device_configured; } diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 8230824e7..b2fdb5e10 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -89,14 +89,15 @@ static int eth_em_led_on(struct rte_eth_dev *dev); static int eth_em_led_off(struct rte_eth_dev *dev); static int em_get_rx_buffer_size(struct e1000_hw *hw); -static int eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, - uint32_t index, uint32_t pool); +static int eth_em_rar_set(struct rte_eth_dev *dev, + struct rte_ether_addr *mac_addr, + uint32_t index, uint32_t pool); static void eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index); static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); #define EM_FC_PAUSE_TIME 0x0680 @@ -293,7 +294,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, eth_dev->data->mac_addrs); /* initialize the vfta */ @@ -1735,7 +1736,7 @@ eth_em_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) } static int -eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +eth_em_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, __rte_unused uint32_t pool) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -1756,7 +1757,7 @@ eth_em_rar_clear(struct rte_eth_dev *dev, uint32_t index) static int eth_em_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { eth_em_rar_clear(dev, 0); @@ -1806,7 +1807,7 @@ eth_em_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct e1000_hw *hw; diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index d3a8f5bf4..e21a772fb 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -145,11 +145,11 @@ static int eth_igb_led_off(struct rte_eth_dev *dev); static void igb_intr_disable(struct rte_eth_dev *dev); static int igb_get_rx_buffer_size(struct e1000_hw *hw); static int eth_igb_rar_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index); static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static void igbvf_intr_disable(struct e1000_hw *hw); static int igbvf_dev_configure(struct rte_eth_dev *dev); @@ -174,7 +174,7 @@ static int igbvf_vlan_filter_set(struct rte_eth_dev *dev, static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on); static void igbvf_set_vfta_all(struct rte_eth_dev *dev, bool on); static int igbvf_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr); + struct rte_ether_addr *addr); static int igbvf_get_reg_length(struct rte_eth_dev *dev); static int igbvf_get_regs(struct rte_eth_dev *dev, struct rte_dev_reg_info *regs); @@ -231,7 +231,7 @@ static int eth_igb_get_module_info(struct rte_eth_dev *dev, static int eth_igb_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); static int igb_timesync_enable(struct rte_eth_dev *dev); static int igb_timesync_disable(struct rte_eth_dev *dev); @@ -840,7 +840,8 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + ð_dev->data->mac_addrs[0]); /* initialize the vfta */ memset(shadow_vfta, 0, sizeof(*shadow_vfta)); @@ -983,7 +984,8 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); int diag; - struct ether_addr *perm_addr = (struct ether_addr *)hw->mac.perm_addr; + struct rte_ether_addr *perm_addr = + (struct rte_ether_addr *)hw->mac.perm_addr; PMD_INIT_FUNC_TRACE(); @@ -1057,7 +1059,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) return diag; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x " @@ -3119,7 +3121,7 @@ eth_igb_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) #define E1000_RAH_POOLSEL_SHIFT (18) static int -eth_igb_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +eth_igb_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -3145,7 +3147,7 @@ eth_igb_rar_clear(struct rte_eth_dev *dev, uint32_t index) static int eth_igb_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { eth_igb_rar_clear(dev, 0); eth_igb_rar_set(dev, (void *)addr, 0, 0); @@ -3358,7 +3360,7 @@ igbvf_dev_close(struct rte_eth_dev *dev) struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct e1000_adapter *adapter = E1000_DEV_PRIVATE(dev->data->dev_private); - struct ether_addr addr; + struct rte_ether_addr addr; PMD_INIT_FUNC_TRACE(); @@ -3503,7 +3505,7 @@ igbvf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) } static int -igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *addr) +igbvf_default_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4905,7 +4907,7 @@ eth_igb_filter_ctrl(struct rte_eth_dev *dev, static int eth_igb_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct e1000_hw *hw; diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index b9f2e5391..9f1521350 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -306,8 +306,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); int rah; - if (is_unicast_ether_addr((struct ether_addr *)new_mac)) { - if (!is_zero_ether_addr((struct ether_addr *)new_mac)) + if (is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { + if (!is_zero_ether_addr((struct rte_ether_addr *)new_mac)) rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 3eb38165c..1d832f91f 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1813,9 +1813,9 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) ENA_ADMIN_FEATURE_OFFLOAD_DESC_RX_L4_IPV4_CSUM_MASK) != 0; /* Copy MAC address and point DPDK to it */ - eth_dev->data->mac_addrs = (struct ether_addr *)adapter->mac_addr; - ether_addr_copy((struct ether_addr *)get_feat_ctx.dev_attr.mac_addr, - (struct ether_addr *)adapter->mac_addr); + eth_dev->data->mac_addrs = (struct rte_ether_addr *)adapter->mac_addr; + ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, + (struct rte_ether_addr *)adapter->mac_addr); /* * Pass the information to the rte_eth_dev_close() that it should also @@ -2151,7 +2151,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, * length of the ethernet header. */ if (unlikely(m->l2_len == 0)) - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 362e0740c..2f473358d 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -840,7 +840,7 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* Set MTU */ diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 9193fb038..20080af6f 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -197,7 +197,7 @@ struct enic { /* Multicast MAC addresses added to the NIC */ uint32_t mc_count; - struct ether_addr mc_addrs[ENIC_MULTICAST_PERFECT_FILTERS]; + struct rte_ether_addr mc_addrs[ENIC_MULTICAST_PERFECT_FILTERS]; }; /* Compute ethdev's max packet size from MTU */ diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 8d14d8ac7..71e1b9c7d 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -604,7 +604,7 @@ static void enicpmd_dev_allmulticast_disable(struct rte_eth_dev *eth_dev) } static int enicpmd_add_mac_addr(struct rte_eth_dev *eth_dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct enic *enic = pmd_priv(eth_dev); @@ -629,7 +629,7 @@ static void enicpmd_remove_mac_addr(struct rte_eth_dev *eth_dev, uint32_t index) } static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct enic *enic = pmd_priv(eth_dev); int ret; @@ -644,7 +644,7 @@ static int enicpmd_set_mac_addr(struct rte_eth_dev *eth_dev, return enic_set_mac_address(enic, addr->addr_bytes); } -static void debug_log_add_del_addr(struct ether_addr *addr, bool add) +static void debug_log_add_del_addr(struct rte_ether_addr *addr, bool add) { char mac_str[ETHER_ADDR_FMT_SIZE]; @@ -654,12 +654,12 @@ static void debug_log_add_del_addr(struct ether_addr *addr, bool add) } static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct enic *enic = pmd_priv(eth_dev); char mac_str[ETHER_ADDR_FMT_SIZE]; - struct ether_addr *addr; + struct rte_ether_addr *addr; uint32_t i, j; int ret; @@ -730,7 +730,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, } /* Keep a copy so we can flush/apply later on.. */ memcpy(enic->mc_addrs, mc_addr_set, - nb_mc_addr * sizeof(struct ether_addr)); + nb_mc_addr * sizeof(struct rte_ether_addr)); enic->mc_count = nb_mc_addr; return 0; } diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index 511c177f4..9bddfb941 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -572,9 +572,9 @@ enic_copy_item_inner_eth_v2(struct copy_item_args *arg) FLOW_TRACE(); if (!mask) mask = &rte_flow_item_eth_mask; - arg->l2_proto_off = *off + offsetof(struct ether_hdr, ether_type); + arg->l2_proto_off = *off + offsetof(struct rte_ether_hdr, ether_type); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ether_hdr), + arg->item->spec, mask, sizeof(struct rte_ether_hdr), 0 /* no previous protocol */, 0, 0); } @@ -590,9 +590,9 @@ enic_copy_item_inner_vlan_v2(struct copy_item_args *arg) mask = &rte_flow_item_vlan_mask; /* Append vlan header to L5 and set ether type = TPID */ eth_type_off = arg->l2_proto_off; - arg->l2_proto_off = *off + offsetof(struct vlan_hdr, eth_proto); + 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 vlan_hdr), + arg->item->spec, mask, sizeof(struct rte_vlan_hdr), eth_type_off, rte_cpu_to_be_16(ETHER_TYPE_VLAN), 2); } @@ -663,8 +663,8 @@ enic_copy_item_eth_v2(struct copy_item_args *arg) { const struct rte_flow_item *item = arg->item; struct filter_v2 *enic_filter = arg->filter; - struct ether_hdr enic_spec; - struct ether_hdr enic_mask; + struct rte_ether_hdr enic_spec; + struct rte_ether_hdr enic_mask; const struct rte_flow_item_eth *spec = item->spec; const struct rte_flow_item_eth *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; @@ -692,9 +692,9 @@ enic_copy_item_eth_v2(struct copy_item_args *arg) /* outer header */ memcpy(gp->layer[FILTER_GENERIC_1_L2].mask, &enic_mask, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L2].val, &enic_spec, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); return 0; } @@ -706,8 +706,8 @@ enic_copy_item_vlan_v2(struct copy_item_args *arg) const struct rte_flow_item_vlan *spec = item->spec; const struct rte_flow_item_vlan *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; - struct ether_hdr *eth_mask; - struct ether_hdr *eth_val; + struct rte_ether_hdr *eth_mask; + struct rte_ether_hdr *eth_val; FLOW_TRACE(); @@ -734,11 +734,11 @@ enic_copy_item_vlan_v2(struct copy_item_args *arg) * vlan tag remains in the L2 buffer. */ if (!arg->enic->vxlan && !arg->enic->ig_vlan_strip_en) { - struct vlan_hdr *vlan; + struct rte_vlan_hdr *vlan; - vlan = (struct vlan_hdr *)(eth_mask + 1); + vlan = (struct rte_vlan_hdr *)(eth_mask + 1); vlan->eth_proto = mask->inner_type; - vlan = (struct vlan_hdr *)(eth_val + 1); + vlan = (struct rte_vlan_hdr *)(eth_val + 1); vlan->eth_proto = spec->inner_type; } else { eth_mask->ether_type = mask->inner_type; @@ -947,11 +947,11 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) mask = &rte_flow_item_vxlan_mask; memcpy(gp->layer[FILTER_GENERIC_1_L5].mask, mask, - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L5].val, spec, - sizeof(struct vxlan_hdr)); + sizeof(struct rte_vxlan_hdr)); - *inner_ofst = sizeof(struct vxlan_hdr); + *inner_ofst = sizeof(struct rte_vxlan_hdr); return 0; } @@ -1051,7 +1051,7 @@ fixup_l5_layer(struct enic *enic, struct filter_generic_1 *gp, if (!(inner_ofst > 0 && enic->vxlan)) return; FLOW_TRACE(); - vxlan = sizeof(struct vxlan_hdr); + vxlan = sizeof(struct rte_vxlan_hdr); memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), gp->layer[FILTER_GENERIC_1_L5].mask, vxlan); memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index ea9eb2edf..6b7683914 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1667,13 +1667,13 @@ static int enic_dev_init(struct enic *enic) enic_fdir_info(enic); eth_dev->data->mac_addrs = rte_zmalloc("enic_mac_addr", - sizeof(struct ether_addr) * + sizeof(struct rte_ether_addr) * ENIC_UNICAST_PERFECT_FILTERS, 0); if (!eth_dev->data->mac_addrs) { dev_err(enic, "mac addr storage alloc failed, aborting.\n"); return -1; } - ether_addr_copy((struct ether_addr *) enic->mac_addr, + ether_addr_copy((struct rte_ether_addr *)enic->mac_addr, eth_dev->data->mac_addrs); vnic_dev_set_reset_flag(enic->vdev, 0); diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 42dfaca30..8f7d91169 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -166,7 +166,7 @@ static int fs_eth_dev_create(struct rte_vdev_device *vdev) { struct rte_eth_dev *dev; - struct ether_addr *mac; + struct rte_ether_addr *mac; struct fs_priv *priv; struct sub_device *sdev; const char *params; diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c index 3351c5bca..5fc6be403 100644 --- a/drivers/net/failsafe/failsafe_args.c +++ b/drivers/net/failsafe/failsafe_args.c @@ -367,7 +367,7 @@ static int fs_get_mac_addr_arg(const char *key __rte_unused, const char *value, void *out) { - struct ether_addr *ea = out; + struct rte_ether_addr *ea = out; int ret; if ((value == NULL) || (out == NULL)) diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 7ac23d49a..549ee6bb8 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -166,7 +166,7 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, DEBUG("Configure additional MAC address%s", (PRIV(dev)->nb_mac_addr > 2 ? "es" : "")); for (i = 1; i < PRIV(dev)->nb_mac_addr; i++) { - struct ether_addr *ea; + struct rte_ether_addr *ea; ea = &dev->data->mac_addrs[i]; ret = rte_eth_dev_mac_addr_add(PORT_ID(sdev), ea, diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 43d6a828f..c900eccb2 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -1082,7 +1082,7 @@ fs_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) static int fs_mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { @@ -1111,7 +1111,7 @@ fs_mac_addr_add(struct rte_eth_dev *dev, } static int -fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +fs_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct sub_device *sdev; uint8_t i; @@ -1135,7 +1135,7 @@ fs_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) static int fs_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct sub_device *sdev; uint8_t i; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 4f58a5c91..231b89edd 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -152,10 +152,10 @@ struct fs_priv { TAILQ_HEAD(sub_flows, rte_flow) flow_list; /* current number of mac_addr slots allocated. */ uint32_t nb_mac_addr; - struct ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; + struct rte_ether_addr mac_addrs[FAILSAFE_MAX_ETHADDR]; uint32_t mac_addr_pool[FAILSAFE_MAX_ETHADDR]; uint32_t nb_mcast_addr; - struct ether_addr *mcast_addrs; + struct rte_ether_addr *mcast_addrs; /* current capabilities */ struct rte_eth_dev_info infos; struct rte_eth_dev_owner my_owner; /* Unique owner. */ diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index caf4d1bc0..ac00828dd 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -614,7 +614,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); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); macvlan->nb_queue_pools = nb_queue_pools; @@ -1664,7 +1664,7 @@ static void fm10k_MAC_filter_set(struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int fm10k_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { @@ -3080,7 +3080,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_read_mac_addr(hw); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); if (diag != FM10K_SUCCESS || @@ -3089,7 +3089,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) /* Generate a random addr */ eth_random_addr(hw->mac.addr); memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); - ether_addr_copy((const struct ether_addr *)hw->mac.addr, + ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index cab440f5a..802900dc7 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -265,7 +265,7 @@ static int i40e_flow_ctrl_set(struct rte_eth_dev *dev, static int i40e_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf); static int i40e_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); @@ -379,7 +379,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, struct rte_dev_eeprom_info *info); static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); @@ -1468,8 +1468,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) goto err_get_mac_addr; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.addr, - (struct ether_addr *) hw->mac.perm_addr); + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + (struct rte_ether_addr *)hw->mac.perm_addr); /* Disable flow control */ hw->fc.requested_mode = I40E_FC_NONE; @@ -1520,7 +1520,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) "Failed to allocated memory for storing mac address"); goto err_mac_alloc; } - ether_addr_copy((struct ether_addr *)hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, &dev->data->mac_addrs[0]); /* Init dcb to sw mode by default */ @@ -4011,7 +4011,7 @@ i40e_priority_flow_ctrl_set(__rte_unused struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int i40e_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t pool) { @@ -4062,7 +4062,7 @@ i40e_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct i40e_vsi *vsi; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; int ret; uint32_t i; uint64_t pool_sel; @@ -4103,8 +4103,8 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, { struct i40e_hw *hw; struct i40e_mac_filter_info mac_filter; - struct ether_addr old_mac; - struct ether_addr *new_mac; + struct rte_ether_addr old_mac; + struct rte_ether_addr *new_mac; struct i40e_pf_vf *vf = NULL; uint16_t vf_id; int ret; @@ -4165,7 +4165,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, /* Clear device address as it has been removed */ if (is_same_ether_addr(&(pf->dev_addr), new_mac)) - memset(&pf->dev_addr, 0, sizeof(struct ether_addr)); + memset(&pf->dev_addr, 0, sizeof(struct rte_ether_addr)); } return 0; @@ -5342,7 +5342,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) ret = i40e_aq_remove_macvlan(hw, vsi->seid, &def_filter, 1, NULL); if (ret != I40E_SUCCESS) { struct i40e_mac_filter *f; - struct ether_addr *mac; + struct rte_ether_addr *mac; PMD_DRV_LOG(DEBUG, "Cannot remove the default macvlan filter"); @@ -5362,7 +5362,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) return ret; } rte_memcpy(&filter.mac_addr, - (struct ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); + (struct rte_ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; return i40e_vsi_add_mac(vsi, &filter); } @@ -5480,7 +5480,7 @@ i40e_vsi_setup(struct i40e_pf *pf, struct i40e_mac_filter_info filter; int ret; struct i40e_vsi_context ctxt; - struct ether_addr broadcast = + struct rte_ether_addr broadcast = {.addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; if (type != I40E_VSI_MAIN && type != I40E_VSI_SRIOV && @@ -6907,7 +6907,7 @@ i40e_remove_macvlan_filters(struct i40e_vsi *vsi, /* Find out specific MAC filter */ static struct i40e_mac_filter * i40e_find_mac_filter(struct i40e_vsi *vsi, - struct ether_addr *macaddr) + struct rte_ether_addr *macaddr) { struct i40e_mac_filter *f; @@ -6991,7 +6991,7 @@ i40e_set_vlan_filter(struct i40e_vsi *vsi, int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, - int num, struct ether_addr *addr) + int num, struct rte_ether_addr *addr) { int i; uint32_t j, k; @@ -7285,7 +7285,7 @@ i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *mac_filter) } int -i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr) +i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr) { struct i40e_mac_filter *f; struct i40e_macvlan_filter *mv_f; @@ -7585,10 +7585,10 @@ i40e_tunnel_filter_convert( struct i40e_aqc_cloud_filters_element_bb *cld_filter, struct i40e_tunnel_filter *tunnel_filter) { - ether_addr_copy((struct ether_addr *)&cld_filter->element.outer_mac, - (struct ether_addr *)&tunnel_filter->input.outer_mac); - ether_addr_copy((struct ether_addr *)&cld_filter->element.inner_mac, - (struct ether_addr *)&tunnel_filter->input.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, + (struct rte_ether_addr *)&tunnel_filter->input.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, + (struct rte_ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->element.inner_vlan; if ((rte_le_to_cpu_16(cld_filter->element.flags) & I40E_AQC_ADD_CLOUD_FLAGS_IPV6) == @@ -7697,9 +7697,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, pfilter = cld_filter; ether_addr_copy(&tunnel_filter->outer_mac, - (struct ether_addr *)&pfilter->element.outer_mac); + (struct rte_ether_addr *)&pfilter->element.outer_mac); ether_addr_copy(&tunnel_filter->inner_mac, - (struct ether_addr *)&pfilter->element.inner_mac); + (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); @@ -8144,9 +8144,9 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, pfilter = cld_filter; ether_addr_copy(&tunnel_filter->outer_mac, - (struct ether_addr *)&pfilter->element.outer_mac); + (struct rte_ether_addr *)&pfilter->element.outer_mac); ether_addr_copy(&tunnel_filter->inner_mac, - (struct ether_addr *)&pfilter->element.inner_mac); + (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = rte_cpu_to_le_16(tunnel_filter->inner_vlan); @@ -11950,7 +11950,7 @@ static int i40e_get_module_eeprom(struct rte_eth_dev *dev, } static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -12083,10 +12083,10 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) vsi = vf->vsi; } memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct ether_addr *)&f->input.outer_mac, - (struct ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct ether_addr *)&f->input.inner_mac, - (struct ether_addr *)&cld_filter.element.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, + (struct rte_ether_addr *)&cld_filter.element.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, + (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = f->input.inner_vlan; cld_filter.element.flags = f->input.flags; cld_filter.element.tenant_id = f->input.tenant_id; diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 98550380e..ffaa7b949 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -277,7 +277,7 @@ struct i40e_adapter; */ struct i40e_mac_filter_info { enum rte_mac_filter_type filter_type; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; TAILQ_HEAD(i40e_mac_filter_list, i40e_mac_filter); @@ -330,7 +330,7 @@ struct i40e_veb { /* i40e MACVLAN filter structure */ struct i40e_macvlan_filter { - struct ether_addr macaddr; + struct rte_ether_addr macaddr; enum rte_mac_filter_type filter_type; uint16_t vlan_id; }; @@ -421,7 +421,7 @@ struct i40e_pf_vf { uint16_t vf_idx; /* VF index in pf->vfs */ uint16_t lan_nb_qps; /* Actual queues allocated */ uint16_t reset_cnt; /* Total vf reset times */ - struct ether_addr mac_addr; /* Default MAC address */ + struct rte_ether_addr mac_addr; /* Default MAC address */ /* version of the virtchnl from VF */ struct virtchnl_version_info version; uint32_t request_caps; /* offload caps requested from VF */ @@ -641,7 +641,7 @@ struct i40e_fdir_info { /* Ethertype filter struct */ struct i40e_ethertype_filter_input { - struct ether_addr mac_addr; /* Mac address to match */ + struct rte_ether_addr mac_addr; /* Mac address to match */ uint16_t ether_type; /* Ether type to match */ }; @@ -759,8 +759,8 @@ enum i40e_tunnel_type { * Tunneling Packet filter configuration. */ struct i40e_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ uint32_t outer_vlan; /**< Outer VLAN to match */ enum i40e_tunnel_iptype ip_type; /**< IP address type. */ @@ -919,7 +919,7 @@ struct i40e_pf { bool offset_loaded; struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ - struct ether_addr dev_addr; /* PF device mac address */ + struct rte_ether_addr dev_addr; /* PF device mac address */ uint64_t flags; /* PF feature flags */ /* All kinds of queue pair setting for different VSIs */ struct i40e_pf_vf *vfs; @@ -1023,7 +1023,8 @@ struct i40e_vf { uint16_t promisc_flags; /* Promiscuous setting */ uint32_t vlan[I40E_VFTA_SIZE]; /* VLAN bit map */ - struct ether_addr mc_addrs[I40E_NUM_MACADDR_MAX]; /* Multicast addrs */ + /* Multicast addrs */ + struct rte_ether_addr mc_addrs[I40E_NUM_MACADDR_MAX]; uint16_t mc_addrs_num; /* Multicast mac addresses number */ /* Event from pf */ @@ -1131,7 +1132,7 @@ int i40e_switch_tx_queue(struct i40e_hw *hw, uint16_t q_idx, bool on); int i40e_vsi_add_vlan(struct i40e_vsi *vsi, uint16_t vlan); int i40e_vsi_delete_vlan(struct i40e_vsi *vsi, uint16_t vlan); int i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *filter); -int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct ether_addr *addr); +int i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr); void i40e_update_vsi_stats(struct i40e_vsi *vsi); void i40e_pf_disable_irq0(struct i40e_hw *hw); void i40e_pf_enable_irq0(struct i40e_hw *hw); @@ -1206,7 +1207,7 @@ int i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, int i40e_fdir_flush(struct rte_eth_dev *dev); int i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, struct i40e_macvlan_filter *mv_f, - int num, struct ether_addr *addr); + int num, struct rte_ether_addr *addr); int i40e_remove_macvlan_filters(struct i40e_vsi *vsi, struct i40e_macvlan_filter *filter, int total); diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index a34897293..0b05ddb34 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -106,7 +106,7 @@ static int i40evf_dev_tx_queue_start(struct rte_eth_dev *dev, static int i40evf_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); static int i40evf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, uint32_t pool); static void i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index); @@ -123,7 +123,7 @@ static int i40evf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int i40evf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int @@ -134,10 +134,11 @@ static void i40evf_handle_pf_event(struct rte_eth_dev *dev, static int i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr, bool add); static int -i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, +i40evf_set_mc_addr_list(struct rte_eth_dev *dev, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /* Default hash key buffer for RSS */ @@ -776,7 +777,7 @@ i40evf_stop_queues(struct rte_eth_dev *dev) static int i40evf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -818,7 +819,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev, static void i40evf_del_mac_addr_by_addr(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct virtchnl_ether_addr_list *list; struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); @@ -859,7 +860,7 @@ static void i40evf_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) { struct rte_eth_dev_data *data = dev->data; - struct ether_addr *addr; + struct rte_ether_addr *addr; addr = &data->mac_addrs[index]; @@ -1273,7 +1274,7 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - if (is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; else eth_random_addr(hw->mac.addr); /* Generate a random one */ @@ -1511,7 +1512,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); return 0; @@ -1929,7 +1930,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) int next_begin = 0; int begin = 0; uint32_t len; - struct ether_addr *addr; + struct rte_ether_addr *addr; struct vf_cmd_info args; do { @@ -2701,7 +2702,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int i40evf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -2714,18 +2715,18 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, if (vf->flags & I40E_FLAG_VF_MAC_BY_PF) return -EPERM; - i40evf_del_mac_addr_by_addr(dev, (struct ether_addr *)hw->mac.addr); + i40evf_del_mac_addr_by_addr(dev, (struct rte_ether_addr *)hw->mac.addr); if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0) return -EIO; - ether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } static int i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addrs, + struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num, bool add) { struct virtchnl_ether_addr_list *list; @@ -2779,7 +2780,8 @@ i40evf_add_del_mc_addr_list(struct rte_eth_dev *dev, } static int -i40evf_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addrs, +i40evf_set_mc_addr_list(struct rte_eth_dev *dev, + struct rte_ether_addr *mc_addrs, uint32_t mc_addrs_num) { struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4b32fee1e..dd940cecb 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -685,7 +685,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, { static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; - uint8_t len = 2 * sizeof(struct ether_addr); + uint8_t len = 2 * sizeof(struct rte_ether_addr); struct ipv4_hdr *ip; struct ipv6_hdr *ip6; static const uint8_t next_proto[] = { @@ -701,7 +701,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, [RTE_ETH_FLOW_NONFRAG_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), @@ -959,7 +959,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, struct i40e_customized_pctype *cus_pctype = NULL; static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; - uint8_t len = 2 * sizeof(struct ether_addr); + uint8_t len = 2 * sizeof(struct rte_ether_addr); struct ipv4_hdr *ip; struct ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; @@ -977,7 +977,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; - raw_pkt += 2 * sizeof(struct ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); rte_memcpy(raw_pkt + sizeof(uint16_t), diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 5447e4ea5..0640137a8 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -4802,10 +4802,10 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, int ret = 0; memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct ether_addr *)&filter->input.outer_mac, - (struct ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct ether_addr *)&filter->input.inner_mac, - (struct ether_addr *)&cld_filter.element.inner_mac); + ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, + (struct rte_ether_addr *)&cld_filter.element.outer_mac); + ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, + (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = filter->input.inner_vlan; cld_filter.element.flags = filter->input.flags; cld_filter.element.tenant_id = filter->input.tenant_id; diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 91be45027..4d7001df5 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -349,7 +349,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; ether_addr_copy(&vf->mac_addr, - (struct ether_addr *)vf_res->vsi_res[0].default_mac_addr); + (struct rte_ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_VF_RESOURCES, @@ -823,7 +823,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, (struct virtchnl_ether_addr_list *)msg; struct i40e_mac_filter_info filter; int i; - struct ether_addr *mac; + struct rte_ether_addr *mac; if (!b_op) { i40e_pf_host_send_msg_to_vf( @@ -842,7 +842,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 ether_addr *)(addr_list->list[i].addr); + mac = (struct rte_ether_addr *)(addr_list->list[i].addr); rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; if (is_zero_ether_addr(mac) || @@ -869,7 +869,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf, struct virtchnl_ether_addr_list *addr_list = (struct virtchnl_ether_addr_list *)msg; int i; - struct ether_addr *mac; + struct rte_ether_addr *mac; if (!b_op) { i40e_pf_host_send_msg_to_vf( @@ -886,7 +886,7 @@ i40e_pf_host_process_cmd_del_ether_address(struct i40e_pf_vf *vf, } for (i = 0; i < addr_list->num_elements; i++) { - mac = (struct ether_addr *)(addr_list->list[i].addr); + mac = (struct rte_ether_addr *)(addr_list->list[i].addr); if(is_zero_ether_addr(mac) || i40e_vsi_delete_mac(vf->vsi, mac)) { ret = I40E_ERR_INVALID_MAC_ADDR; diff --git a/drivers/net/i40e/i40e_vf_representor.c b/drivers/net/i40e/i40e_vf_representor.c index 45a15d3ab..633dca6c3 100644 --- a/drivers/net/i40e/i40e_vf_representor.c +++ b/drivers/net/i40e/i40e_vf_representor.c @@ -324,7 +324,7 @@ i40e_vf_representor_mac_addr_remove(struct rte_eth_dev *ethdev, uint32_t index) static int i40e_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_vf_representor *representor = ethdev->data->dev_private; diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index 7ae78e426..8e562553a 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -529,7 +529,7 @@ rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, uint16_t vf_id, uint8_t on) int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct i40e_mac_filter *f; struct rte_eth_dev *dev; @@ -571,11 +571,11 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, return 0; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct i40e_pf_vf *vf; @@ -724,7 +724,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, struct i40e_vsi *vsi; struct i40e_hw *hw; struct i40e_mac_filter_info filter; - struct ether_addr broadcast = { + struct rte_ether_addr broadcast = { .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; int ret; @@ -2355,7 +2355,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; struct i40e_pf_vf *vf; @@ -2492,10 +2492,11 @@ rte_pmd_i40e_flow_type_mapping_update( } int -rte_pmd_i40e_query_vfid_by_mac(uint16_t port, const struct ether_addr *vf_mac) +rte_pmd_i40e_query_vfid_by_mac(uint16_t port, + const struct rte_ether_addr *vf_mac) { struct rte_eth_dev *dev; - struct ether_addr *mac; + struct rte_ether_addr *mac; struct i40e_pf *pf; int vf_id; struct i40e_pf_vf *vf; diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h index a1313146b..faac9e2e2 100644 --- a/drivers/net/i40e/rte_pmd_i40e.h +++ b/drivers/net/i40e/rte_pmd_i40e.h @@ -453,7 +453,7 @@ int rte_pmd_i40e_set_vf_multicast_promisc(uint16_t port, * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Remove the VF MAC address. @@ -471,7 +471,7 @@ int rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, */ int rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable vf vlan strip for all queues in a pool @@ -854,7 +854,7 @@ int rte_pmd_i40e_ptype_mapping_replace(uint16_t port, * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); #define RTE_PMD_I40E_PCTYPE_MAX 64 #define RTE_PMD_I40E_FLOW_TYPE_MAX 64 @@ -924,7 +924,7 @@ int rte_pmd_i40e_flow_type_mapping_reset(uint16_t port); * -ENOTSUP: i40e not supported for this port. */ int rte_pmd_i40e_query_vfid_by_mac(uint16_t port, - const struct ether_addr *vf_mac); + const struct rte_ether_addr *vf_mac); /** * Do RSS queue region configuration for that port as diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 3470e0305..1227259f5 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -217,6 +217,6 @@ int iavf_query_stats(struct iavf_adapter *adapter, int iavf_config_promisc(struct iavf_adapter *adapter, bool enable_unicast, bool enable_multicast); int iavf_add_del_eth_addr(struct iavf_adapter *adapter, - struct ether_addr *addr, bool add); + struct rte_ether_addr *addr, bool add); int iavf_add_del_vlan(struct iavf_adapter *adapter, uint16_t vlanid, bool add); #endif /* _IAVF_ETHDEV_H_ */ diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 4072a7b79..c98355025 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -48,7 +48,7 @@ static void iavf_dev_promiscuous_disable(struct rte_eth_dev *dev); static void iavf_dev_allmulticast_enable(struct rte_eth_dev *dev); static void iavf_dev_allmulticast_disable(struct rte_eth_dev *dev); static int iavf_dev_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *addr, + struct rte_ether_addr *addr, uint32_t index, uint32_t pool); static void iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index); @@ -67,7 +67,7 @@ static int iavf_dev_rss_hash_conf_get(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); static int iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int iavf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id); static int iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, @@ -697,7 +697,7 @@ iavf_dev_allmulticast_disable(struct rte_eth_dev *dev) } static int -iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr, +iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -728,7 +728,7 @@ iavf_dev_del_mac_addr(struct rte_eth_dev *dev, uint32_t index) struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct ether_addr *addr; + struct rte_ether_addr *addr; int err; addr = &dev->data->mac_addrs[index]; @@ -940,16 +940,16 @@ iavf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct iavf_adapter *adapter = IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter); - struct ether_addr *perm_addr, *old_addr; + struct rte_ether_addr *perm_addr, *old_addr; int ret; - old_addr = (struct ether_addr *)hw->mac.addr; - perm_addr = (struct ether_addr *)hw->mac.perm_addr; + old_addr = (struct rte_ether_addr *)hw->mac.addr; + perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; if (is_same_ether_addr(mac_addr, old_addr)) return 0; @@ -983,7 +983,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, if (ret) return -EIO; - ether_addr_copy(mac_addr, (struct ether_addr *)hw->mac.addr); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } @@ -1317,9 +1317,10 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) /* If the MAC address is not configured by host, * generate a random one. */ - if (!is_valid_assigned_ether_addr((struct ether_addr *)hw->mac.addr)) + if (!is_valid_assigned_ether_addr( + (struct rte_ether_addr *)hw->mac.addr)) eth_random_addr(hw->mac.addr); - ether_addr_copy((struct ether_addr *)hw->mac.addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* register callback func to eal lib */ diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index da6401d35..a705dbdfc 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -636,7 +636,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) { struct virtchnl_ether_addr_list *list; struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); - struct ether_addr *addr; + struct rte_ether_addr *addr; struct iavf_cmd_info args; int len, err, i, j; int next_begin = 0; @@ -753,7 +753,7 @@ iavf_config_promisc(struct iavf_adapter *adapter, } int -iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct ether_addr *addr, +iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr, bool add) { struct virtchnl_ether_addr_list *list; diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index bbaa7cf39..098570794 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -55,9 +55,9 @@ static int ice_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int ice_macaddr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int ice_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, uint32_t pool); static void ice_macaddr_remove(struct rte_eth_dev *dev, uint32_t index); @@ -481,29 +481,30 @@ ice_init_mac_address(struct rte_eth_dev *dev) struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); if (!is_unicast_ether_addr - ((struct ether_addr *)hw->port_info[0].mac.lan_addr)) { + ((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr)) { PMD_INIT_LOG(ERR, "Invalid MAC address"); return -EINVAL; } - ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.lan_addr, - (struct ether_addr *)hw->port_info[0].mac.perm_addr); + ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, + (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); - dev->data->mac_addrs = rte_zmalloc(NULL, sizeof(struct ether_addr), 0); + dev->data->mac_addrs = + rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0); if (!dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to allocate memory to store mac address"); return -ENOMEM; } /* store it to dev data */ - ether_addr_copy((struct ether_addr *)hw->port_info[0].mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, &dev->data->mac_addrs[0]); return 0; } /* Find out specific MAC filter */ static struct ice_mac_filter * -ice_find_mac_filter(struct ice_vsi *vsi, struct ether_addr *macaddr) +ice_find_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *macaddr) { struct ice_mac_filter *f; @@ -516,7 +517,7 @@ ice_find_mac_filter(struct ice_vsi *vsi, struct ether_addr *macaddr) } static int -ice_add_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) +ice_add_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) { struct ice_fltr_list_entry *m_list_itr = NULL; struct ice_mac_filter *f; @@ -575,7 +576,7 @@ ice_add_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) } static int -ice_remove_mac_filter(struct ice_vsi *vsi, struct ether_addr *mac_addr) +ice_remove_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *mac_addr) { struct ice_fltr_list_entry *m_list_itr = NULL; struct ice_mac_filter *f; @@ -1128,9 +1129,9 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) struct ice_vsi *vsi = NULL; struct ice_vsi_ctx vsi_ctx; int ret; - struct ether_addr broadcast = { + struct rte_ether_addr broadcast = { .addr_bytes = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} }; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 }; uint8_t tc_bitmap = 0x1; @@ -2254,7 +2255,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) } static int ice_macaddr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); @@ -2301,7 +2302,7 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, /* Add a MAC address, and update filters */ static int ice_macaddr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { @@ -2325,7 +2326,7 @@ ice_macaddr_remove(struct rte_eth_dev *dev, uint32_t index) struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct ice_vsi *vsi = pf->main_vsi; struct rte_eth_dev_data *data = dev->data; - struct ether_addr *macaddr; + struct rte_ether_addr *macaddr; int ret; macaddr = &data->mac_addrs[index]; diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index f3ed02e73..4baaf9498 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -130,7 +130,7 @@ struct ice_adapter; * MAC filter structure */ struct ice_mac_filter_info { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; TAILQ_HEAD(ice_mac_filter_list, ice_mac_filter); @@ -247,7 +247,7 @@ struct ice_pf { struct ice_res_pool_info qp_pool; /*Queue pair pool */ struct ice_res_pool_info msix_pool; /* MSIX interrupt pool */ struct rte_eth_dev_data *dev_data; /* Pointer to the device data */ - struct ether_addr dev_addr; /* PF device mac address */ + struct rte_ether_addr dev_addr; /* PF device mac address */ uint64_t flags; /* PF feature flags */ uint16_t hash_lut_size; /* The size of hash lookup table */ uint16_t lan_nb_qp_max; diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h index bfda9d508..566bc7607 100644 --- a/drivers/net/ipn3ke/ipn3ke_ethdev.h +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h @@ -245,7 +245,7 @@ struct ipn3ke_rpst { struct rte_eth_link ori_linfo; struct ipn3ke_tm_internals tm; /**< Private data store of assocaiated physical function */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; /* UUID IDs */ @@ -545,7 +545,7 @@ void ipn3ke_rpst_allmulticast_disable(struct rte_eth_dev *ethdev); int ipn3ke_rpst_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); int ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu); diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index cf3b214a2..aee2aac6c 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -124,7 +124,7 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev) snprintf(attr_name, IPN3KE_RAWDEV_ATTR_LEN_MAX, "%s", "LineSideBaseMAC"); rawdev->dev_ops->attr_get(rawdev, attr_name, &base_mac); - ether_addr_copy((struct ether_addr *)&base_mac, &rpst->mac_addr); + ether_addr_copy((struct rte_ether_addr *)&base_mac, &rpst->mac_addr); ether_addr_copy(&rpst->mac_addr, &dev->data->mac_addrs[0]); dev->data->mac_addrs->addr_bytes[ETHER_ADDR_LEN - 1] = @@ -650,7 +650,7 @@ ipn3ke_rpst_allmulticast_disable(struct rte_eth_dev *ethdev) int ipn3ke_rpst_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ipn3ke_hw *hw = IPN3KE_DEV_PRIVATE_TO_HW(ethdev); struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 975fa474c..4d5fa87af 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -223,11 +223,12 @@ static void ixgbe_dev_interrupt_handler(void *param); static void ixgbe_dev_interrupt_delayed_handler(void *param); static void ixgbe_dev_setup_link_alarm_handler(void *param); -static int ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, - uint32_t index, uint32_t pool); +static int ixgbe_add_rar(struct rte_eth_dev *dev, + struct rte_ether_addr *mac_addr, + uint32_t index, uint32_t pool); static void ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index); static int ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static void ixgbe_dcb_init(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config); static bool is_device_supported(struct rte_eth_dev *dev, struct rte_pci_driver *drv); @@ -268,7 +269,7 @@ static void ixgbevf_dev_allmulticast_disable(struct rte_eth_dev *dev); /* For Eth VMDQ APIs support */ static int ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct - ether_addr * mac_addr, uint8_t on); + rte_ether_addr * mac_addr, uint8_t on); static int ixgbe_uc_all_hash_table_set(struct rte_eth_dev *dev, uint8_t on); static int ixgbe_mirror_rule_set(struct rte_eth_dev *dev, struct rte_eth_mirror_conf *mirror_conf, @@ -284,11 +285,11 @@ static void ixgbe_set_ivar_map(struct ixgbe_hw *hw, int8_t direction, static void ixgbe_configure_msix(struct rte_eth_dev *dev); static int ixgbevf_add_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool); static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index); static int ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int ixgbe_syn_filter_get(struct rte_eth_dev *dev, struct rte_eth_syn_filter *filter); static int ixgbe_syn_filter_handle(struct rte_eth_dev *dev, @@ -315,7 +316,7 @@ static int ixgbe_dev_filter_ctrl(struct rte_eth_dev *dev, static int ixgbevf_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu); static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); static int ixgbe_dev_get_dcb_info(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info); @@ -1222,7 +1223,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->mac.perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ @@ -1530,7 +1531,7 @@ ixgbevf_negotiate_api(struct ixgbe_hw *hw) } static void -generate_random_mac_addr(struct ether_addr *mac_addr) +generate_random_mac_addr(struct rte_ether_addr *mac_addr) { uint64_t random; @@ -1561,7 +1562,8 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) IXGBE_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private); struct ixgbe_hwstrip *hwstrip = IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private); - struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr; + struct rte_ether_addr *perm_addr = + (struct rte_ether_addr *)hw->mac.perm_addr; PMD_INIT_FUNC_TRACE(); @@ -4898,7 +4900,7 @@ ixgbe_dev_rss_reta_query(struct rte_eth_dev *dev, } static int -ixgbe_add_rar(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbe_add_rar(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -4917,7 +4919,7 @@ ixgbe_remove_rar(struct rte_eth_dev *dev, uint32_t index) } static int -ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +ixgbe_set_default_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr) { struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); @@ -5367,7 +5369,7 @@ ixgbe_vt_check(struct ixgbe_hw *hw) } static uint32_t -ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr) +ixgbe_uta_vector(struct ixgbe_hw *hw, struct rte_ether_addr *uc_addr) { uint32_t vector = 0; @@ -5398,8 +5400,8 @@ ixgbe_uta_vector(struct ixgbe_hw *hw, struct ether_addr *uc_addr) } static int -ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr, - uint8_t on) +ixgbe_uc_hash_table_set(struct rte_eth_dev *dev, + struct rte_ether_addr *mac_addr, uint8_t on) { uint32_t vector; uint32_t uta_idx; @@ -6030,7 +6032,7 @@ ixgbe_set_queue_rate_limit(struct rte_eth_dev *dev, } static int -ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, __attribute__((unused)) uint32_t index, __attribute__((unused)) uint32_t pool) { @@ -6042,7 +6044,8 @@ ixgbevf_add_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * operation. Trap this case to avoid exhausting the [very limited] * set of PF resources used to store VF MAC addresses. */ - if (memcmp(hw->mac.perm_addr, mac_addr, sizeof(struct ether_addr)) == 0) + if (memcmp(hw->mac.perm_addr, mac_addr, + sizeof(struct rte_ether_addr)) == 0) return -1; diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes); if (diag != 0) @@ -6062,8 +6065,9 @@ static void ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct ether_addr *perm_addr = (struct ether_addr *) hw->mac.perm_addr; - struct ether_addr *mac_addr; + struct rte_ether_addr *perm_addr = + (struct rte_ether_addr *)hw->mac.perm_addr; + struct rte_ether_addr *mac_addr; uint32_t i; int diag; @@ -6088,7 +6092,8 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) if (is_zero_ether_addr(mac_addr)) continue; /* Skip the permanent MAC address */ - if (memcmp(perm_addr, mac_addr, sizeof(struct ether_addr)) == 0) + if (memcmp(perm_addr, mac_addr, + sizeof(struct rte_ether_addr)) == 0) continue; diag = ixgbevf_set_uc_addr_vf(hw, 2, mac_addr->addr_bytes); if (diag != 0) @@ -6107,7 +6112,8 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) } static int -ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, struct ether_addr *addr) +ixgbevf_set_default_mac_addr(struct rte_eth_dev *dev, + struct rte_ether_addr *addr) { struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private); @@ -6836,13 +6842,13 @@ ixgbe_dev_addr_list_itr(__attribute__((unused)) struct ixgbe_hw *hw, *vmdq = 0; mc_addr = *mc_addr_ptr; - *mc_addr_ptr = (mc_addr + sizeof(struct ether_addr)); + *mc_addr_ptr = (mc_addr + sizeof(struct rte_ether_addr)); return mc_addr; } static int ixgbe_dev_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct ixgbe_hw *hw; diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index fafff6b03..6180c9473 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -463,7 +463,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) { + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/ixgbe_vf_representor.c b/drivers/net/ixgbe/ixgbe_vf_representor.c index 5d2e3e023..2c01f6e33 100644 --- a/drivers/net/ixgbe/ixgbe_vf_representor.c +++ b/drivers/net/ixgbe/ixgbe_vf_representor.c @@ -25,7 +25,7 @@ ixgbe_vf_representor_link_update(struct rte_eth_dev *ethdev, static int ixgbe_vf_representor_mac_addr_set(struct rte_eth_dev *ethdev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ixgbe_vf_representor *representor = ethdev->data->dev_private; @@ -211,7 +211,7 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) vf_data = *IXGBE_DEV_PRIVATE_TO_P_VFDATA( representor->pf_ethdev->data->dev_private); - ethdev->data->mac_addrs = (struct ether_addr *) + ethdev->data->mac_addrs = (struct rte_ether_addr *) vf_data[representor->vf_id].vf_mac_addresses; /* Link state. Inherited from PF */ diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 3a874f9a9..3defba175 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -11,7 +11,7 @@ int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { struct ixgbe_hw *hw; struct ixgbe_vf_info *vfinfo; @@ -35,7 +35,7 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); rar_entry = hw->mac.num_rar_entries - (vf + 1); - if (is_valid_assigned_ether_addr((struct ether_addr *)new_mac)) { + if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, ETHER_ADDR_LEN); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h index 72a941f9d..84c688472 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.h +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h @@ -42,7 +42,7 @@ int rte_pmd_ixgbe_ping_vf(uint16_t port, uint16_t vf); * - (-EINVAL) if *vf* or *mac_addr* is invalid. */ int rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Enable/Disable VF VLAN anti spoofing. diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 1f232e4da..180cfd6c9 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -54,7 +54,7 @@ struct pmd_internals { int stop_thread; int no_request_thread; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; struct pmd_queue rx_queues[KNI_MAX_QUEUE_PER_PORT]; struct pmd_queue tx_queues[KNI_MAX_QUEUE_PER_PORT]; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index c9cabd65a..de234e903 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1835,7 +1835,8 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) 2 + i)); /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *)mac, ð_dev->data->mac_addrs[0]); + ether_addr_copy((struct rte_ether_addr *)mac, + ð_dev->data->mac_addrs[0]); /* enable firmware checksum support for tunnel packets */ lio_enable_hw_tunnel_rx_checksum(eth_dev); diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index fe559c040..460c10f89 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -841,7 +841,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) struct ibv_pd *pd = NULL; struct mlx4_priv *priv = NULL; struct rte_eth_dev *eth_dev = NULL; - struct ether_addr mac; + struct rte_ether_addr mac; char name[RTE_ETH_NAME_MAX_LEN]; /* If port is not enabled, skip. */ diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index e2d184f84..4e9bb9c1a 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -186,7 +186,7 @@ struct mlx4_priv { } mr; LIST_HEAD(, mlx4_rss) rss; /**< Shared targets for Rx flow rules. */ LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */ - struct ether_addr mac[MLX4_MAX_MAC_ADDRESSES]; + struct rte_ether_addr mac[MLX4_MAX_MAC_ADDRESSES]; /**< Configured MAC addresses. Unused entries are zeroed. */ uint32_t mac_mc; /**< Number of trailing multicast entries in mac[]. */ struct mlx4_verbs_alloc_ctx verbs_alloc_ctx; @@ -209,10 +209,10 @@ void mlx4_promiscuous_disable(struct rte_eth_dev *dev); void mlx4_allmulticast_enable(struct rte_eth_dev *dev); void mlx4_allmulticast_disable(struct rte_eth_dev *dev); void mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); -int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +int mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); -int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); -int mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *list, +int mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); +int mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list, uint32_t num); int mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); int mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats); diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 765affc34..6995c14a5 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -463,7 +463,7 @@ mlx4_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +mlx4_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq) { struct mlx4_priv *priv = dev->data->dev_private; @@ -501,7 +501,7 @@ mlx4_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *list, +mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list, uint32_t num) { struct mlx4_priv *priv = dev->data->dev_private; @@ -598,7 +598,7 @@ mlx4_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) * 0 on success, negative errno value otherwise and rte_errno is set. */ int -mlx4_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mlx4_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { return mlx4_mac_addr_add(dev, mac_addr, 0, 0); } diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 1dcdb31a0..78bd452bd 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -1354,7 +1354,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) .type = RTE_FLOW_ACTION_TYPE_END, }, }; - struct ether_addr *rule_mac = ð_spec.dst; + struct rte_ether_addr *rule_mac = ð_spec.dst; rte_be16_t *rule_vlan = (ETH_DEV(priv)->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_VLAN_FILTER) && @@ -1391,7 +1391,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) } } for (i = 0; i != RTE_DIM(priv->mac) + 1; ++i) { - const struct ether_addr *mac; + const struct rte_ether_addr *mac; /* Broadcasts are handled by an extra iteration. */ if (i < RTE_DIM(priv->mac)) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 9f5ec97ec..2798e0e95 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1087,7 +1087,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, unsigned int mprq_max_stride_size_n = 0; unsigned int mprq_min_stride_num_n = 0; unsigned int mprq_max_stride_num_n = 0; - struct ether_addr mac; + struct rte_ether_addr mac; char name[RTE_ETH_NAME_MAX_LEN]; int own_domain_id = 0; uint16_t port_id; diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 3eaaafd5e..80df971e5 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -327,7 +327,7 @@ struct mlx5_priv { struct rte_eth_dev_data *dev_data; /* Pointer to device data. */ struct mlx5_ibv_shared *sh; /* Shared IB device context. */ uint32_t ibv_port; /* IB device port number. */ - struct ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */ + struct rte_ether_addr mac[MLX5_MAX_MAC_ADDRESSES]; /* MAC addresses. */ BITFIELD_DECLARE(mac_own, uint64_t, MLX5_MAX_MAC_ADDRESSES); /* Bit-field of MAC addresses owned by the PMD. */ uint16_t vlan_filter[MLX5_MAX_VLAN_IDS]; /* VLAN filters table. */ @@ -442,11 +442,12 @@ void mlx5_translate_port_name(const char *port_name_in, int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[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 ether_addr *mac, +int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq); -int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); +int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr); int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr); + struct rte_ether_addr *mc_addr_set, + uint32_t nb_mc_addr); /* mlx5_rss.c */ @@ -549,9 +550,9 @@ void mlx5_mp_uninit_secondary(void); /* mlx5_nl.c */ int mlx5_nl_init(int protocol); -int mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +int mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); -int mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +int mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index); void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev); void mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev); diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index cf255ca95..e8560fd42 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1211,13 +1211,13 @@ static int flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, size_t *size, struct rte_flow_error *error) { - struct ether_hdr *eth = NULL; - struct vlan_hdr *vlan = NULL; + struct rte_ether_hdr *eth = NULL; + struct rte_vlan_hdr *vlan = NULL; struct ipv4_hdr *ipv4 = NULL; struct ipv6_hdr *ipv6 = NULL; struct udp_hdr *udp = NULL; - struct vxlan_hdr *vxlan = NULL; - struct vxlan_gpe_hdr *vxlan_gpe = NULL; + struct rte_vxlan_hdr *vxlan = NULL; + struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; struct gre_hdr *gre = NULL; size_t len; size_t temp_size = 0; @@ -1237,10 +1237,10 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, rte_memcpy((void *)&buf[temp_size], items->spec, len); switch (items->type) { case RTE_FLOW_ITEM_TYPE_ETH: - eth = (struct ether_hdr *)&buf[temp_size]; + eth = (struct rte_ether_hdr *)&buf[temp_size]; break; case RTE_FLOW_ITEM_TYPE_VLAN: - vlan = (struct vlan_hdr *)&buf[temp_size]; + vlan = (struct rte_vlan_hdr *)&buf[temp_size]; if (!eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1298,7 +1298,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv6->proto = IPPROTO_UDP; break; case RTE_FLOW_ITEM_TYPE_VXLAN: - vxlan = (struct vxlan_hdr *)&buf[temp_size]; + vxlan = (struct rte_vxlan_hdr *)&buf[temp_size]; if (!udp) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1311,7 +1311,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, RTE_BE32(MLX5_ENCAP_VXLAN_FLAGS); break; case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: - vxlan_gpe = (struct vxlan_gpe_hdr *)&buf[temp_size]; + vxlan_gpe = (struct rte_vxlan_gpe_hdr *)&buf[temp_size]; if (!udp) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index fc04c9d88..789748d08 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -402,7 +402,7 @@ struct mlx5_flow_tcf_context { struct tcf_neigh_rule { LIST_ENTRY(tcf_neigh_rule) next; uint32_t refcnt; - struct ether_addr eth; + struct rte_ether_addr eth; uint16_t mask; union { struct { @@ -475,8 +475,8 @@ struct flow_tcf_vxlan_encap { uint8_t ip_tos; uint8_t ip_ttl_hop; struct { - struct ether_addr dst; - struct ether_addr src; + struct rte_ether_addr dst; + struct rte_ether_addr src; } eth; union { struct { @@ -689,8 +689,8 @@ flow_tcf_pedit_key_set_mac(const struct rte_flow_action *actions, { int idx = p_parser->sel.nkeys; uint32_t off = actions->type == RTE_FLOW_ACTION_TYPE_SET_MAC_SRC ? - offsetof(struct ether_hdr, s_addr) : - offsetof(struct ether_hdr, d_addr); + offsetof(struct rte_ether_hdr, s_addr) : + offsetof(struct rte_ether_hdr, d_addr); const struct rte_flow_action_set_mac *conf = (const struct rte_flow_action_set_mac *)actions->conf; diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index bce026f98..9f6b89a82 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -76,7 +76,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], index); - memset(&dev->data->mac_addrs[index], 0, sizeof(struct ether_addr)); + memset(&dev->data->mac_addrs[index], 0, sizeof(struct rte_ether_addr)); } /** @@ -93,7 +93,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -166,7 +166,7 @@ mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq __rte_unused) { int ret; @@ -195,7 +195,7 @@ mlx5_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { DRV_LOG(DEBUG, "port %u setting primary MAC address", dev->data->port_id); @@ -209,7 +209,7 @@ mlx5_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) */ int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, uint32_t nb_mc_addr) + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { uint32_t i; int ret; diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index 0ff96671f..ce4c93748 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -80,7 +80,7 @@ /* Add/remove MAC address through Netlink */ struct mlx5_nl_mac_addr { - struct ether_addr (*mac)[]; + struct rte_ether_addr (*mac)[]; /**< MAC address handled by the device. */ int mac_n; /**< Number of addresses in the array. */ }; @@ -365,7 +365,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], +mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr (*mac)[], int *mac_n) { struct mlx5_priv *priv = dev->data->dev_private; @@ -424,7 +424,7 @@ mlx5_nl_mac_addr_list(struct rte_eth_dev *dev, struct ether_addr (*mac)[], * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int -mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct rte_ether_addr *mac, int add) { struct mlx5_priv *priv = dev->data->dev_private; @@ -496,7 +496,7 @@ mlx5_nl_mac_addr_modify(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -524,7 +524,7 @@ mlx5_nl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac, * 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, +mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; @@ -542,7 +542,7 @@ mlx5_nl_mac_addr_remove(struct rte_eth_dev *dev, struct ether_addr *mac, void mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) { - struct ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; + struct rte_ether_addr macs[MLX5_MAX_MAC_ADDRESSES]; int macs_n = 0; int i; int ret; @@ -583,7 +583,7 @@ mlx5_nl_mac_addr_flush(struct rte_eth_dev *dev) int i; for (i = MLX5_MAX_MAC_ADDRESSES - 1; i >= 0; --i) { - struct ether_addr *m = &dev->data->mac_addrs[i]; + struct rte_ether_addr *m = &dev->data->mac_addrs[i]; if (BITFIELD_ISSET(priv->mac_own, i)) mlx5_nl_mac_addr_remove(dev, m, i); diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h index 4339aaf33..267663495 100644 --- a/drivers/net/mlx5/mlx5_rxtx.h +++ b/drivers/net/mlx5/mlx5_rxtx.h @@ -784,7 +784,7 @@ txq_mbuf_to_swp(struct mlx5_txq_data *txq, struct rte_mbuf *buf, * in if any of SWP offsets is set. Therefore, all of the L3 offsets * should be set regardless of HW offload. */ - off = buf->outer_l2_len + (vlan ? sizeof(struct vlan_hdr) : 0); + off = buf->outer_l2_len + (vlan ? sizeof(struct rte_vlan_hdr) : 0); offsets[1] = off >> 1; /* Outer L3 offset. */ off += buf->outer_l3_len; if (tunnel == PKT_TX_TUNNEL_UDP) diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c index b7fde3575..69681e296 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -268,7 +268,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) .dst.addr_bytes = "\xff\xff\xff\xff\xff\xff", }; const unsigned int vlan_filter_n = priv->vlan_filter_n; - const struct ether_addr cmp = { + const struct rte_ether_addr cmp = { .addr_bytes = "\x00\x00\x00\x00\x00\x00", }; unsigned int i; @@ -331,7 +331,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev) } /* Add MAC address flows. */ for (i = 0; i != MLX5_MAX_MAC_ADDRESSES; ++i) { - struct ether_addr *mac = &dev->data->mac_addrs[i]; + struct rte_ether_addr *mac = &dev->data->mac_addrs[i]; if (!memcmp(mac, &cmp, sizeof(*mac))) continue; diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index 8923a1634..d539ba6a1 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -617,7 +617,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative error value otherwise. */ static int -mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +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; @@ -650,7 +650,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * MAC address to register. */ static int -mvneta_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mvneta_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct mvneta_priv *priv = dev->data->dev_private; int ret; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index ce52f0901..8647c9b0d 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1102,7 +1102,7 @@ mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) * 0 on success, negative error value otherwise. */ static int -mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +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; @@ -1154,7 +1154,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, * 0 on success, negative error value otherwise. */ static int -mrvl_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +mrvl_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct mrvl_priv *priv = dev->data->dev_private; int ret; diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index ffd1dab9b..738986575 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -989,7 +989,7 @@ mrvl_parse_eth(const struct rte_flow_item *item, struct rte_flow *flow, struct rte_flow_error *error) { const struct rte_flow_item_eth *spec = NULL, *mask = NULL; - struct ether_addr zero; + struct rte_ether_addr zero; int ret; ret = mrvl_parse_init(item, (const void **)&spec, (const void **)&mask, diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 553cb06f6..35503df32 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -292,7 +292,7 @@ hn_dev_allmulticast_disable(struct rte_eth_dev *dev) static int hn_dev_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { /* No filtering on the synthetic path, but can do it on VF */ diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index 7d7b55778..a5850c249 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -108,7 +108,7 @@ static void hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) { uint32_t s = m->pkt_len; - const struct ether_addr *ea; + const struct rte_ether_addr *ea; if (s == 64) { stats->size_bins[1]++; @@ -127,7 +127,7 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) stats->size_bins[7]++; } - ea = rte_pktmbuf_mtod(m, const struct ether_addr *); + ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) stats->broadcast++; diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index de885d898..bf94d90a7 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -131,7 +131,7 @@ struct hn_data { rte_atomic32_t rndis_req_id; uint8_t rndis_resp[256]; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_dev_owner owner; struct rte_intr_handle vf_intr; @@ -213,7 +213,7 @@ void hn_vf_allmulticast_disable(struct rte_eth_dev *dev); void hn_vf_promiscuous_enable(struct rte_eth_dev *dev); void hn_vf_promiscuous_disable(struct rte_eth_dev *dev); int hn_vf_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); int hn_vf_link_update(struct rte_eth_dev *dev, diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index b980bb8a4..f1be7e22f 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -32,12 +32,12 @@ /* Search for VF with matching MAC address, return port id */ static int hn_vf_match(const struct rte_eth_dev *dev) { - const struct ether_addr *mac = dev->data->mac_addrs; + const struct rte_ether_addr *mac = dev->data->mac_addrs; int i; RTE_ETH_FOREACH_DEV(i) { const struct rte_eth_dev *vf_dev = &rte_eth_devices[i]; - const struct ether_addr *vf_mac = vf_dev->data->mac_addrs; + const struct rte_ether_addr *vf_mac = vf_dev->data->mac_addrs; if (vf_dev == dev) continue; @@ -400,7 +400,7 @@ void hn_vf_promiscuous_disable(struct rte_eth_dev *dev) } int hn_vf_mc_addr_list(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct hn_data *hv = dev->data->dev_private; diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c index be7cced01..679af6eb2 100644 --- a/drivers/net/nfb/nfb_ethdev.c +++ b/drivers/net/nfb/nfb_ethdev.c @@ -20,7 +20,7 @@ /** * Default MAC addr */ -static const struct ether_addr eth_addr = { +static const struct rte_ether_addr eth_addr = { .addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 } }; @@ -352,7 +352,7 @@ nfb_eth_dev_set_link_down(struct rte_eth_dev *dev) */ static int nfb_eth_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr) + struct rte_ether_addr *mac_addr) { unsigned int i; uint64_t mac = 0; @@ -418,7 +418,7 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) data->dev_private; struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); struct rte_pci_addr *pci_addr = &pci_dev->addr; - struct ether_addr eth_addr_init; + struct rte_ether_addr eth_addr_init; RTE_LOG(INFO, PMD, "Initializing NFB device (" PCI_PRI_FMT ")\n", pci_addr->domain, pci_addr->bus, pci_addr->devid, @@ -464,7 +464,7 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) nfb_eth_link_update(dev, 0); /* Allocate space for one mac address */ - data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr), + data->mac_addrs = rte_zmalloc(data->name, sizeof(struct rte_ether_addr), RTE_CACHE_LINE_SIZE); if (data->mac_addrs == NULL) { RTE_LOG(ERR, PMD, "Could not alloc space for MAC address!\n"); diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 9394309ac..95c2be127 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -119,7 +119,7 @@ static int nfp_net_rss_reta_write(struct rte_eth_dev *dev, static int nfp_net_rss_hash_write(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf); static int nfp_set_mac_addr(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE(_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) @@ -553,7 +553,7 @@ nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) } int -nfp_set_mac_addr(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct nfp_net_hw *hw; uint32_t update, ctrl; @@ -2962,7 +2962,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_vf_read_mac(hw); } - if (!is_valid_assigned_ether_addr((struct ether_addr *)&hw->mac_addr)) { + if (!is_valid_assigned_ether_addr( + (struct rte_ether_addr *)&hw->mac_addr)) { PMD_INIT_LOG(INFO, "Using random mac address for port %d", port); /* Using random mac addresses for VFs */ @@ -2971,7 +2972,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) } /* Copying mac address to DPDK eth_dev struct */ - ether_addr_copy((struct ether_addr *)hw->mac_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 159c1c1fd..7683511cf 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -73,7 +73,7 @@ struct pmd_internals { struct null_queue rx_null_queues[RTE_MAX_QUEUES_PER_PORT]; struct null_queue tx_null_queues[RTE_MAX_QUEUES_PER_PORT]; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; /** Bit mask of RSS offloads, the bit offset also means flow type */ uint64_t flow_type_rss_offloads; @@ -467,7 +467,7 @@ eth_rss_hash_conf_get(struct rte_eth_dev *dev, static int eth_mac_address_set(__rte_unused struct rte_eth_dev *dev, - __rte_unused struct ether_addr *addr) + __rte_unused struct rte_ether_addr *addr) { return 0; } diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c index 046e12986..643479254 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -555,7 +555,7 @@ octeontx_dev_stats_reset(struct rte_eth_dev *dev) static int octeontx_dev_default_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *addr) + struct rte_ether_addr *addr) { struct octeontx_nic *nic = octeontx_pmd_priv(dev); int ret; diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 353538f16..7655b3a7a 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -78,7 +78,7 @@ struct pmd_internals { struct pcap_rx_queue rx_queue[RTE_PMD_PCAP_MAX_QUEUES]; struct pcap_tx_queue tx_queue[RTE_PMD_PCAP_MAX_QUEUES]; char devargs[ETH_PCAP_ARG_MAXLEN]; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; int if_index; int single_iface; int phy_mac; @@ -953,7 +953,7 @@ pmd_init_internals(struct rte_vdev_device *vdev, * derived from: 'locally administered':'p':'c':'a':'p':'iface_idx' * where the middle 4 characters are converted to hex. */ - (*internals)->eth_addr = (struct ether_addr) { + (*internals)->eth_addr = (struct rte_ether_addr) { .addr_bytes = { 0x02, 0x70, 0x63, 0x61, 0x70, iface_idx++ } }; (*internals)->phy_mac = 0; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index b2fd2fd90..a72d46657 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -559,9 +559,9 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); struct qede_ucast_entry *tmp = NULL; struct qede_ucast_entry *u; - struct ether_addr *mac_addr; + struct rte_ether_addr *mac_addr; - mac_addr = (struct ether_addr *)ucast->mac; + mac_addr = (struct rte_ether_addr *)ucast->mac; if (add) { SLIST_FOREACH(tmp, &qdev->uc_list_head, list) { if ((memcmp(mac_addr, &tmp->mac, @@ -605,8 +605,9 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } static int -qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, - uint32_t mc_addrs_num) +qede_add_mcast_filters(struct rte_eth_dev *eth_dev, + struct rte_ether_addr *mc_addrs, + uint32_t mc_addrs_num) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); @@ -629,7 +630,7 @@ qede_add_mcast_filters(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, mcast.num_mc_addrs = mc_addrs_num; mcast.opcode = ECORE_FILTER_ADD; for (i = 0; i < mc_addrs_num; i++) - ether_addr_copy(&mc_addrs[i], (struct ether_addr *) + ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) &mcast.mac[i]); rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { @@ -654,7 +655,8 @@ static int qede_del_mcast_filters(struct rte_eth_dev *eth_dev) mcast.opcode = ECORE_FILTER_REMOVE; j = 0; SLIST_FOREACH(tmp, &qdev->mc_list_head, list) { - ether_addr_copy(&tmp->mac, (struct ether_addr *)&mcast.mac[j]); + ether_addr_copy(&tmp->mac, + (struct rte_ether_addr *)&mcast.mac[j]); j++; } rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); @@ -701,7 +703,7 @@ qede_mac_int_ops(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, } static int -qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, +qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, __rte_unused uint32_t index, __rte_unused uint32_t pool) { struct ecore_filter_ucast ucast; @@ -713,7 +715,7 @@ qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr, qede_set_ucast_cmn_params(&ucast); ucast.opcode = ECORE_FILTER_ADD; ucast.type = ECORE_FILTER_MAC; - ether_addr_copy(mac_addr, (struct ether_addr *)&ucast.mac); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); re = (int)qede_mac_int_ops(eth_dev, &ucast, 1); return re; } @@ -742,13 +744,13 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) /* Use the index maintained by rte */ ether_addr_copy(ð_dev->data->mac_addrs[index], - (struct ether_addr *)&ucast.mac); + (struct rte_ether_addr *)&ucast.mac); qede_mac_int_ops(eth_dev, &ucast, false); } static int -qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct ether_addr *mac_addr) +qede_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); @@ -1757,8 +1759,9 @@ static void qede_allmulticast_disable(struct rte_eth_dev *eth_dev) } static int -qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, struct ether_addr *mc_addrs, - uint32_t mc_addrs_num) +qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, + struct rte_ether_addr *mc_addrs, + uint32_t mc_addrs_num) { struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); @@ -2549,7 +2552,7 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) } if (!is_vf) { - ether_addr_copy((struct ether_addr *)edev->hwfns[0]. + ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. hw_info.hw_mac_addr, ð_dev->data->mac_addrs[0]); ether_addr_copy(ð_dev->data->mac_addrs[0], @@ -2565,8 +2568,9 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) &is_mac_forced); if (is_mac_exist) { DP_INFO(edev, "VF macaddr received from PF\n"); - ether_addr_copy((struct ether_addr *)&vf_mac, - ð_dev->data->mac_addrs[0]); + ether_addr_copy( + (struct rte_ether_addr *)&vf_mac, + ð_dev->data->mac_addrs[0]); ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); } else { diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index c06274d94..d0e7c70be 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -140,12 +140,12 @@ struct qede_vlan_entry { }; struct qede_mcast_entry { - struct ether_addr mac; + struct rte_ether_addr mac; SLIST_ENTRY(qede_mcast_entry) list; }; struct qede_ucast_entry { - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t vlan; uint16_t vni; SLIST_ENTRY(qede_ucast_entry) list; @@ -228,7 +228,7 @@ struct qede_dev { SLIST_HEAD(vlan_list_head, qede_vlan_entry)vlan_list_head; uint16_t configured_vlans; bool accept_any_vlan; - struct ether_addr primary_mac; + struct rte_ether_addr primary_mac; SLIST_HEAD(mc_list_head, qede_mcast_entry) mc_list_head; uint16_t num_mc_addr; SLIST_HEAD(uc_list_head, qede_ucast_entry) uc_list_head; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 7aeef700d..792b9efb4 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -465,8 +465,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; - len = 2 * sizeof(struct ether_addr); - raw_pkt += 2 * sizeof(struct ether_addr); + len = 2 * sizeof(struct rte_ether_addr); + raw_pkt += 2 * sizeof(struct rte_ether_addr); ether_type = (uint16_t *)raw_pkt; raw_pkt += sizeof(uint16_t); len += sizeof(uint16_t); diff --git a/drivers/net/qede/qede_if.h b/drivers/net/qede/qede_if.h index ee5e54c19..b840c743c 100644 --- a/drivers/net/qede/qede_if.h +++ b/drivers/net/qede/qede_if.h @@ -59,7 +59,7 @@ struct qed_dev_eth_info { uint8_t num_queues; uint8_t num_tc; - struct ether_addr port_mac; + struct rte_ether_addr port_mac; uint16_t num_vlan_filters; uint32_t num_mac_filters; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 27bac0995..0e8a3675b 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -950,23 +950,23 @@ static inline uint8_t qede_check_notunn_csum_l4(uint16_t flag) static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - struct vlan_hdr *vlan_hdr; + struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; uint16_t len; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); - len = sizeof(struct ether_hdr); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); + len = sizeof(struct rte_ether_hdr); ethertype = rte_cpu_to_be_16(eth_hdr->ether_type); /* Note: Valid only if VLAN stripping is disabled */ if (ethertype == ETHER_TYPE_VLAN) { vlan_tagged = 1; - vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - len += sizeof(struct vlan_hdr); + 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); } @@ -1153,7 +1153,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; calc_csum = rte_ipv4_cksum(ip); diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index ab963a03c..cae63a7f1 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -51,7 +51,7 @@ struct pmd_internals { struct ring_queue rx_ring_queues[RTE_PMD_RING_MAX_RX_RINGS]; struct ring_queue tx_ring_queues[RTE_PMD_RING_MAX_TX_RINGS]; - struct ether_addr address; + struct rte_ether_addr address; enum dev_action action; }; @@ -218,7 +218,7 @@ eth_mac_addr_remove(struct rte_eth_dev *dev __rte_unused, static int eth_mac_addr_add(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mac_addr __rte_unused, + struct rte_ether_addr *mac_addr __rte_unused, uint32_t index __rte_unused, uint32_t vmdq __rte_unused) { diff --git a/drivers/net/sfc/sfc.h b/drivers/net/sfc/sfc.h index ecd20e546..dde25c553 100644 --- a/drivers/net/sfc/sfc.h +++ b/drivers/net/sfc/sfc.h @@ -134,7 +134,7 @@ struct sfc_port { boolean_t promisc; boolean_t allmulti; - struct ether_addr default_mac_addr; + struct rte_ether_addr default_mac_addr; unsigned int max_mcast_addrs; unsigned int nb_mcast_addrs; diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index a007d4564..fadcdb56a 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -969,12 +969,12 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) return -rc; } static int -sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); struct sfc_port *port = &sa->port; - struct ether_addr *old_addr = &dev->data->mac_addrs[0]; + struct rte_ether_addr *old_addr = &dev->data->mac_addrs[0]; int rc = 0; sfc_adapter_lock(sa); @@ -1053,8 +1053,8 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) static int -sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set, - uint32_t nb_mc_addr) +sfc_set_mc_addr_list(struct rte_eth_dev *dev, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev); struct sfc_port *port = &sa->port; @@ -2053,7 +2053,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) struct sfc_adapter *sa; int rc; const efx_nic_cfg_t *encp; - const struct ether_addr *from; + const struct rte_ether_addr *from; sfc_register_dp(); @@ -2125,7 +2125,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) * The arguments are really reverse order in comparison to * Linux kernel. Copy from NIC config to Ethernet device data. */ - from = (const struct ether_addr *)(encp->enc_mac_addr); + from = (const struct rte_ether_addr *)(encp->enc_mac_addr); ether_addr_copy(from, &dev->data->mac_addrs[0]); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 1709dba4e..8de5f0c60 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -227,7 +227,7 @@ sfc_port_start(struct sfc_adapter *sa) goto fail_mac_pdu_set; if (!sfc_sa2shared(sa)->isolated) { - struct ether_addr *addr = &port->default_mac_addr; + struct rte_ether_addr *addr = &port->default_mac_addr; sfc_log_init(sa, "set MAC address"); rc = efx_mac_addr_set(sa->nic, addr->addr_bytes); @@ -386,7 +386,7 @@ sfc_port_attach(struct sfc_adapter *sa) { struct sfc_port *port = &sa->port; const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic); - const struct ether_addr *from; + const struct rte_ether_addr *from; uint32_t mac_nstats; size_t mac_stats_size; long kvarg_stats_update_period_ms; @@ -401,7 +401,7 @@ sfc_port_attach(struct sfc_adapter *sa) port->flow_ctrl_autoneg = B_TRUE; RTE_BUILD_BUG_ON(sizeof(encp->enc_mac_addr) != sizeof(*from)); - from = (const struct ether_addr *)(encp->enc_mac_addr); + from = (const struct rte_ether_addr *)(encp->enc_mac_addr); ether_addr_copy(from, &port->default_mac_addr); port->max_mcast_addrs = EFX_MAC_MULTICAST_LIST_MAX; diff --git a/drivers/net/softnic/parser.c b/drivers/net/softnic/parser.c index a8688a21e..7ea6eb4fa 100644 --- a/drivers/net/softnic/parser.c +++ b/drivers/net/softnic/parser.c @@ -528,13 +528,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -568,7 +568,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -596,15 +596,15 @@ softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -softnic_parse_mac_addr(const char *token, struct ether_addr *addr) +softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; } diff --git a/drivers/net/softnic/parser.h b/drivers/net/softnic/parser.h index 1ee3f82a7..6f408b248 100644 --- a/drivers/net/softnic/parser.h +++ b/drivers/net/softnic/parser.h @@ -49,7 +49,7 @@ int softnic_parse_hex_string(char *src, uint8_t *dst, uint32_t *size); int softnic_parse_ipv4_addr(const char *token, struct in_addr *ipv4); int softnic_parse_ipv6_addr(const char *token, struct in6_addr *ipv6); -int softnic_parse_mac_addr(const char *token, struct ether_addr *addr); +int softnic_parse_mac_addr(const char *token, struct rte_ether_addr *addr); int softnic_parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 32b001fd3..4bda2f2b0 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -339,7 +339,7 @@ pmd_free(struct pmd_internals *p) rte_free(p); } -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = {0}, }; diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 88448eff6..43a66432a 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -105,7 +105,7 @@ struct szedata2_tx_queue { int szedata2_logtype_init; int szedata2_logtype_driver; -static struct ether_addr eth_addr = { +static struct rte_ether_addr eth_addr = { .addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 } }; @@ -1332,7 +1332,7 @@ eth_tx_queue_setup(struct rte_eth_dev *dev, static int eth_mac_addr_set(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mac_addr __rte_unused) + struct rte_ether_addr *mac_addr __rte_unused) { return 0; } @@ -1514,7 +1514,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi) eth_link_update(dev, 0); /* Allocate space for one mac address */ - data->mac_addrs = rte_zmalloc(data->name, sizeof(struct ether_addr), + data->mac_addrs = rte_zmalloc(data->name, sizeof(struct rte_ether_addr), RTE_CACHE_LINE_SIZE); if (data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Could not alloc space for MAC address!"); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 47a2b68f1..71be763d6 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -261,7 +261,7 @@ tap_verify_csum(struct rte_mbuf *mbuf) uint32_t l2 = mbuf->packet_type & RTE_PTYPE_L2_MASK; uint32_t l3 = mbuf->packet_type & RTE_PTYPE_L3_MASK; uint32_t l4 = mbuf->packet_type & RTE_PTYPE_L4_MASK; - unsigned int l2_len = sizeof(struct ether_hdr); + unsigned int l2_len = sizeof(struct rte_ether_hdr); unsigned int l3_len; uint16_t cksum = 0; void *l3_hdr; @@ -1150,7 +1150,7 @@ tap_allmulti_disable(struct rte_eth_dev *dev) } static int -tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct pmd_internals *pmd = dev->data->dev_private; enum ioctl_mode mode = LOCAL_ONLY; @@ -1172,15 +1172,16 @@ tap_mac_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY); if (ret < 0) return ret; - if (is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data, + if (is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) return 0; /* Check the current MAC address on the remote */ ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY); if (ret < 0) return ret; - if (!is_same_ether_addr((struct ether_addr *)&ifr.ifr_hwaddr.sa_data, - mac_addr)) + if (!is_same_ether_addr( + (struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, + 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); @@ -1458,7 +1459,7 @@ tap_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) static int tap_set_mc_addr_list(struct rte_eth_dev *dev __rte_unused, - struct ether_addr *mc_addr_set __rte_unused, + struct rte_ether_addr *mc_addr_set __rte_unused, uint32_t nb_mc_addr __rte_unused) { /* @@ -1682,7 +1683,7 @@ static const char *tuntap_types[ETH_TUNTAP_TYPE_MAX] = { static int eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, - char *remote_iface, struct ether_addr *mac_addr, + char *remote_iface, struct rte_ether_addr *mac_addr, enum rte_tuntap_type type) { int numa_node = rte_socket_id(); @@ -1957,7 +1958,7 @@ set_remote_iface(const char *key __rte_unused, return 0; } -static int parse_user_mac(struct ether_addr *user_mac, +static int parse_user_mac(struct rte_ether_addr *user_mac, const char *value) { unsigned int index = 0; @@ -1985,7 +1986,7 @@ set_mac_type(const char *key __rte_unused, const char *value, void *extra_args) { - struct ether_addr *user_mac = extra_args; + struct rte_ether_addr *user_mac = extra_args; if (!value) return 0; @@ -2198,7 +2199,7 @@ rte_pmd_tap_probe(struct rte_vdev_device *dev) int speed; char tap_name[RTE_ETH_NAME_MAX_LEN]; char remote_iface[RTE_ETH_NAME_MAX_LEN]; - struct ether_addr user_mac = { .addr_bytes = {0} }; + struct rte_ether_addr user_mac = { .addr_bytes = {0} }; struct rte_eth_dev *eth_dev; int tap_devices_count_increased = 0; diff --git a/drivers/net/tap/rte_eth_tap.h b/drivers/net/tap/rte_eth_tap.h index dc3579ac0..8d6d53dc0 100644 --- a/drivers/net/tap/rte_eth_tap.h +++ b/drivers/net/tap/rte_eth_tap.h @@ -70,8 +70,8 @@ struct pmd_internals { char remote_iface[RTE_ETH_NAME_MAX_LEN]; /* Remote netdevice name */ char name[RTE_ETH_NAME_MAX_LEN]; /* Internal Tap device name */ int type; /* Type field - TUN|TAP */ - struct ether_addr eth_addr; /* Mac address of the device port */ - struct ifreq remote_initial_flags; /* Remote netdevice flags on init */ + struct rte_ether_addr eth_addr; /* Mac address of the device port */ + struct ifreq remote_initial_flags;/* Remote netdevice flags on init */ int remote_if_index; /* remote netdevice IF_INDEX */ int if_index; /* IF_INDEX for the port */ int ioctl_sock; /* socket for ioctl calls */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index 532e8838f..2b1dba15b 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -37,7 +37,7 @@ #define KEY_IDX 0 #define BPF_MAP_ID_KEY 1 -struct vlan_hdr { +struct rte_vlan_hdr { __be16 proto; __be16 tci; }; @@ -141,12 +141,12 @@ rss_l3_l4(struct __sk_buff *skb) /* Get correct proto for 802.1ad */ if (skb->vlan_present && skb->vlan_proto == htons(ETH_P_8021AD)) { - if (data + ETH_ALEN * 2 + sizeof(struct vlan_hdr) + + if (data + ETH_ALEN * 2 + sizeof(struct rte_vlan_hdr) + sizeof(proto) > data_end) return TC_ACT_OK; proto = *(__u16 *)(data + ETH_ALEN * 2 + - sizeof(struct vlan_hdr)); - off += sizeof(struct vlan_hdr); + sizeof(struct rte_vlan_hdr)); + off += sizeof(struct rte_vlan_hdr); } if (proto == htons(ETH_P_IP)) { diff --git a/drivers/net/thunderx/base/nicvf_plat.h b/drivers/net/thunderx/base/nicvf_plat.h index 6de07c708..3f0519593 100644 --- a/drivers/net/thunderx/base/nicvf_plat.h +++ b/drivers/net/thunderx/base/nicvf_plat.h @@ -46,6 +46,9 @@ #include <rte_ether.h> #define NICVF_MAC_ADDR_SIZE ETHER_ADDR_LEN +/* Ethernet */ +#define ether_addr_copy(x, y) memcpy(y, x, ETHER_ADDR_LEN) + #include <rte_io.h> #define nicvf_addr_write(addr, val) rte_write64_relaxed((val), (void *)(addr)) #define nicvf_addr_read(addr) rte_read64_relaxed((void *)(addr)) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 879d88998..ec2087924 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2179,10 +2179,10 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) ret = -ENOMEM; goto alarm_fail; } - if (is_zero_ether_addr((struct ether_addr *)nic->mac_addr)) + if (is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) eth_random_addr(&nic->mac_addr[0]); - ether_addr_copy((struct ether_addr *)nic->mac_addr, + ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, ð_dev->data->mac_addrs[0]); ret = nicvf_mbox_set_mac_addr(nic, nic->mac_addr); diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index 801f54c96..ef02fdcdd 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -68,7 +68,7 @@ struct vdev_netvsc_ctx { char devargs[256]; /**< Fail-safe device arguments. */ char if_name[IF_NAMESIZE]; /**< NetVSC netdevice name. */ unsigned int if_index; /**< NetVSC netdevice index. */ - struct ether_addr if_addr; /**< NetVSC MAC address. */ + struct rte_ether_addr if_addr; /**< NetVSC MAC address. */ int pipe[2]; /**< Fail-safe communication pipe. */ char yield[256]; /**< PCI sub-device arguments. */ }; @@ -157,7 +157,7 @@ vdev_netvsc_iface_is_netvsc(const struct if_nameindex *iface) */ static int vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap), int is_netvsc, ...) { struct if_nameindex *iface = if_nameindex(); @@ -178,7 +178,7 @@ vdev_netvsc_foreach_iface(int (*func)(const struct if_nameindex *iface, for (i = 0; iface[i].if_name; ++i) { int is_netvsc_ret; struct ifreq req; - struct ether_addr eth_addr; + struct rte_ether_addr eth_addr; va_list ap; is_netvsc_ret = vdev_netvsc_iface_is_netvsc(&iface[i]) ? 1 : 0; @@ -368,7 +368,7 @@ vdev_netvsc_sysfs_readlink(char *buf, size_t size, const char *if_name, */ static int vdev_netvsc_device_probe(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap) { struct vdev_netvsc_ctx *ctx = va_arg(ap, struct vdev_netvsc_ctx *); @@ -507,7 +507,7 @@ vdev_netvsc_alarm(__rte_unused void *arg) */ static int vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, - const struct ether_addr *eth_addr, + const struct rte_ether_addr *eth_addr, va_list ap) { const char *name = va_arg(ap, const char *); @@ -527,7 +527,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, if (!strcmp(pair->value, iface->if_name)) break; } else if (!strcmp(pair->key, VDEV_NETVSC_ARG_MAC)) { - struct ether_addr tmp; + struct rte_ether_addr tmp; if (sscanf(pair->value, "%" SCNx8 ":%" SCNx8 ":%" SCNx8 ":" diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index b2cda0483..6705e90db 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -43,7 +43,7 @@ static const char *valid_arguments[] = { NULL }; -static struct ether_addr base_eth_addr = { +static struct rte_ether_addr base_eth_addr = { .addr_bytes = { 0x56 /* V */, 0x48 /* H */, @@ -325,10 +325,10 @@ static inline void vhost_count_multicast_broadcast(struct vhost_queue *vq, struct rte_mbuf *mbuf) { - struct ether_addr *ea = NULL; + struct rte_ether_addr *ea = NULL; struct vhost_stats *pstats = &vq->stats; - ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *); + ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) pstats->xstats[VHOST_BROADCAST_PKT]++; @@ -1206,7 +1206,7 @@ eth_dev_vhost_create(struct rte_vdev_device *dev, char *iface_name, struct rte_eth_dev_data *data; struct pmd_internal *internal = NULL; struct rte_eth_dev *eth_dev = NULL; - struct ether_addr *eth_addr = NULL; + struct rte_ether_addr *eth_addr = NULL; struct rte_vhost_vring_state *vring_state = NULL; struct internal_list *list = NULL; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index d25c08f0a..9b99bf3eb 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -65,11 +65,11 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev); static int virtio_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on); static int virtio_mac_addr_add(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index); static int virtio_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static int virtio_intr_disable(struct rte_eth_dev *dev); @@ -1142,11 +1142,11 @@ virtio_mac_table_set(struct virtio_hw *hw, } static int -virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, +virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq __rte_unused) { struct virtio_hw *hw = dev->data->dev_private; - const struct ether_addr *addrs = dev->data->mac_addrs; + const struct rte_ether_addr *addrs = dev->data->mac_addrs; unsigned int i; struct virtio_net_ctrl_mac *uc, *mc; @@ -1161,7 +1161,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct ether_addr *mac_addr, mc->entries = 0; for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { - const struct ether_addr *addr + const struct rte_ether_addr *addr = (i == index) ? mac_addr : addrs + i; struct virtio_net_ctrl_mac *tbl = is_multicast_ether_addr(addr) ? mc : uc; @@ -1176,7 +1176,7 @@ static void virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct virtio_hw *hw = dev->data->dev_private; - struct ether_addr *addrs = dev->data->mac_addrs; + struct rte_ether_addr *addrs = dev->data->mac_addrs; struct virtio_net_ctrl_mac *uc, *mc; unsigned int i; @@ -1204,7 +1204,7 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) } static int -virtio_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +virtio_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct virtio_hw *hw = dev->data->dev_private; @@ -1395,7 +1395,7 @@ virtio_notify_peers(struct rte_eth_dev *dev) return; rarp_mbuf = rte_net_make_rarp_packet(rxvq->mpool, - (struct ether_addr *)hw->mac_addr); + (struct rte_ether_addr *)hw->mac_addr); if (rarp_mbuf == NULL) { PMD_DRV_LOG(ERR, "failed to make RARP packet."); return; @@ -1662,7 +1662,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Copy the permanent MAC address to: virtio_hw */ virtio_get_hwaddr(hw); - ether_addr_copy((struct ether_addr *) hw->mac_addr, + ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 8c56f238f..fa9c855e8 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1092,7 +1092,7 @@ static inline void virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) { uint32_t s = mbuf->pkt_len; - struct ether_addr *ea; + struct rte_ether_addr *ea; stats->bytes += s; @@ -1113,7 +1113,7 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) stats->size_bins[7]++; } - ea = rte_pktmbuf_mtod(mbuf, struct ether_addr *); + ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); if (is_multicast_ether_addr(ea)) { if (is_broadcast_ether_addr(ea)) stats->broadcast++; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index f54536b49..3ad1e9e09 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -92,7 +92,7 @@ static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vid, int on); static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); static int vmxnet3_mac_addr_set(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); static void vmxnet3_interrupt_handler(void *param); int vmxnet3_logtype_init; @@ -316,7 +316,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct ether_addr *) hw->perm_addr, + ether_addr_copy((struct rte_ether_addr *)hw->perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -1205,11 +1205,11 @@ vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev) } static int -vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr) +vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct vmxnet3_hw *hw = dev->data->dev_private; - ether_addr_copy(mac_addr, (struct ether_addr *)(hw->perm_addr)); + ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); vmxnet3_write_mac(hw, mac_addr->addr_bytes); return 0; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 4867a64f3..b691141b5 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -676,7 +676,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, ptr = rte_pktmbuf_mtod(rxm, char *); slen = rte_pktmbuf_data_len(rxm); - hlen = sizeof(struct ether_hdr); + hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) @@ -703,7 +703,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) return hw->mtu - hlen - sizeof(struct tcp_hdr) + - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); tcp_hdr = (struct tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; @@ -712,7 +712,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, return (rte_pktmbuf_pkt_len(rxm) - hlen + rxm->udata64 - 1) / rxm->udata64; else - return hw->mtu - hlen + sizeof(struct ether_hdr); + return hw->mtu - hlen + sizeof(struct rte_ether_hdr); } /* Receive side checksum and other offloads */ diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index d68c06aef..2675a16f0 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -273,7 +273,7 @@ signal_handler(int signum) } static void -print_mac(unsigned int portid, struct ether_addr *bbdev_ports_eth_address) +print_mac(unsigned int portid, struct rte_ether_addr *bbdev_ports_eth_address) { printf("Port %u, MAC address: %02X:%02X:%02X:%02X:%02X:%02X\n\n", (unsigned int) portid, @@ -341,14 +341,14 @@ check_port_link_status(uint16_t port_id) static inline void add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst) { - struct ether_hdr *eth_from; - struct ether_hdr *eth_to; + struct rte_ether_hdr *eth_from; + struct rte_ether_hdr *eth_to; - eth_from = rte_pktmbuf_mtod(pkt_src, struct ether_hdr *); - eth_to = rte_pktmbuf_mtod(pkt_dst, struct ether_hdr *); + eth_from = rte_pktmbuf_mtod(pkt_src, struct rte_ether_hdr *); + eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *); /* copy header */ - rte_memcpy(eth_to, eth_from, sizeof(struct ether_hdr)); + rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); } static inline void @@ -377,7 +377,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, for (i = 0; i < num_pkts; ++i) { uint16_t pkt_data_len = rte_pktmbuf_data_len(mbufs[i]) - - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* Resize the packet if needed */ if (pkt_data_len < ncb) { @@ -395,7 +395,8 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, for (l = start_bit_idx; l < start_bit_idx + d; ++l) { uint8_t *data = rte_pktmbuf_mtod_offset( mbufs[i], uint8_t *, - sizeof(struct ether_hdr) + (l >> 3)); + sizeof(struct rte_ether_hdr) + + (l >> 3)); if (*data & (0x80 >> (l & 7))) temp_buf[out_idx] = LLR_1_BIT; else @@ -410,7 +411,7 @@ transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, } rte_memcpy(rte_pktmbuf_mtod_offset(mbufs[i], uint8_t *, - sizeof(struct ether_hdr)), temp_buf, ncb); + sizeof(struct rte_ether_hdr)), temp_buf, ncb); } } @@ -423,9 +424,9 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts) struct rte_mbuf *in = out->userdata; if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *, - sizeof(struct ether_hdr)), + sizeof(struct rte_ether_hdr)), rte_pktmbuf_mtod_offset(out, uint8_t *, - sizeof(struct ether_hdr)), + sizeof(struct rte_ether_hdr)), K / 8 - CRC_24B_LEN)) printf("Input and output buffers are not equal!\n"); } @@ -439,7 +440,7 @@ initialize_ports(struct app_config_params *app_params, uint16_t port_id = app_params->port_id; uint16_t q; /* ethernet addresses of ports */ - struct ether_addr bbdev_port_eth_addr; + struct rte_ether_addr bbdev_port_eth_addr; /* initialize ports */ printf("\nInitializing port %u...\n", app_params->port_id); @@ -707,14 +708,14 @@ run_encoding(struct lcore_conf *lcore_conf) char *data; const uint16_t pkt_data_len = rte_pktmbuf_data_len(rx_pkts_burst[i]) - - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* save input mbuf pointer for later comparison */ enc_out_pkts[i]->userdata = rx_pkts_burst[i]; /* copy ethernet header */ rte_pktmbuf_reset(enc_out_pkts[i]); data = rte_pktmbuf_append(enc_out_pkts[i], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); if (data == NULL) { printf( "Not enough space for ethernet header in encoder output mbuf\n"); @@ -728,7 +729,7 @@ run_encoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_enc.input.data = rx_pkts_burst[i]; bbdev_ops_burst[i]->turbo_enc.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); /* Encoder will attach the CRC24B, adjust the length */ bbdev_ops_burst[i]->turbo_enc.input.length = in_data_len; @@ -746,7 +747,7 @@ run_encoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_enc.output.data = enc_out_pkts[i]; bbdev_ops_burst[i]->turbo_enc.output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); } /* Enqueue packets on BBDevice */ @@ -834,15 +835,15 @@ run_decoding(struct lcore_conf *lcore_conf) bbdev_ops_burst[i]->turbo_dec.input.data = recv_pkts_burst[i]; bbdev_ops_burst[i]->turbo_dec.input.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); bbdev_ops_burst[i]->turbo_dec.input.length = rte_pktmbuf_data_len(recv_pkts_burst[i]) - - sizeof(struct ether_hdr); + - sizeof(struct rte_ether_hdr); bbdev_ops_burst[i]->turbo_dec.hard_output.data = recv_pkts_burst[i]; bbdev_ops_burst[i]->turbo_dec.hard_output.offset = - sizeof(struct ether_hdr); + sizeof(struct rte_ether_hdr); } /* Enqueue packets on BBDevice */ diff --git a/examples/bond/main.c b/examples/bond/main.c index 21a67e531..38d1b40c2 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -201,7 +201,7 @@ slave_port_init(uint16_t portid, struct rte_mempool *mbuf_pool) "Start port %d failed (res=%d)", portid, retval); - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(portid, &addr); printf("Port %u MAC: ", portid); @@ -291,7 +291,7 @@ bond_port_init(struct rte_mempool *mbuf_pool) rte_eth_promiscuous_enable(BOND_PORT); - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(BOND_PORT, &addr); printf("Port %u MAC: ", (unsigned)BOND_PORT); @@ -300,21 +300,22 @@ bond_port_init(struct rte_mempool *mbuf_pool) } static inline size_t -get_vlan_offset(struct ether_hdr *eth_hdr, uint16_t *proto) +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) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = + (struct rte_vlan_hdr *)(eth_hdr + 1); - vlan_offset = sizeof(struct vlan_hdr); + vlan_offset = sizeof(struct rte_vlan_hdr); *proto = vlan_hdr->eth_proto; if (rte_cpu_to_be_16(ETHER_TYPE_VLAN) == *proto) { vlan_hdr = vlan_hdr + 1; *proto = vlan_hdr->eth_proto; - vlan_offset += sizeof(struct vlan_hdr); + vlan_offset += sizeof(struct rte_vlan_hdr); } } return vlan_offset; @@ -336,9 +337,9 @@ struct global_flag_stru_t *global_flag_stru_p = &global_flag_stru; static int lcore_main(__attribute__((unused)) void *arg1) { struct rte_mbuf *pkts[MAX_PKT_BURST] __rte_cache_aligned; - struct ether_addr d_addr; + struct rte_ether_addr d_addr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; @@ -370,7 +371,8 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[0]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - eth_hdr = rte_pktmbuf_mtod(pkts[i], struct ether_hdr *); + 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)) printf("VLAN taged frame, offset:"); @@ -450,7 +452,7 @@ static void cmd_obj_send_parsed(void *parsed_result, char ip_str[INET6_ADDRSTRLEN]; struct rte_mbuf *created_pkt; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; uint32_t bond_ip; @@ -470,17 +472,17 @@ static void cmd_obj_send_parsed(void *parsed_result, return; } - pkt_size = sizeof(struct ether_hdr) + sizeof(struct rte_arp_hdr); + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct rte_arp_hdr); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; - eth_hdr = rte_pktmbuf_mtod(created_pkt, struct ether_hdr *); + 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); arp_hdr = (struct rte_arp_hdr *)( - (char *)eth_hdr + sizeof(struct ether_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; @@ -700,7 +702,7 @@ static void cmd_show_parsed(__attribute__((unused)) void *parsed_result, { uint16_t slaves[16] = {0}; uint8_t len = 16; - struct ether_addr addr; + struct rte_ether_addr addr; uint16_t i = 0; while (i < slaves_count) { diff --git a/examples/distributor/main.c b/examples/distributor/main.c index b5499bb12..e4c8c3c18 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -179,7 +179,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return 0; } - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 " %02"PRIx8" %02"PRIx8" %02"PRIx8"\n", diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index a4e64b354..ce7f715f8 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -30,7 +30,7 @@ struct pcmd_intstr_params { struct pcmd_intmac_params { cmdline_fixed_string_t cmd; uint16_t port; - struct ether_addr mac; + struct rte_ether_addr mac; }; struct pcmd_str_params { cmdline_fixed_string_t cmd; @@ -475,7 +475,7 @@ pcmd_macaddr_callback(void *ptr_params, void *ptr_data) { struct pcmd_intmac_params *params = ptr_params; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; int stat; stat = 0; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index e23d3afd2..27c22cf90 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -32,7 +32,7 @@ struct txq_port { }; struct app_port { - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct txq_port txq; rte_spinlock_t lock; int port_active; @@ -158,9 +158,9 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports) static void process_frame(struct app_port *ptr_port, struct rte_mbuf *ptr_frame) { - struct ether_hdr *ptr_mac_hdr; + struct rte_ether_hdr *ptr_mac_hdr; - ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct ether_hdr *); + ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *); ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); } diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index bf10139e7..299488c1c 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -303,7 +303,7 @@ rte_ethtool_net_stop(uint16_t port_id) } int -rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr) +rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); if (addr == NULL) @@ -314,7 +314,7 @@ rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr) } int -rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr) +rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr) { if (addr == NULL) return -EINVAL; @@ -323,7 +323,7 @@ rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr) int rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused, - struct ether_addr *addr) + struct rte_ether_addr *addr) { if (addr == NULL) return -EINVAL; diff --git a/examples/ethtool/lib/rte_ethtool.h b/examples/ethtool/lib/rte_ethtool.h index 31cd5ae4e..f17709663 100644 --- a/examples/ethtool/lib/rte_ethtool.h +++ b/examples/ethtool/lib/rte_ethtool.h @@ -260,7 +260,7 @@ int rte_ethtool_net_stop(uint16_t port_id); * - (0) if successful. * - (-ENODEV) if *port_id* invalid. */ -int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Setting the Ethernet device MAC address. @@ -276,7 +276,7 @@ int rte_ethtool_net_get_mac_addr(uint16_t port_id, struct ether_addr *addr); * - (-EINVAL) if parameters invalid. * - others depends on the specific operations implementation. */ -int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct rte_ether_addr *addr); /** * Validate if the provided MAC address is valid unicast address @@ -292,7 +292,8 @@ int rte_ethtool_net_set_mac_addr(uint16_t port_id, struct ether_addr *addr); * - (-EINVAL) if parameters invalid. * - others depends on the specific operations implementation. */ -int rte_ethtool_net_validate_addr(uint16_t port_id, struct ether_addr *addr); +int rte_ethtool_net_validate_addr(uint16_t port_id, + struct rte_ether_addr *addr); /** * Setting the Ethernet device maximum Tx unit. diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c index 58f8904e0..63227f0d5 100644 --- a/examples/eventdev_pipeline/main.c +++ b/examples/eventdev_pipeline/main.c @@ -317,7 +317,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool) } /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index a6cc912fb..ef23d963a 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -99,11 +99,11 @@ struct config_data cdata; static __rte_always_inline void exchange_mac(struct rte_mbuf *m) { - struct ether_hdr *eth; - struct ether_addr addr; + struct rte_ether_hdr *eth; + struct rte_ether_addr addr; /* change mac addresses on packet (to use mbuf data) */ - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_addr_copy(ð->d_addr, &addr); ether_addr_copy(&addr, ð->d_addr); } diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index 199612926..5ae81fab1 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -98,7 +98,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint8_t), .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ @@ -108,7 +108,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ @@ -118,7 +118,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, dst_addr), }, /* @@ -131,7 +131,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -141,7 +141,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, - .offset = sizeof(struct ether_hdr) + + .offset = sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, @@ -192,7 +192,7 @@ static inline int port_init(uint8_t port, struct rte_mempool *mbuf_pool) { struct rte_eth_conf port_conf = port_conf_default; - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rx_rings = 1, tx_rings = 1; int retval; uint16_t q; diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index a582ac075..7b8e7c4fa 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -45,7 +45,7 @@ struct rte_flow *flow; #include "flow_blocks.c" static inline void -print_ether_addr(const char *what, struct ether_addr *eth_addr) +print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -56,7 +56,7 @@ static void main_loop(void) { struct rte_mbuf *mbufs[32]; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_flow_error error; uint16_t nb_rx; uint16_t i; @@ -71,7 +71,7 @@ main_loop(void) struct rte_mbuf *m = mbufs[j]; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); print_ether_addr("src=", ð_hdr->s_addr); print_ether_addr(" - dst=", diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index e90a61e35..a9efb4baa 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -60,7 +60,7 @@ * We have to consider the max possible overhead. */ #define MTU_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct vlan_hdr)) + (ETHER_HDR_LEN + ETHER_CRC_LEN + 2 * sizeof(struct rte_vlan_hdr)) /* * Default payload in bytes for the IPv6 packet. @@ -90,7 +90,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #ifndef IPv4_BYTES #define IPv4_BYTES_FMT "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 @@ -252,7 +252,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, port_out = port_in; /* Remove the Ethernet header and trailer from the input packet */ - rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); /* Build transmission burst */ len = qconf->tx_mbufs[port_out].len; @@ -340,13 +340,14 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, void *d_addr_bytes; m = qconf->tx_mbufs[port_out].m_table[i]; - struct ether_hdr *eth_hdr = (struct ether_hdr *) - rte_pktmbuf_prepend(m, (uint16_t)sizeof(struct ether_hdr)); + struct rte_ether_hdr *eth_hdr = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(m, + (uint16_t)sizeof(struct rte_ether_hdr)); if (eth_hdr == NULL) { rte_panic("No headroom in mbuf.\n"); } - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); /* 02:00:00:00:00:xx */ d_addr_bytes = ð_hdr->d_addr.addr_bytes[0]; @@ -568,7 +569,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -669,11 +670,11 @@ check_ptype(int portid) static inline void parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c index bcf62fbf5..309b2936e 100644 --- a/examples/ip_pipeline/cli.c +++ b/examples/ip_pipeline/cli.c @@ -245,7 +245,7 @@ static void print_link_info(struct link *link, char *out, size_t out_size) { struct rte_eth_stats stats; - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; struct rte_eth_link eth_link; uint16_t mtu; @@ -4777,7 +4777,7 @@ cmd_pipeline_table_rule_delete_default(char **tokens, } static void -ether_addr_show(FILE *f, struct ether_addr *addr) +ether_addr_show(FILE *f, struct rte_ether_addr *addr) { fprintf(f, "%02x:%02x:%02x:%02x:%02x:%02x", (uint32_t)addr->addr_bytes[0], (uint32_t)addr->addr_bytes[1], diff --git a/examples/ip_pipeline/parser.c b/examples/ip_pipeline/parser.c index ffcdeb3a6..4777f9ffd 100644 --- a/examples/ip_pipeline/parser.c +++ b/examples/ip_pipeline/parser.c @@ -513,13 +513,13 @@ inet_pton6(const char *src, unsigned char *dst) return 1; } -static struct ether_addr * +static struct rte_ether_addr * my_ether_aton(const char *a) { int i; char *end; unsigned long o[ETHER_ADDR_LEN]; - static struct ether_addr ether_addr; + static struct rte_ether_addr ether_addr; i = 0; do { @@ -553,7 +553,7 @@ my_ether_aton(const char *a) } else return NULL; - return (struct ether_addr *)ðer_addr; + return (struct rte_ether_addr *)ðer_addr; } int @@ -581,15 +581,15 @@ parse_ipv6_addr(const char *token, struct in6_addr *ipv6) } int -parse_mac_addr(const char *token, struct ether_addr *addr) +parse_mac_addr(const char *token, struct rte_ether_addr *addr) { - struct ether_addr *tmp; + struct rte_ether_addr *tmp; tmp = my_ether_aton(token); if (tmp == NULL) return -1; - memcpy(addr, tmp, sizeof(struct ether_addr)); + memcpy(addr, tmp, sizeof(struct rte_ether_addr)); return 0; } diff --git a/examples/ip_pipeline/parser.h b/examples/ip_pipeline/parser.h index 261a8c858..4538f675d 100644 --- a/examples/ip_pipeline/parser.h +++ b/examples/ip_pipeline/parser.h @@ -47,7 +47,7 @@ int parse_hex_string(char *src, uint8_t *dst, uint32_t *size); int parse_ipv4_addr(const char *token, struct in_addr *ipv4); int parse_ipv6_addr(const char *token, struct in6_addr *ipv6); -int parse_mac_addr(const char *token, struct ether_addr *addr); +int parse_mac_addr(const char *token, struct rte_ether_addr *addr); int parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); struct cpu_core_params { diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 17b55d4c7..d9ecac006 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -95,7 +95,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; #ifndef IPv4_BYTES #define IPv4_BYTES_FMT "%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 @@ -308,7 +308,7 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, struct lcore_queue_conf *qconf, uint64_t tms) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_ip_frag_tbl *tbl; struct rte_ip_frag_death_row *dr; struct rx_queue *rxq; @@ -318,7 +318,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, rxq = &qconf->rx_queue_list[queue]; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_port = portid; @@ -350,7 +350,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; eth_hdr = rte_pktmbuf_mtod(m, - struct ether_hdr *); + struct rte_ether_hdr *); ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); } } @@ -388,7 +388,8 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, if (mo != m) { m = mo; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, + struct rte_ether_hdr *); ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); } } @@ -691,7 +692,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 478dd80c2..66e92165d 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -233,9 +233,9 @@ static inline void prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) { uint8_t *nlp; - struct ether_hdr *eth; + struct rte_ether_hdr *eth; - eth = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + 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); nlp = RTE_PTR_ADD(nlp, offsetof(struct ip, ip_p)); @@ -325,11 +325,12 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, const struct lcore_conf *qconf) { struct ip *ip; - struct ether_hdr *ethhdr; + struct rte_ether_hdr *ethhdr; ip = rte_pktmbuf_mtod(pkt, struct ip *); - ethhdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); + ethhdr = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(pkt, ETHER_HDR_LEN); if (ip->ip_v == IPVERSION) { pkt->ol_flags |= qconf->outbound.ipv4_offloads; @@ -352,9 +353,9 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, } memcpy(ðhdr->s_addr, ðaddr_tbl[port].src, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); memcpy(ðhdr->d_addr, ðaddr_tbl[port].dst, - sizeof(struct ether_addr)); + sizeof(struct rte_ether_addr)); } static inline void @@ -1424,7 +1425,7 @@ parse_args(int32_t argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -1435,7 +1436,7 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr) * Update destination ethaddr for the port. */ int -add_dst_ethaddr(uint16_t port, const struct ether_addr *addr) +add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr) { if (port >= RTE_DIM(ethaddr_tbl)) return -EINVAL; @@ -1832,7 +1833,7 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) uint16_t tx_queueid, rx_queueid, queue, lcore_id; int32_t ret, socket_id; struct lcore_conf *qconf; - struct ether_addr ethaddr; + struct rte_ether_addr ethaddr; struct rte_eth_conf local_port_conf = port_conf; rte_eth_dev_info_get(portid, &dev_info); diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 589398f6f..e9272d74b 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -306,7 +306,7 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads, uint64_t *tx_offloads); int -add_dst_ethaddr(uint16_t port, const struct ether_addr *addr); +add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr); void enqueue_cop_burst(struct cdev_qp *cqp); diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c index b0a8ee23b..fc8c238fe 100644 --- a/examples/ipsec-secgw/parser.c +++ b/examples/ipsec-secgw/parser.c @@ -324,7 +324,7 @@ parse_uint8x16(const char *s, uint8_t *v, uint8_t ls) } static int -parse_mac(const char *str, struct ether_addr *addr) +parse_mac(const char *str, struct rte_ether_addr *addr) { uint32_t i; @@ -499,7 +499,7 @@ cfg_parse_neigh(void *parsed_result, __rte_unused struct cmdline *cl, int32_t rc; struct cfg_neigh_add_item *res; struct parse_status *st; - struct ether_addr mac; + struct rte_ether_addr mac; st = data; res = parsed_result; diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 1eef29159..a047197c7 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -80,7 +80,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[MAX_PORTS]; +static struct rte_ether_addr ports_eth_addr[MAX_PORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -267,14 +267,15 @@ mcast_out_pkt(struct rte_mbuf *pkt, int use_clone) * and put it into the outgoing queue for the given port. */ static inline void -mcast_send_pkt(struct rte_mbuf *pkt, struct ether_addr *dest_addr, +mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, struct lcore_queue_conf *qconf, uint16_t port) { - struct ether_hdr *ethdr; + struct rte_ether_hdr *ethdr; uint16_t len; /* Construct Ethernet header. */ - ethdr = (struct ether_hdr *)rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); + ethdr = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); ether_addr_copy(dest_addr, ðdr->d_addr); @@ -302,11 +303,12 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) uint16_t port; union { uint64_t as_int; - struct ether_addr as_addr; + struct rte_ether_addr as_addr; } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); + iphdr = (struct ipv4_hdr *) + rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); @@ -535,7 +537,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, struct ether_addr *eth_addr) +print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/kni/main.c b/examples/kni/main.c index a58774a33..8bea07182 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -832,7 +832,7 @@ kni_config_network_interface(uint16_t port_id, uint8_t if_up) } static void -print_ethaddr(const char *name, struct ether_addr *mac_addr) +print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); @@ -851,10 +851,10 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) } RTE_LOG(INFO, APP, "Configure mac address of %d\n", port_id); - print_ethaddr("Address:", (struct ether_addr *)mac_addr); + print_ethaddr("Address:", (struct rte_ether_addr *)mac_addr); ret = rte_eth_dev_default_mac_addr_set(port_id, - (struct ether_addr *)mac_addr); + (struct rte_ether_addr *)mac_addr); if (ret < 0) RTE_LOG(ERR, APP, "Failed to config mac_addr for port %d\n", port_id); @@ -912,7 +912,7 @@ kni_alloc(uint16_t port_id) } /* Get the interface default mac address */ rte_eth_macaddr_get(port_id, - (struct ether_addr *)&conf.mac_addr); + (struct rte_ether_addr *)&conf.mac_addr); rte_eth_dev_get_mtu(port_id, &conf.mtu); diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c index 0e6078aad..1a8af28e2 100644 --- a/examples/l2fwd-cat/l2fwd-cat.c +++ b/examples/l2fwd-cat/l2fwd-cat.c @@ -73,7 +73,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 06517b471..dd09855e7 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -79,7 +79,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint64_t l2fwd_enabled_port_mask; @@ -387,19 +387,19 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct rte_crypto_op *op, struct l2fwd_crypto_params *cparams) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; char *padding; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (eth_hdr->ether_type != rte_cpu_to_be_16(ETHER_TYPE_IPv4)) return -1; - ipdata_offset = sizeof(struct ether_hdr); + ipdata_offset = sizeof(struct rte_ether_hdr); ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); @@ -593,10 +593,10 @@ l2fwd_send_packet(struct rte_mbuf *m, uint16_t port) static void l2fwd_mac_updating(struct rte_mbuf *m, uint16_t dest_portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index a4d28e178..033104d63 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -52,7 +52,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask; @@ -335,14 +335,14 @@ show_stats_cb(__rte_unused void *param) static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; int sent; unsigned dst_port; struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 0bf2b5336..21d19932d 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -58,7 +58,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask; @@ -165,14 +165,14 @@ print_stats(__attribute__((unused)) struct rte_timer *ptr_timer, static void l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; int sent; unsigned dst_port; struct rte_eth_dev_tx_buffer *buffer; dst_port = l2fwd_dst_ports[portid]; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 6c23215a5..c1d6797b0 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -59,7 +59,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr l2fwd_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t l2fwd_enabled_port_mask = 0; @@ -151,10 +151,10 @@ print_stats(void) static void l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index a322ce4f2..3a0f5820e 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -82,7 +82,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask; @@ -173,7 +173,7 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *c = (unsigned char)(ip >> 8 & 0xff);\ *d = (unsigned char)(ip & 0xff);\ } while (0) -#define OFF_ETHHEAD (sizeof(struct ether_hdr)) +#define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) #define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) #define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ @@ -542,9 +542,9 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) { uint32_t offset = sig & ~ACL_DENY_SIGNATURE; unsigned char a, b, c, d; - struct ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv4_hdr *, - sizeof(struct ether_hdr)); + struct ipv4_hdr *ipv4_hdr = + rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); printf("Packet Src:%hhu.%hhu.%hhu.%hhu ", a, b, c, d); @@ -566,9 +566,9 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) { unsigned i; uint32_t offset = sig & ~ACL_DENY_SIGNATURE; - struct ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, - struct ipv6_hdr *, - sizeof(struct ether_hdr)); + struct ipv6_hdr *ipv6_hdr = + rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + sizeof(struct rte_ether_hdr)); printf("Packet Src"); for (i = 0; i < RTE_DIM(ipv6_hdr->src_addr); i += sizeof(uint16_t)) @@ -625,7 +625,7 @@ prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ if (is_valid_ipv4_pkt(ipv4_hdr, pkt->pkt_len) >= 0) { @@ -1754,7 +1754,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 3b448acc4..bcd584d3e 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -135,7 +135,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* ethernet addresses of ports */ static rte_spinlock_t locks[RTE_MAX_ETHPORTS]; @@ -618,11 +618,11 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, static inline void parse_ptype_one(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -661,18 +661,18 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -710,7 +710,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -1577,7 +1577,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 41137f978..2c0c89e21 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -112,7 +112,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -417,15 +417,15 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -788,7 +788,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index c962deac3..1893f8c3a 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -73,7 +73,7 @@ extern volatile bool force_quit; /* ethernet addresses of ports */ extern uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ extern uint32_t enabled_port_mask; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 5ec99f961..0c68aa01c 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,13 +68,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -121,10 +121,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, vector unsigned short dp1, static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; vector unsigned int te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index fa8f82be6..64e79b946 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -561,7 +561,7 @@ em_check_ptype(int portid) static inline void em_parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; void *l3; @@ -569,9 +569,9 @@ em_parse_ptype(struct rte_mbuf *m) struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ether_type = eth_hdr->ether_type; - l3 = (uint8_t *)eth_hdr + sizeof(struct ether_hdr); + l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { ipv4_hdr = (struct ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index 228164e26..de1278b04 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -9,20 +9,20 @@ static __rte_always_inline void l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); tcp_or_udp = m->packet_type & (RTE_PTYPE_L4_TCP | RTE_PTYPE_L4_UDP); l3_ptypes = m->packet_type & RTE_PTYPE_L3_MASK; if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -55,7 +55,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 22c26dce3..ec52a011f 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -92,7 +92,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); @@ -107,7 +107,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv6 headers.*/ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -142,7 +142,7 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, for (j = 0; j < EM_HASH_LOOKUP_COUNT && j < nb_rx; j++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (j = 0; j < n; j += EM_HASH_LOOKUP_COUNT) { @@ -159,8 +159,9 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, for (i = 0, pos = j + EM_HASH_LOOKUP_COUNT; i < EM_HASH_LOOKUP_COUNT && pos < nb_rx; i++, pos++) { - rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[pos], - struct ether_hdr *) + 1); + rte_prefetch0(rte_pktmbuf_mtod( + pkts_burst[pos], + struct rte_ether_hdr *) + 1); } if (tcp_or_udp && (l3_type == RTE_PTYPE_L3_IPV4)) { diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 16c8b04ac..3ee2304b5 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -13,7 +13,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, union ipv4_5tuple_host *key) { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); @@ -25,17 +25,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 41e2be958..8156bbb90 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -13,7 +13,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); @@ -25,18 +25,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 35cf5eac0..770660e99 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -37,7 +37,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); @@ -52,7 +52,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, /* Handle IPv6 headers.*/ ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -81,13 +81,14 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (nb_rx > 0) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[0], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (i = 1, j = 0; j < nb_rx; i++, j++) { if (i < nb_rx) { - rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], - struct ether_hdr *) + 1); + rte_prefetch0(rte_pktmbuf_mtod( + pkts_burst[i], + struct rte_ether_hdr *) + 1); } dst_port[j] = em_get_dst_port(qconf, pkts_burst[j], portid); } diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 60a00639e..b373047f6 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -108,18 +108,18 @@ lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, { struct ipv6_hdr *ipv6_hdr; struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, @@ -140,7 +140,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, { uint32_t next_hop; struct ipv6_hdr *ipv6_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { return (uint16_t) ((rte_lpm_lookup(qconf->ipv4_lookup_struct, @@ -149,7 +149,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, @@ -380,11 +380,11 @@ lpm_check_ptype(int portid) static inline void lpm_parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index b68868f44..0c98d3fc4 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -9,16 +9,16 @@ static __rte_always_inline void l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -51,7 +51,7 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index 4c9e2438b..b36e991ac 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -18,28 +18,28 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index 02ec0d802..a3e42cfa7 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -19,25 +19,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -98,14 +98,14 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, if (k) { for (i = 0; i < FWDSTEP; i++) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[i], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } for (j = 0; j != k - FWDSTEP; j += FWDSTEP) { for (i = 0; i < FWDSTEP; i++) { rte_prefetch0(rte_pktmbuf_mtod( pkts_burst[j + i + FWDSTEP], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); } processx4_step1(&pkts_burst[j], &dip, &ipv4_flag); @@ -125,17 +125,17 @@ l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, switch (m) { case 3: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 2: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; /* fallthrough */ case 1: rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[j], - struct ether_hdr *) + 1); + struct rte_ether_hdr *) + 1); j++; } diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 1d1615906..4603e0749 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -16,25 +16,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index 76ccdfa73..af2dc47ac 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -104,10 +104,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32x4_t te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = vld1q_u32((uint32_t *)eth_hdr); ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index ed5267c11..3349f2747 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,13 +48,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -101,10 +101,10 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2) static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; __m128i te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 7b9683187..b0a700ab1 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -81,7 +81,7 @@ volatile bool force_quit; /* ethernet addresses of ports */ uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; xmm_t val_eth[RTE_MAX_ETHPORTS]; @@ -647,7 +647,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); @@ -908,14 +908,14 @@ main(int argc, char **argv) print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", - (const struct ether_addr *)&dest_eth_addr[portid]); + (const struct rte_ether_addr *)&dest_eth_addr[portid]); printf(", "); /* * prepare src MACs for each port. */ ether_addr_copy(&ports_eth_addr[portid], - (struct ether_addr *)(val_eth + portid) + 1); + (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ if (!per_port_pool) { diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index f3346d23b..9997c58f4 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -53,7 +53,7 @@ static uint16_t nb_rxd = RTE_TEST_RX_DESC_DEFAULT; static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ -static struct ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr lsi_ports_eth_addr[RTE_MAX_ETHPORTS]; /* mask of enabled ports */ static uint32_t lsi_enabled_port_mask = 0; @@ -163,13 +163,13 @@ print_stats(void) static void lsi_simple_forward(struct rte_mbuf *m, unsigned portid) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; unsigned dst_port = lsi_dst_ports[portid]; int sent; struct rte_eth_dev_tx_buffer *buffer; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index 39a846a56..f39681d72 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -507,9 +507,9 @@ app_lcore_worker( } pkt = lp->mbuf_in.array[j]; - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, - sizeof(struct ether_hdr)); + ipv4_hdr = rte_pktmbuf_mtod_offset( + pkt, struct ipv4_hdr *, + sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); if (unlikely(rte_lpm_lookup(lp->lpm_table, ipv4_dst, &port) != 0)) { diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index 0ddc63e92..9a8e422d4 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -66,7 +66,7 @@ get_printable_mac_addr(uint16_t port) if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; if (unlikely(addresses[port][0]=='\0')){ - struct ether_addr mac; + struct rte_ether_addr mac; rte_eth_macaddr_get(port, &mac); snprintf(addresses[port], sizeof(addresses[port]), "%02x:%02x:%02x:%02x:%02x:%02x\n", diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index 149bfdd02..ca312029e 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -255,7 +255,7 @@ configure_tx_buffers(struct rte_eth_dev_tx_buffer *tx_buffer[]) static inline int configure_eth_port(uint16_t port_id) { - struct ether_addr addr; + struct rte_ether_addr addr; const uint16_t rxRings = 1, txRings = 1; int ret; uint16_t q; diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 4f8747bc3..b29ed9e97 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -92,11 +92,11 @@ check_ptype(int portid) static inline void parse_ptype(struct rte_mbuf *m) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t packet_type = RTE_PTYPE_UNKNOWN; uint16_t ether_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + 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)) packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; @@ -186,7 +186,7 @@ static uint16_t nb_txd = RTE_TEST_TX_DESC_DEFAULT; /* ethernet addresses of ports */ static uint64_t dest_eth_addr[RTE_MAX_ETHPORTS]; -static struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; static xmm_t val_eth[RTE_MAX_ETHPORTS]; @@ -884,39 +884,39 @@ static inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { - struct ether_hdr *eth_hdr[8]; + struct rte_ether_hdr *eth_hdr[8]; struct ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; __m128i data[8]; - eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct ether_hdr *); - eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct ether_hdr *); - eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct ether_hdr *); - eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct ether_hdr *); - eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct ether_hdr *); - eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct ether_hdr *); - eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct ether_hdr *); - eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct rte_ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct rte_ether_hdr *); + eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct rte_ether_hdr *); + eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct rte_ether_hdr *); + eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct rte_ether_hdr *); + eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -967,28 +967,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) #endif /* End of #ifdef DO_RFC_1812_CHECKS */ data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, - sizeof(struct ether_hdr) + + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); @@ -1094,13 +1094,13 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i mask1, union ipv6_5tuple_host *key) { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, - __m128i *, sizeof(struct ether_hdr) + + __m128i *, sizeof(struct rte_ether_hdr) + offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); @@ -1113,37 +1113,37 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { int32_t ret[8]; uint16_t dst_port[8]; - struct ether_hdr *eth_hdr[8]; + struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; - eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct ether_hdr *); - eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct ether_hdr *); - eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct ether_hdr *); - eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct ether_hdr *); - eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct ether_hdr *); - eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct ether_hdr *); - eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct ether_hdr *); - eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct ether_hdr *); + eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); + eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); + eth_hdr[2] = rte_pktmbuf_mtod(m[2], struct rte_ether_hdr *); + eth_hdr[3] = rte_pktmbuf_mtod(m[3], struct rte_ether_hdr *); + eth_hdr[4] = rte_pktmbuf_mtod(m[4], struct rte_ether_hdr *); + eth_hdr[5] = rte_pktmbuf_mtod(m[5], struct rte_ether_hdr *); + eth_hdr[6] = rte_pktmbuf_mtod(m[6], struct rte_ether_hdr *); + eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); get_ipv6_5tuple(m[1], mask1, mask2, &key[1]); @@ -1228,16 +1228,16 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint16_t dst_port; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS /* Check to make sure the packet is valid (RFC1812) */ @@ -1270,7 +1270,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) struct ipv6_hdr *ipv6_hdr; ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct); @@ -1346,7 +1346,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; struct ipv6_hdr *ipv6_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { return (uint16_t) ((rte_lpm_lookup( @@ -1355,7 +1355,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( @@ -1371,13 +1371,13 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; @@ -1403,25 +1403,25 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], uint32_t *ipv4_flag) { struct ipv4_hdr *ipv4_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; - eth_hdr = rte_pktmbuf_mtod(pkt[0], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; - eth_hdr = rte_pktmbuf_mtod(pkt[1], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[2], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; - eth_hdr = rte_pktmbuf_mtod(pkt[3], struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1503,13 +1503,13 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[0] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[1] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[2] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct ether_hdr *)p[3] + 1), + rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } @@ -3020,7 +3020,7 @@ parse_args(int argc, char **argv) } static void -print_ethaddr(const char *name, const struct ether_addr *eth_addr) +print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; @@ -3576,14 +3576,14 @@ main(int argc, char **argv) print_ethaddr(" Address:", &ports_eth_addr[portid]); printf(", "); print_ethaddr("Destination:", - (const struct ether_addr *)&dest_eth_addr[portid]); + (const struct rte_ether_addr *)&dest_eth_addr[portid]); printf(", "); /* * prepare src MACs for each port. */ ether_addr_copy(&ports_eth_addr[portid], - (struct ether_addr *)(val_eth + portid) + 1); + (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ ret = init_mem(NB_MBUF); diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 82ae71c19..7d28f59ce 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -53,7 +53,7 @@ static const struct rte_eth_conf port_conf_default = { }, }; -static const struct ether_addr ether_multicast = { +static const struct rte_ether_addr ether_multicast = { .addr_bytes = {0x01, 0x1b, 0x19, 0x0, 0x0, 0x0} }; @@ -334,7 +334,7 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) struct ptp_header *ptp_hdr; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(ptp_data->m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id); if (ptp_data->ptpset == 0) { @@ -361,20 +361,20 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) static void parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ptp_header *ptp_hdr; struct clock_id *client_clkid; struct ptp_message *ptp_msg; struct rte_mbuf *created_pkt; struct tstamp *origin_tstamp; - struct ether_addr eth_multicast = ether_multicast; + struct rte_ether_addr eth_multicast = ether_multicast; size_t pkt_size; int wait_us; struct rte_mbuf *m = ptp_data->m; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); if (memcmp(&ptp_data->master_clock_id, &ptp_hdr->source_port_id.clock_id, sizeof(struct clock_id)) != 0) @@ -382,7 +382,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) ptp_data->seqID_FOLLOWUP = rte_be_to_cpu_16(ptp_hdr->seq_id); ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(m, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); origin_tstamp = &ptp_msg->follow_up.precise_origin_tstamp; ptp_data->tstamp1.tv_nsec = ntohl(origin_tstamp->ns); @@ -393,11 +393,11 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) if (ptp_data->seqID_FOLLOWUP == ptp_data->seqID_SYNC) { created_pkt = rte_pktmbuf_alloc(mbuf_pool); - pkt_size = sizeof(struct ether_hdr) + + pkt_size = sizeof(struct rte_ether_hdr) + sizeof(struct ptp_message); created_pkt->data_len = pkt_size; created_pkt->pkt_len = pkt_size; - eth_hdr = rte_pktmbuf_mtod(created_pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ @@ -406,7 +406,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) eth_hdr->ether_type = htons(PTP_PROTOCOL); ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(created_pkt, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ptp_msg->delay_req.hdr.seq_id = htons(ptp_data->seqID_SYNC); ptp_msg->delay_req.hdr.msg_type = DELAY_REQ; @@ -499,7 +499,7 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) uint16_t seq_id; ptp_msg = (struct ptp_message *) (rte_pktmbuf_mtod(m, char *) + - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); seq_id = rte_be_to_cpu_16(ptp_msg->delay_resp.hdr.seq_id); if (memcmp(&ptp_data->client_clock_id, &ptp_msg->delay_resp.req_port_id.clock_id, @@ -535,17 +535,17 @@ parse_drsp(struct ptpv2_data_slave_ordinary *ptp_data) static void parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { struct ptp_header *ptp_hdr; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t eth_type; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); eth_type = rte_be_to_cpu_16(eth_hdr->ether_type); if (eth_type == PTP_PROTOCOL) { ptp_data.m = m; ptp_data.portid = portid; ptp_hdr = (struct ptp_header *)(rte_pktmbuf_mtod(m, char *) - + sizeof(struct ether_hdr)); + + sizeof(struct rte_ether_hdr)); switch (ptp_hdr->msg_type) { case SYNC: diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 9b0112449..431e84f4e 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -145,7 +145,8 @@ app_pkt_handle(struct rte_mbuf *pkt, uint64_t time) { uint8_t input_color, output_color; uint8_t *pkt_data = rte_pktmbuf_mtod(pkt, uint8_t *); - uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - sizeof(struct ether_hdr); + uint32_t pkt_len = rte_pktmbuf_pkt_len(pkt) - + sizeof(struct rte_ether_hdr); uint8_t flow_id = (uint8_t)(pkt_data[APP_PKT_FLOW_POS] & (APP_FLOWS_MAX - 1)); input_color = pkt_data[APP_PKT_COLOR_POS]; enum policer_action action; diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index c55d38744..61e92a820 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -50,8 +50,8 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) { struct rte_mbuf *mbuf; struct ether_fc_frame *pause_frame; - struct ether_hdr *hdr; - struct ether_addr mac_addr; + struct rte_ether_hdr *hdr; + struct rte_ether_addr mac_addr; RTE_LOG_DP(DEBUG, USER1, "Sending PAUSE frame (duration=%d) on port %d\n", @@ -63,7 +63,7 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) return; /* Prepare a PAUSE frame */ - hdr = rte_pktmbuf_mtod(mbuf, struct ether_hdr *); + hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); pause_frame = (struct ether_fc_frame *) &hdr[1]; rte_eth_macaddr_get(port_id, &mac_addr); diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 2058be627..a277519f5 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -115,7 +115,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) if (retval < 0) return retval; - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02"PRIx8" %02"PRIx8" %02"PRIx8 diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 3b97fbd45..8bec351ec 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -275,7 +275,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index 404f1f165..a086c5a77 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -68,7 +68,7 @@ get_printable_mac_addr(uint16_t port) { static const char err_address[] = "00:00:00:00:00:00"; static char addresses[RTE_MAX_ETHPORTS][sizeof(err_address)]; - struct ether_addr mac; + struct rte_ether_addr mac; if (unlikely(port >= RTE_MAX_ETHPORTS)) return err_address; @@ -253,7 +253,7 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index 4aba1dc38..7e3cd8715 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -82,7 +82,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c index e0fe7bd2f..9d8ab17dd 100644 --- a/examples/tep_termination/main.c +++ b/examples/tep_termination/main.c @@ -157,7 +157,7 @@ uint16_t ports[RTE_MAX_ETHPORTS]; static unsigned nb_ports; /**< The number of ports specified in command line */ /* ethernet addresses of ports */ -struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; /* heads for the main used and free linked lists for the data path. */ static struct virtio_net_data_ll *ll_root_used; diff --git a/examples/tep_termination/main.h b/examples/tep_termination/main.h index 966c63a51..7a70f7396 100644 --- a/examples/tep_termination/main.h +++ b/examples/tep_termination/main.h @@ -50,7 +50,7 @@ struct vhost_dev { /**< Memory region information for gpa to hpa translation. */ struct virtio_memory_regions_hpa *regions_hpa; /**< Device MAC address (Obtained on first TX packet). */ - struct ether_addr mac_address; + struct rte_ether_addr mac_address; /**< RX queue number. */ uint16_t rx_q; /**< Data core that the device is added to. */ diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 7732821d9..6545b8ae4 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -28,19 +28,20 @@ get_psd_sum(void *l3_hdr, uint16_t ethertype, uint64_t ol_flags) * header. */ static void -parse_ethernet(struct ether_hdr *eth_hdr, union tunnel_offload_info *info, +parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; uint16_t ethertype; - info->outer_l2_len = sizeof(struct ether_hdr); + info->outer_l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - info->outer_l2_len += sizeof(struct vlan_hdr); + 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); } @@ -68,7 +69,8 @@ parse_ethernet(struct ether_hdr *eth_hdr, union tunnel_offload_info *info, * Calculate the checksum of a packet in hardware */ static uint64_t -process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info) +process_inner_cksums(struct rte_ether_hdr *eth_hdr, + union tunnel_offload_info *info) { void *l3_hdr = NULL; uint8_t l4_proto; @@ -80,12 +82,13 @@ process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info) struct sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; - info->l2_len = sizeof(struct ether_hdr); + info->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); - info->l2_len += sizeof(struct vlan_hdr); + 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); } @@ -141,7 +144,8 @@ decapsulation(struct rte_mbuf *pkt) uint16_t outer_header_len; struct udp_hdr *udp_hdr; union tunnel_offload_info info = { .data = 0 }; - struct ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + struct rte_ether_hdr *phdr = + rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); parse_ethernet(phdr, &info, &l4_proto); @@ -158,7 +162,7 @@ decapsulation(struct rte_mbuf *pkt) (pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0) return -1; outer_header_len = info.outer_l2_len + info.outer_l3_len - + sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr); + + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr); rte_pktmbuf_adj(pkt, outer_header_len); @@ -172,29 +176,31 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) uint64_t ol_flags = 0; uint32_t old_len = m->pkt_len, hash; union tunnel_offload_info tx_offload = { .data = 0 }; - struct ether_hdr *phdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *phdr = + rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ - struct ether_hdr *pneth = (struct ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) - + sizeof(struct udp_hdr) + sizeof(struct vxlan_hdr)); + struct rte_ether_hdr *pneth = + (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, + sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; - struct vxlan_hdr *vxlan = (struct vxlan_hdr *) &udp[1]; + struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; /* convert TX queue ID to vport ID */ vport_id = queue_id - 1; /* replace original Ethernet header with ours */ pneth = rte_memcpy(pneth, &app_l2_hdr[vport_id], - sizeof(struct ether_hdr)); + sizeof(struct rte_ether_hdr)); /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], sizeof(struct ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - - sizeof(struct ether_hdr)); + - sizeof(struct rte_ether_hdr)); /* outer IP checksum */ ol_flags |= PKT_TX_OUTER_IP_CKSUM; @@ -209,7 +215,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) m->l2_len += ETHER_VXLAN_HLEN; } - m->outer_l2_len = sizeof(struct ether_hdr); + m->outer_l2_len = sizeof(struct rte_ether_hdr); m->outer_l3_len = sizeof(struct ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; @@ -225,7 +231,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) udp->dgram_cksum = 0; udp->dgram_len = rte_cpu_to_be_16(old_len + sizeof(struct udp_hdr) - + sizeof(struct vxlan_hdr)); + + 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); diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index bff786a2a..780ae73cc 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -17,15 +17,15 @@ #define DEFAULT_VXLAN_PORT 4789 extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; -extern struct ether_hdr app_l2_hdr[VXLAN_N_PORTS]; +extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; struct vxlan_port { uint32_t vport_id; /**< VirtIO port id */ uint32_t peer_ip; /**< remote VTEP IP address */ - struct ether_addr peer_mac; /**< remote VTEP MAC address */ - struct ether_addr vport_mac; /**< VirtIO port MAC address */ + struct rte_ether_addr peer_mac; /**< remote VTEP MAC address */ + struct rte_ether_addr vport_mac; /**< VirtIO port MAC address */ } __rte_cache_aligned; struct vxlan_conf { diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index ad7fbe9c6..e4af7bc4d 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -49,7 +49,7 @@ struct vxlan_conf vxdev; struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; -struct ether_hdr app_l2_hdr[VXLAN_N_PORTS]; +struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ uint8_t vxlan_multicast_ips[2][4] = { {239, 1, 1, 1 }, {239, 1, 2, 1 } }; @@ -227,7 +227,7 @@ int vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) { int i, ret; - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; struct ipv4_hdr *ip; @@ -242,7 +242,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) } /* Learn MAC address of guest device from packet */ - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: This device is using an existing" diff --git a/examples/tep_termination/vxlan_setup.h b/examples/tep_termination/vxlan_setup.h index 2c20e2e39..4dc37d673 100644 --- a/examples/tep_termination/vxlan_setup.h +++ b/examples/tep_termination/vxlan_setup.h @@ -9,7 +9,7 @@ extern uint16_t nb_devices; extern uint16_t udp_port; extern uint8_t filter_idx; extern uint16_t ports[RTE_MAX_ETHPORTS]; -extern struct ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; +extern struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS]; extern uint32_t enable_stats; extern struct device_statistics dev_statistics[MAX_DEVICES]; extern uint8_t rx_decap; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 8f7b758c3..cd1a51bfa 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -161,7 +161,7 @@ const uint16_t vlan_tags[] = { }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; static struct vhost_dev_tailq_list vhost_dev_list = TAILQ_HEAD_INITIALIZER(vhost_dev_list); @@ -660,7 +660,7 @@ static unsigned check_ports_num(unsigned nb_ports) } static __rte_always_inline struct vhost_dev * -find_vhost_dev(struct ether_addr *mac) +find_vhost_dev(struct rte_ether_addr *mac) { struct vhost_dev *vdev; @@ -680,11 +680,11 @@ find_vhost_dev(struct ether_addr *mac) static int link_vmdq(struct vhost_dev *vdev, struct rte_mbuf *m) { - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; int i, ret; /* Learn MAC address of guest device from packet */ - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (find_vhost_dev(&pkt_hdr->s_addr)) { RTE_LOG(ERR, VHOST_DATA, @@ -786,10 +786,10 @@ virtio_xmit(struct vhost_dev *dst_vdev, struct vhost_dev *src_vdev, static __rte_always_inline int virtio_tx_local(struct vhost_dev *vdev, struct rte_mbuf *m) { - struct ether_hdr *pkt_hdr; + struct rte_ether_hdr *pkt_hdr; struct vhost_dev *dst_vdev; - pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_vdev = find_vhost_dev(&pkt_hdr->d_addr); if (!dst_vdev) @@ -824,7 +824,8 @@ find_local_dest(struct vhost_dev *vdev, struct rte_mbuf *m, uint32_t *offset, uint16_t *vlan_tag) { struct vhost_dev *dst_vdev; - struct ether_hdr *pkt_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *pkt_hdr = + rte_pktmbuf_mtod(m, struct rte_ether_hdr *); dst_vdev = find_vhost_dev(&pkt_hdr->d_addr); if (!dst_vdev) @@ -866,7 +867,8 @@ static void virtio_tx_offload(struct rte_mbuf *m) void *l3_hdr; struct ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + struct rte_ether_hdr *eth_hdr = + rte_pktmbuf_mtod(m, struct rte_ether_hdr *); l3_hdr = (char *)eth_hdr + m->l2_len; @@ -910,10 +912,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) struct mbuf_table *tx_q; unsigned offset = 0; const uint16_t lcore_id = rte_lcore_id(); - struct ether_hdr *nh; + struct rte_ether_hdr *nh; - nh = rte_pktmbuf_mtod(m, struct ether_hdr *); + nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) { struct vhost_dev *vdev2; @@ -946,10 +948,10 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) /*Add packet to the port tx queue*/ tx_q = &lcore_tx_queue[lcore_id]; - nh = rte_pktmbuf_mtod(m, struct ether_hdr *); + nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (unlikely(nh->ether_type == rte_cpu_to_be_16(ETHER_TYPE_VLAN))) { /* Guest has inserted the vlan tag. */ - struct vlan_hdr *vh = (struct vlan_hdr *) (nh + 1); + struct rte_vlan_hdr *vh = (struct rte_vlan_hdr *) (nh + 1); uint16_t vlan_tag_be = rte_cpu_to_be_16(vlan_tag); if ((vm2vm_mode == VM2VM_HARDWARE) && (vh->vlan_tci != vlan_tag_be)) diff --git a/examples/vhost/main.h b/examples/vhost/main.h index 764c33afe..7cba0edbf 100644 --- a/examples/vhost/main.h +++ b/examples/vhost/main.h @@ -35,7 +35,7 @@ struct vhost_dev { /**< Number of memory regions for gpa to hpa translation. */ uint32_t nregions_hpa; /**< Device MAC address (Obtained on first TX packet). */ - struct ether_addr mac_address; + struct rte_ether_addr mac_address; /**< RX VMDQ queue number. */ uint16_t vmdq_rx_q; /**< Vlan tag assigned to the pool */ diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c index 4a287109b..1194f62f8 100644 --- a/examples/vm_power_manager/channel_monitor.c +++ b/examples/vm_power_manager/channel_monitor.c @@ -56,12 +56,12 @@ static struct policy policies[MAX_CLIENTS]; #ifdef USE_JANSSON union PFID { - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t pfid; }; static int -str_to_ether_addr(const char *a, struct ether_addr *ether_addr) +str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr) { int i; char *end; @@ -404,7 +404,7 @@ get_pfid(struct policy *pol) RTE_ETH_FOREACH_DEV(x) { ret = rte_pmd_i40e_query_vfid_by_mac(x, - (struct ether_addr *)&(pol->pkt.vfid[i])); + (struct rte_ether_addr *)&(pol->pkt.vfid[i])); if (ret != -EINVAL) { pol->port[i] = x; break; diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c index 2d9e7689a..78c3aa0a1 100644 --- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c +++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c @@ -34,7 +34,7 @@ struct cmd_quit_result { }; union PFID { - struct ether_addr addr; + struct rte_ether_addr addr; uint64_t pfid; }; diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c index 5fa13fe62..f8cab1162 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -105,7 +105,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return retval; /* Display the port MAC address. */ - struct ether_addr addr; + struct rte_ether_addr addr; rte_eth_macaddr_get(port, &addr); printf("Port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "\n", @@ -355,7 +355,7 @@ main(int argc, char **argv) /* Initialize ports. */ RTE_ETH_FOREACH_DEV(portid) { - struct ether_addr eth; + struct rte_ether_addr eth; int w, j; int ret; diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 627a5da48..5195a515a 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -106,12 +106,12 @@ const uint16_t num_vlans = RTE_DIM(vlan_tags); static uint16_t num_pf_queues, num_vmdq_queues; static uint16_t vmdq_pool_base, vmdq_queue_base; /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ -static struct ether_addr pool_addr_template = { +static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; #define MAX_QUEUE_NUM_10G 128 #define MAX_QUEUE_NUM_1G 8 @@ -281,7 +281,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) * Removes this after i40e fixes this issue. */ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; mac.addr_bytes[5] = q; @@ -407,10 +407,10 @@ vmdq_parse_args(int argc, char **argv) static void update_mac_address(struct rte_mbuf *m, unsigned dst_port) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 646368395..75cf31a10 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -121,12 +121,12 @@ const uint16_t vlan_tags[] = { const uint16_t num_vlans = RTE_DIM(vlan_tags); /* pool mac addr template, pool mac addr is like: 52 54 00 12 port# pool# */ -static struct ether_addr pool_addr_template = { +static struct rte_ether_addr pool_addr_template = { .addr_bytes = {0x52, 0x54, 0x00, 0x12, 0x00, 0x00} }; /* ethernet addresses of ports */ -static struct ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; +static struct rte_ether_addr vmdq_ports_eth_addr[RTE_MAX_ETHPORTS]; /* Builds up the correct configuration for vmdq+dcb based on the vlan tags array * given above, and the number of traffic classes available for use. */ @@ -332,7 +332,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) /* Set mac for each pool.*/ for (q = 0; q < num_pools; q++) { - struct ether_addr mac; + struct rte_ether_addr mac; mac = pool_addr_template; mac.addr_bytes[4] = port; @@ -494,10 +494,10 @@ vmdq_parse_args(int argc, char **argv) static void update_mac_address(struct rte_mbuf *m, unsigned dst_port) { - struct ether_hdr *eth; + struct rte_ether_hdr *eth; void *tmp; - eth = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); /* 02:00:00:00:00:xx */ tmp = ð->d_addr.addr_bytes[0]; diff --git a/lib/librte_ethdev/rte_class_eth.c b/lib/librte_ethdev/rte_class_eth.c index cb99c92ec..e554668da 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/rte_class_eth.c @@ -44,7 +44,7 @@ eth_mac_cmp(const char *key __rte_unused, const char *value, void *opaque) { int ret; - struct ether_addr mac; + struct rte_ether_addr mac; const struct rte_eth_dev_data *data = opaque; struct rte_eth_dev_info dev_info; uint32_t index; diff --git a/lib/librte_ethdev/rte_eth_ctrl.h b/lib/librte_ethdev/rte_eth_ctrl.h index 1ef4ed92b..85c1e372a 100644 --- a/lib/librte_ethdev/rte_eth_ctrl.h +++ b/lib/librte_ethdev/rte_eth_ctrl.h @@ -75,7 +75,7 @@ struct rte_eth_mac_filter { uint8_t is_vf; /**< 1 for VF, 0 for port dev */ uint16_t dst_id; /**< VF ID, available when is_vf is 1*/ enum rte_mac_filter_type filter_type; /**< MAC filter type */ - struct ether_addr mac_addr; + struct rte_ether_addr mac_addr; }; /** @@ -91,7 +91,7 @@ struct rte_eth_mac_filter { * RTE_ETH_FILTER_DELETE and RTE_ETH_FILTER_GET operations. */ struct rte_eth_ethertype_filter { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ uint16_t ether_type; /**< Ether type to match */ uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ uint16_t queue; /**< Queue assigned to when match*/ @@ -216,8 +216,8 @@ enum rte_tunnel_iptype { * Tunneling Packet filter configuration. */ struct rte_eth_tunnel_filter_conf { - struct ether_addr outer_mac; /**< Outer MAC address to match. */ - struct ether_addr inner_mac; /**< Inner MAC address to match. */ + struct rte_ether_addr outer_mac; /**< Outer MAC address to match. */ + struct rte_ether_addr inner_mac; /**< Inner MAC address to match. */ uint16_t inner_vlan; /**< Inner VLAN to match. */ enum rte_tunnel_iptype ip_type; /**< IP address type. */ /** Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP @@ -424,7 +424,7 @@ struct rte_eth_sctpv6_flow { * A structure used to define the input for MAC VLAN flow */ struct rte_eth_mac_vlan_flow { - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** @@ -444,7 +444,7 @@ struct rte_eth_tunnel_flow { enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */ /** Tunnel ID to match. TNI, VNI... in big endian. */ uint32_t tunnel_id; - struct ether_addr mac_addr; /**< Mac address to match. */ + struct rte_ether_addr mac_addr; /**< Mac address to match. */ }; /** diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index d7cfa3d53..b868535c2 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1346,7 +1346,7 @@ static void rte_eth_dev_mac_restore(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { - struct ether_addr *addr; + struct rte_ether_addr *addr; uint16_t i; uint32_t pool = 0; uint64_t pool_mask; @@ -2591,7 +2591,7 @@ rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask, } void -rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr) +rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr) { struct rte_eth_dev *dev; @@ -3078,7 +3078,7 @@ rte_eth_led_off(uint16_t port_id) * an empty spot. */ static int -get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) +get_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3094,10 +3094,10 @@ get_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) return -1; } -static const struct ether_addr null_mac_addr; +static const struct rte_ether_addr null_mac_addr; int -rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr, +rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, uint32_t pool) { struct rte_eth_dev *dev; @@ -3150,7 +3150,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *addr, } int -rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr) +rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr) { struct rte_eth_dev *dev; int index; @@ -3181,7 +3181,7 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *addr) } int -rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) +rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) { struct rte_eth_dev *dev; int ret; @@ -3210,7 +3210,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct ether_addr *addr) * an empty spot. */ static int -get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) +get_hash_mac_addr_index(uint16_t port_id, const struct rte_ether_addr *addr) { struct rte_eth_dev_info dev_info; struct rte_eth_dev *dev = &rte_eth_devices[port_id]; @@ -3229,7 +3229,7 @@ get_hash_mac_addr_index(uint16_t port_id, const struct ether_addr *addr) } int -rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on) { int index; @@ -4066,7 +4066,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { struct rte_eth_dev *dev; diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 1f35e1dda..bcc1bb71d 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2316,7 +2316,7 @@ int rte_eth_dev_set_rx_queue_stats_mapping(uint16_t port_id, * A pointer to a structure of type *ether_addr* to be filled with * the Ethernet address of the Ethernet device. */ -void rte_eth_macaddr_get(uint16_t port_id, struct ether_addr *mac_addr); +void rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); /** * Retrieve the contextual information of an Ethernet device. @@ -3029,7 +3029,7 @@ int rte_eth_dev_priority_flow_ctrl_set(uint16_t port_id, * - (-ENOSPC) if no more MAC addresses can be added. * - (-EINVAL) if MAC address is invalid. */ -int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, +int rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool); /** @@ -3045,7 +3045,8 @@ int rte_eth_dev_mac_addr_add(uint16_t port_id, struct ether_addr *mac_addr, * - (-ENODEV) if *port* invalid. * - (-EADDRINUSE) if attempting to remove the default MAC address */ -int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); +int rte_eth_dev_mac_addr_remove(uint16_t port_id, + struct rte_ether_addr *mac_addr); /** * Set the default MAC address. @@ -3061,7 +3062,7 @@ int rte_eth_dev_mac_addr_remove(uint16_t port_id, struct ether_addr *mac_addr); * - (-EINVAL) if MAC address is invalid. */ int rte_eth_dev_default_mac_addr_set(uint16_t port_id, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /** * Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device. @@ -3123,7 +3124,7 @@ int rte_eth_dev_rss_reta_query(uint16_t port_id, * - (-EIO) if device is removed. * - (-EINVAL) if bad parameter. */ -int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct ether_addr *addr, +int rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, uint8_t on); /** @@ -3668,7 +3669,7 @@ rte_eth_dev_get_module_eeprom(uint16_t port_id, * - (-ENOSPC) if *port_id* has not enough multicast filtering resources. */ int rte_eth_dev_set_mc_addr_list(uint16_t port_id, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /** diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index 16300b147..b406e297e 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -250,17 +250,17 @@ typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); /**< @internal Remove MAC address from receive address register */ typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint32_t index, uint32_t vmdq); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr); + struct rte_ether_addr *mac_addr); /**< @internal Set a MAC address into Receive Address Address Register */ typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, - struct ether_addr *mac_addr, + struct rte_ether_addr *mac_addr, uint8_t on); /**< @internal Set a Unicast Hash bitmap */ @@ -292,7 +292,7 @@ typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, /**< @internal Delete tunneling UDP port */ typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, - struct ether_addr *mc_addr_set, + struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr); /**< @internal set the list of multicast addresses on an Ethernet device */ @@ -597,13 +597,13 @@ struct rte_eth_dev_data { /**< Common RX buffer size handled by all queues. */ uint64_t rx_mbuf_alloc_failed; /**< RX ring mbuf allocation failures. */ - struct ether_addr *mac_addrs; + struct rte_ether_addr *mac_addrs; /**< Device Ethernet link address. * @see rte_eth_dev_release_port() */ uint64_t mac_pool_sel[ETH_NUM_RECEIVE_MAC_ADDR]; /**< Bitmap associating MAC addresses to pools. */ - struct ether_addr *hash_mac_addrs; + struct rte_ether_addr *hash_mac_addrs; /**< Device Ethernet MAC addresses of hash filtering. * @see rte_eth_dev_release_port() */ diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 63f84fca6..050af52f8 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -584,8 +584,8 @@ static const struct rte_flow_item_raw rte_flow_item_raw_mask = { * same order as on the wire. */ struct rte_flow_item_eth { - struct ether_addr dst; /**< Destination MAC. */ - struct ether_addr src; /**< Source MAC. */ + struct rte_ether_addr dst; /**< Destination MAC. */ + struct rte_ether_addr src; /**< Source MAC. */ rte_be16_t type; /**< EtherType or TPID. */ }; @@ -981,9 +981,9 @@ struct rte_flow_item_arp_eth_ipv4 { uint8_t hln; /**< Hardware address length, normally 6. */ uint8_t pln; /**< Protocol address length, normally 4. */ rte_be16_t op; /**< Opcode (1 for request, 2 for reply). */ - struct ether_addr sha; /**< Sender hardware address. */ + struct rte_ether_addr sha; /**< Sender hardware address. */ rte_be32_t spa; /**< Sender IPv4 address. */ - struct ether_addr tha; /**< Target hardware address. */ + struct rte_ether_addr tha; /**< Target hardware address. */ rte_be32_t tpa; /**< Target IPv4 address. */ }; @@ -1127,7 +1127,7 @@ rte_flow_item_icmp6_nd_opt_mask = { struct rte_flow_item_icmp6_nd_opt_sla_eth { uint8_t type; /**< ND option type, normally 1. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr sla; /**< Source Ethernet LLA. */ + struct rte_ether_addr sla; /**< Source Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH. */ @@ -1152,7 +1152,7 @@ rte_flow_item_icmp6_nd_opt_sla_eth_mask = { struct rte_flow_item_icmp6_nd_opt_tla_eth { uint8_t type; /**< ND option type, normally 2. */ uint8_t length; /**< ND option length, normally 1. */ - struct ether_addr tla; /**< Target Ethernet LLA. */ + struct rte_ether_addr tla; /**< Target Ethernet LLA. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index b60674b61..b6ff57b42 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -614,8 +614,9 @@ static inline void rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, struct ipv6_hdr **ipv6_hdr) { - struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); - struct vlan_hdr *vlan_hdr; + struct rte_ether_hdr *eth_hdr = + rte_pktmbuf_mtod(m, struct rte_ether_hdr *); + struct rte_vlan_hdr *vlan_hdr; *ipv4_hdr = NULL; *ipv6_hdr = NULL; @@ -630,7 +631,7 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, break; case RTE_BE16(ETHER_TYPE_VLAN): - vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(ETHER_TYPE_IPv4): *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 7d128a431..284219517 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -194,7 +194,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, struct gro_tcp4_tbl *tbl, uint64_t start_time) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; @@ -215,7 +215,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, if (unlikely(INVALID_TCP_HDRLEN(pkt->l4_len))) return -1; - eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index d97924883..988cca8c6 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -24,8 +24,8 @@ /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { - struct ether_addr eth_saddr; - struct ether_addr eth_daddr; + struct rte_ether_addr eth_saddr; + struct rte_ether_addr eth_daddr; uint32_t ip_src_addr; uint32_t ip_dst_addr; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index acb9bc919..d713e3dd6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -289,11 +289,11 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, struct gro_vxlan_tcp4_tbl *tbl, uint64_t start_time) { - struct ether_hdr *outer_eth_hdr, *eth_hdr; + struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; - struct vxlan_hdr *vxlan_hdr; + struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; int32_t tcp_dl; uint16_t frag_off, outer_ip_id, ip_id; @@ -313,15 +313,15 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, if (unlikely(INVALID_TCP_HDRLEN(pkt->l4_len))) return -1; - outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *); + outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); - vxlan_hdr = (struct vxlan_hdr *)((char *)udp_hdr + + vxlan_hdr = (struct rte_vxlan_hdr *)((char *)udp_hdr + sizeof(struct udp_hdr)); - eth_hdr = (struct ether_hdr *)((char *)vxlan_hdr + - sizeof(struct vxlan_hdr)); + eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); diff --git a/lib/librte_gro/gro_vxlan_tcp4.h b/lib/librte_gro/gro_vxlan_tcp4.h index 0cafb9211..7832942a6 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.h +++ b/lib/librte_gro/gro_vxlan_tcp4.h @@ -12,10 +12,10 @@ /* Header fields representing a VxLAN flow */ struct vxlan_tcp4_flow_key { struct tcp4_flow_key inner_key; - struct vxlan_hdr vxlan_hdr; + struct rte_vxlan_hdr vxlan_hdr; - struct ether_addr outer_eth_saddr; - struct ether_addr outer_eth_daddr; + struct rte_ether_addr outer_eth_saddr; + struct rte_ether_addr outer_eth_daddr; uint32_t outer_ip_src_addr; uint32_t outer_ip_dst_addr; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index a626a11e3..433f2c8bb 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -18,11 +18,11 @@ extern "C" { #include <rte_mbuf.h> /* Minimum GSO segment size for TCP based packets. */ -#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ +#define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ -#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct ether_hdr) + \ +#define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 946459c79..7a41788e2 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -451,7 +451,7 @@ kni_config_mac_address(uint16_t port_id, uint8_t mac_addr[]) RTE_LOG(INFO, KNI, "Configure mac address of %d", port_id); ret = rte_eth_dev_default_mac_addr_set(port_id, - (struct ether_addr *)mac_addr); + (struct rte_ether_addr *)mac_addr); if (ret < 0) RTE_LOG(ERR, KNI, "Failed to config mac_addr for port %d\n", port_id); diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index 877874a5e..adda9f700 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -9,9 +9,9 @@ #define RARP_PKT_SIZE 64 struct rte_mbuf * __rte_experimental rte_net_make_rarp_packet(struct rte_mempool *mpool, - const struct ether_addr *mac) + const struct rte_ether_addr *mac) { - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *rarp; struct rte_mbuf *mbuf; @@ -22,7 +22,8 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, if (mbuf == NULL) return NULL; - eth_hdr = (struct ether_hdr *)rte_pktmbuf_append(mbuf, RARP_PKT_SIZE); + eth_hdr = (struct rte_ether_hdr *) + rte_pktmbuf_append(mbuf, RARP_PKT_SIZE); if (eth_hdr == NULL) { rte_pktmbuf_free(mbuf); return NULL; diff --git a/lib/librte_net/rte_arp.h b/lib/librte_net/rte_arp.h index a94fa6a00..f17c52972 100644 --- a/lib/librte_net/rte_arp.h +++ b/lib/librte_net/rte_arp.h @@ -22,9 +22,9 @@ extern "C" { * ARP header IPv4 payload. */ struct rte_arp_ipv4 { - struct ether_addr arp_sha; /**< sender hardware address */ + struct rte_ether_addr arp_sha; /**< sender hardware address */ uint32_t arp_sip; /**< sender IP address */ - struct ether_addr arp_tha; /**< target hardware address */ + struct rte_ether_addr arp_tha; /**< target hardware address */ uint32_t arp_tip; /**< target IP address */ } __attribute__((__packed__)); @@ -65,7 +65,7 @@ struct rte_arp_hdr { */ struct rte_mbuf * __rte_experimental rte_net_make_rarp_packet(struct rte_mempool *mpool, - const struct ether_addr *mac); + const struct rte_ether_addr *mac); #ifdef __cplusplus } diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 3a87ff184..afdbaa1a7 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -54,7 +54,7 @@ extern "C" { * administrator and does not contain OUIs. * See http://standards.ieee.org/regauth/groupmac/tutorial.html */ -struct ether_addr { +struct rte_ether_addr { uint8_t addr_bytes[ETHER_ADDR_LEN]; /**< Addr bytes in tx order */ } __attribute__((__packed__)); @@ -75,8 +75,8 @@ struct ether_addr { * True (1) if the given two ethernet address are the same; * False (0) otherwise. */ -static inline int is_same_ether_addr(const struct ether_addr *ea1, - const struct ether_addr *ea2) +static inline int 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++) @@ -95,7 +95,7 @@ static inline int is_same_ether_addr(const struct ether_addr *ea1, * True (1) if the given ethernet address is filled with zeros; * false (0) otherwise. */ -static inline int is_zero_ether_addr(const struct ether_addr *ea) +static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -114,7 +114,7 @@ static inline int is_zero_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a unicast address; * false (0) otherwise. */ -static inline int is_unicast_ether_addr(const struct ether_addr *ea) +static inline int is_unicast_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_GROUP_ADDR) == 0; } @@ -129,7 +129,7 @@ static inline int is_unicast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a multicast address; * false (0) otherwise. */ -static inline int is_multicast_ether_addr(const struct ether_addr *ea) +static inline int is_multicast_ether_addr(const struct rte_ether_addr *ea) { return ea->addr_bytes[0] & ETHER_GROUP_ADDR; } @@ -144,7 +144,7 @@ static inline int is_multicast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a broadcast address; * false (0) otherwise. */ -static inline int is_broadcast_ether_addr(const struct ether_addr *ea) +static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) { const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; @@ -162,7 +162,7 @@ static inline int is_broadcast_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a universally assigned address; * false (0) otherwise. */ -static inline int is_universal_ether_addr(const struct ether_addr *ea) +static inline int is_universal_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) == 0; } @@ -177,7 +177,7 @@ static inline int is_universal_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is a locally assigned address; * false (0) otherwise. */ -static inline int is_local_admin_ether_addr(const struct ether_addr *ea) +static inline int is_local_admin_ether_addr(const struct rte_ether_addr *ea) { return (ea->addr_bytes[0] & ETHER_LOCAL_ADMIN_ADDR) != 0; } @@ -193,7 +193,7 @@ static inline int is_local_admin_ether_addr(const struct ether_addr *ea) * True (1) if the given ethernet address is valid; * false (0) otherwise. */ -static inline int is_valid_assigned_ether_addr(const struct ether_addr *ea) +static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) { return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); } @@ -222,8 +222,8 @@ static inline void eth_random_addr(uint8_t *addr) * @param ea_to * A pointer to a ether_addr structure where to copy the Ethernet address. */ -static inline void ether_addr_copy(const struct ether_addr *ea_from, - struct ether_addr *ea_to) +static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, + struct rte_ether_addr *ea_to) { #ifdef __INTEL_COMPILER uint16_t *from_words = (uint16_t *)(ea_from->addr_bytes); @@ -253,7 +253,7 @@ static inline void ether_addr_copy(const struct ether_addr *ea_from, */ static inline void ether_format_addr(char *buf, uint16_t size, - const struct ether_addr *eth_addr) + const struct rte_ether_addr *eth_addr) { snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", eth_addr->addr_bytes[0], @@ -268,9 +268,9 @@ ether_format_addr(char *buf, uint16_t size, * Ethernet header: Contains the destination address, source address * and frame type. */ -struct ether_hdr { - struct ether_addr d_addr; /**< Destination address. */ - struct ether_addr s_addr; /**< Source address. */ +struct rte_ether_hdr { + struct rte_ether_addr d_addr; /**< Destination address. */ + struct rte_ether_addr s_addr; /**< Source address. */ uint16_t ether_type; /**< Frame type. */ } __attribute__((__packed__)); @@ -279,7 +279,7 @@ struct ether_hdr { * Contains the 16-bit VLAN Tag Control Identifier and the Ethernet type * of the encapsulated frame. */ -struct vlan_hdr { +struct rte_vlan_hdr { uint16_t vlan_tci; /**< Priority (3) + CFI (1) + Identifier Code (12) */ uint16_t eth_proto;/**< Ethernet type of encapsulated frame. */ } __attribute__((__packed__)); @@ -289,7 +289,7 @@ struct vlan_hdr { * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and * Reserved fields (24 bits and 8 bits) */ -struct vxlan_hdr { +struct rte_vxlan_hdr { uint32_t vx_flags; /**< flag (8) + Reserved (24). */ uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ } __attribute__((__packed__)); @@ -311,7 +311,7 @@ struct vxlan_hdr { #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 vxlan_hdr)) +#define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -319,7 +319,7 @@ struct vxlan_hdr { * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network * Identifier and Reserved fields (16 bits and 8 bits). */ -struct vxlan_gpe_hdr { +struct rte_vxlan_gpe_hdr { uint8_t vx_flags; /**< flag (8). */ uint8_t reserved[2]; /**< Reserved (16). */ uint8_t proto; /**< next-protocol (8). */ @@ -336,7 +336,7 @@ struct vxlan_gpe_hdr { #define VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ #define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \ - sizeof(struct vxlan_gpe_hdr)) + sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ /** @@ -352,19 +352,19 @@ struct vxlan_gpe_hdr { */ static inline int rte_vlan_strip(struct rte_mbuf *m) { - struct ether_hdr *eh - = rte_pktmbuf_mtod(m, struct ether_hdr *); - struct vlan_hdr *vh; + struct rte_ether_hdr *eh + = 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)) return -1; - vh = (struct vlan_hdr *)(eh + 1); + vh = (struct rte_vlan_hdr *)(eh + 1); m->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED; m->vlan_tci = rte_be_to_cpu_16(vh->vlan_tci); /* Copy ether header over rather than moving whole packet */ - memmove(rte_pktmbuf_adj(m, sizeof(struct vlan_hdr)), + memmove(rte_pktmbuf_adj(m, sizeof(struct rte_vlan_hdr)), eh, 2 * ETHER_ADDR_LEN); return 0; @@ -384,8 +384,8 @@ static inline int rte_vlan_strip(struct rte_mbuf *m) */ static inline int rte_vlan_insert(struct rte_mbuf **m) { - struct ether_hdr *oh, *nh; - struct vlan_hdr *vh; + struct rte_ether_hdr *oh, *nh; + struct rte_vlan_hdr *vh; /* Can't insert header if mbuf is shared */ if (rte_mbuf_refcnt_read(*m) > 1) { @@ -398,16 +398,16 @@ static inline int rte_vlan_insert(struct rte_mbuf **m) *m = copy; } - oh = rte_pktmbuf_mtod(*m, struct ether_hdr *); - nh = (struct ether_hdr *) - rte_pktmbuf_prepend(*m, sizeof(struct vlan_hdr)); + oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *); + nh = (struct rte_ether_hdr *) + rte_pktmbuf_prepend(*m, sizeof(struct rte_vlan_hdr)); if (nh == NULL) return -ENOSPC; memmove(nh, oh, 2 * ETHER_ADDR_LEN); nh->ether_type = rte_cpu_to_be_16(ETHER_TYPE_VLAN); - vh = (struct vlan_hdr *) (nh + 1); + vh = (struct rte_vlan_hdr *) (nh + 1); vh->vlan_tci = rte_cpu_to_be_16((*m)->vlan_tci); (*m)->ol_flags &= ~(PKT_RX_VLAN_STRIPPED | PKT_TX_VLAN); diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 378a4126c..315c37c55 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -229,8 +229,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, struct rte_net_hdr_lens *hdr_lens, uint32_t layers) { struct rte_net_hdr_lens local_hdr_lens; - const struct ether_hdr *eh; - struct ether_hdr eh_copy; + const struct rte_ether_hdr *eh; + struct rte_ether_hdr eh_copy; uint32_t pkt_type = RTE_PTYPE_L2_ETHER; uint32_t off = 0; uint16_t proto; @@ -253,8 +253,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, goto l3; /* fast path if packet is IPv4 */ if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type = RTE_PTYPE_L2_ETHER_VLAN; vh = rte_pktmbuf_read(m, off, sizeof(*vh), &vh_copy); @@ -264,8 +264,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l2_len += sizeof(*vh); proto = vh->eth_proto; } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type = RTE_PTYPE_L2_ETHER_QINQ; vh = rte_pktmbuf_read(m, off + sizeof(*vh), sizeof(*vh), @@ -402,8 +402,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if (proto == rte_cpu_to_be_16(ETHER_TYPE_VLAN)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type &= ~RTE_PTYPE_INNER_L2_MASK; pkt_type |= RTE_PTYPE_INNER_L2_ETHER_VLAN; @@ -414,8 +414,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l2_len += sizeof(*vh); proto = vh->eth_proto; } else if (proto == rte_cpu_to_be_16(ETHER_TYPE_QINQ)) { - const struct vlan_hdr *vh; - struct vlan_hdr vh_copy; + const struct rte_vlan_hdr *vh; + struct rte_vlan_hdr vh_copy; pkt_type &= ~RTE_PTYPE_INNER_L2_MASK; pkt_type |= RTE_PTYPE_INNER_L2_ETHER_QINQ; diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 9a65f3ded..1e85cc9cf 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -438,7 +438,7 @@ encap_cfg_check(struct rte_table_action_encap_config *encap) } struct encap_ether_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; } __attribute__((__packed__)); #define VLAN(pcp, dei, vid) \ @@ -447,14 +447,14 @@ struct encap_ether_data { (((uint64_t)(vid)) & 0xFFFLLU)) \ struct encap_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; } __attribute__((__packed__)); struct encap_qinq_data { - struct ether_hdr ether; - struct vlan_hdr svlan; - struct vlan_hdr cvlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr svlan; + struct rte_vlan_hdr cvlan; } __attribute__((__packed__)); #define ETHER_TYPE_MPLS_UNICAST 0x8847 @@ -468,7 +468,7 @@ struct encap_qinq_data { (((uint64_t)(ttl)) & 0xFFLLU))) struct encap_mpls_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; uint32_t mpls[RTE_TABLE_ACTION_MPLS_LABELS_MAX]; uint32_t mpls_count; } __attribute__((__packed__)); @@ -483,46 +483,46 @@ struct pppoe_ppp_hdr { } __attribute__((__packed__)); struct encap_pppoe_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct pppoe_ppp_hdr pppoe_ppp; } __attribute__((__packed__)); #define IP_PROTO_UDP 17 struct encap_vxlan_ipv4_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct ipv4_hdr ipv4; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv4_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; struct ipv4_hdr ipv4; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { - struct ether_hdr ether; + struct rte_ether_hdr ether; struct ipv6_hdr ipv6; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_vlan_data { - struct ether_hdr ether; - struct vlan_hdr vlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr vlan; struct ipv6_hdr ipv6; struct udp_hdr udp; - struct vxlan_hdr vxlan; + struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_qinq_pppoe_data { - struct ether_hdr ether; - struct vlan_hdr svlan; - struct vlan_hdr cvlan; + struct rte_ether_hdr ether; + struct rte_vlan_hdr svlan; + struct rte_vlan_hdr cvlan; struct pppoe_ppp_hdr pppoe_ppp; } __attribute__((__packed__)); @@ -997,13 +997,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + sizeof(struct ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1027,13 +1027,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + sizeof(struct ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1057,10 +1057,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1083,10 +1083,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); udp_length = ether_length + - (sizeof(struct vxlan_hdr) + + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); @@ -1133,7 +1133,7 @@ pkt_work_encap(struct rte_mbuf *mbuf, case 1LLU << RTE_TABLE_ACTION_ENCAP_MPLS: { struct encap_mpls_data *mpls = data; - size_t size = sizeof(struct ether_hdr) + + size_t size = sizeof(struct rte_ether_hdr) + mpls->mpls_count * 4; encap(ip, data, size); diff --git a/lib/librte_pipeline/rte_table_action.h b/lib/librte_pipeline/rte_table_action.h index cf6eeaa30..ef45a3023 100644 --- a/lib/librte_pipeline/rte_table_action.h +++ b/lib/librte_pipeline/rte_table_action.h @@ -387,8 +387,8 @@ enum rte_table_action_encap_type { /** Pre-computed Ethernet header fields for encapsulation action. */ struct rte_table_action_ether_hdr { - struct ether_addr da; /**< Destination address. */ - struct ether_addr sa; /**< Source address. */ + struct rte_ether_addr da; /**< Destination address. */ + struct rte_ether_addr sa; /**< Source address. */ }; /** Pre-computed VLAN header fields for encapsulation action. */ diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index e9138dfab..d49c3b8a9 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -308,7 +308,7 @@ struct virtio_net { uint64_t log_size; uint64_t log_base; uint64_t log_addr; - struct ether_addr mac; + struct rte_ether_addr mac; uint16_t mtu; struct vhost_device_ops const *notify_ops; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index a6a33a101..f97ec76f9 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -969,18 +969,19 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) struct ipv4_hdr *ipv4_hdr; struct ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; - struct ether_hdr *eth_hdr; + struct rte_ether_hdr *eth_hdr; uint16_t ethertype; - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - m->l2_len = sizeof(struct ether_hdr); + m->l2_len = sizeof(struct rte_ether_hdr); ethertype = rte_be_to_cpu_16(eth_hdr->ether_type); if (ethertype == ETHER_TYPE_VLAN) { - struct vlan_hdr *vlan_hdr = (struct vlan_hdr *)(eth_hdr + 1); + struct rte_vlan_hdr *vlan_hdr = + (struct rte_vlan_hdr *)(eth_hdr + 1); - m->l2_len += sizeof(struct vlan_hdr); + m->l2_len += sizeof(struct rte_vlan_hdr); ethertype = rte_be_to_cpu_16(vlan_hdr->eth_proto); } -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 03/15] net: add rte prefix to ether structures 2019-05-21 16:13 ` [dpdk-dev] [PATCH 03/15] net: add rte prefix to ether structures Olivier Matz @ 2019-05-29 8:39 ` David Marchand 0 siblings, 0 replies; 107+ messages in thread From: David Marchand @ 2019-05-29 8:39 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, Stephen Hemminger, Yigit, Ferruh On Tue, May 21, 2019 at 6:38 PM Olivier Matz <olivier.matz@6wind.com> wrote: > diff --git a/drivers/net/tap/tap_bpf_program.c > b/drivers/net/tap/tap_bpf_program.c > index 532e8838f..2b1dba15b 100644 > --- a/drivers/net/tap/tap_bpf_program.c > +++ b/drivers/net/tap/tap_bpf_program.c > @@ -37,7 +37,7 @@ > #define KEY_IDX 0 > #define BPF_MAP_ID_KEY 1 > > -struct vlan_hdr { > +struct rte_vlan_hdr { > __be16 proto; > __be16 tci; > }; > @@ -141,12 +141,12 @@ rss_l3_l4(struct __sk_buff *skb) > > /* Get correct proto for 802.1ad */ > if (skb->vlan_present && skb->vlan_proto == htons(ETH_P_8021AD)) { > - if (data + ETH_ALEN * 2 + sizeof(struct vlan_hdr) + > + if (data + ETH_ALEN * 2 + sizeof(struct rte_vlan_hdr) + > sizeof(proto) > data_end) > return TC_ACT_OK; > proto = *(__u16 *)(data + ETH_ALEN * 2 + > - sizeof(struct vlan_hdr)); > - off += sizeof(struct vlan_hdr); > + sizeof(struct rte_vlan_hdr)); > + off += sizeof(struct rte_vlan_hdr); > } > > if (proto == htons(ETH_P_IP)) { > > I think this part should have been skipped. But I am not able to compile the bpf program before this patch anyway. -- David Marchand ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 04/15] net: add rte prefix to ether functions 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (2 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 03/15] net: add rte prefix to ether structures Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 05/15] net: add rte prefix to ether defines Olivier Matz ` (13 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to functions: - rename is_same_ether_addr() as rte_is_same_ether_addr(). - rename is_zero_ether_addr() as rte_is_zero_ether_addr(). - rename is_unicast_ether_addr() as rte_is_unicast_ether_addr(). - rename is_multicast_ether_addr() as rte_is_multicast_ether_addr(). - rename is_broadcast_ether_addr() as rte_is_broadcast_ether_addr(). - rename is_universal_ether_addr() as rte_is_universal_ether_addr(). - rename is_local_admin_ether_addr() as rte_is_local_admin_ether_addr(). - rename is_valid_assigned_ether_addr() as rte_is_valid_assigned_ether_addr(). - rename eth_random_addr() as rte_eth_random_addr(). - rename ether_addr_copy() as rte_ether_addr_copy(). - rename ether_format_addr() as rte_ether_format_addr(). Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/cmdline.c | 6 +-- app/test-pmd/config.c | 8 ++-- app/test-pmd/csumonly.c | 4 +- app/test-pmd/flowgen.c | 4 +- app/test-pmd/icmpecho.c | 27 +++++++----- app/test-pmd/ieee1588fwd.c | 6 +-- app/test-pmd/macfwd.c | 4 +- app/test-pmd/macswap.h | 6 +-- app/test-pmd/txonly.c | 4 +- app/test-pmd/util.c | 2 +- app/test/packet_burst_generator.c | 8 ++-- app/test/test_link_bonding.c | 18 ++++---- app/test/test_link_bonding_mode4.c | 29 +++++++------ app/test/test_pmd_perf.c | 2 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 4 +- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 2 +- .../sample_app_ug/l2_forward_real_virtual.rst | 2 +- doc/guides/sample_app_ug/link_status_intr.rst | 2 +- drivers/net/atlantic/atl_ethdev.c | 2 +- drivers/net/atlantic/hw_atl/hw_atl_utils.c | 4 +- drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 2 +- drivers/net/avp/avp_ethdev.c | 6 +-- drivers/net/axgbe/axgbe_ethdev.c | 6 +-- drivers/net/bnx2x/bnx2x.c | 4 +- drivers/net/bnx2x/bnx2x_vfpf.c | 6 +-- drivers/net/bnxt/bnxt_flow.c | 12 +++--- drivers/net/bnxt/bnxt_hwrm.c | 2 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 22 +++++----- drivers/net/bonding/rte_eth_bond_alb.c | 42 +++++++++++-------- drivers/net/bonding/rte_eth_bond_pmd.c | 18 ++++---- drivers/net/cxgbe/base/adapter.h | 2 +- drivers/net/cxgbe/cxgbe_flow.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 2 +- drivers/net/dpaa2/dpaa2_ethdev.c | 8 ++-- drivers/net/e1000/em_ethdev.c | 2 +- drivers/net/e1000/igb_ethdev.c | 8 ++-- drivers/net/e1000/igb_flow.c | 8 ++-- drivers/net/e1000/igb_pf.c | 6 +-- drivers/net/ena/ena_ethdev.c | 3 +- drivers/net/enetc/enetc_ethdev.c | 2 +- drivers/net/enic/enic_ethdev.c | 13 +++--- drivers/net/enic/enic_main.c | 2 +- drivers/net/failsafe/failsafe.c | 6 +-- drivers/net/failsafe/failsafe_ether.c | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 12 +++--- drivers/net/i40e/i40e_ethdev.c | 43 ++++++++++--------- drivers/net/i40e/i40e_ethdev_vf.c | 17 ++++---- drivers/net/i40e/i40e_flow.c | 24 +++++------ drivers/net/i40e/i40e_pf.c | 6 +-- drivers/net/i40e/rte_pmd_i40e.c | 10 ++--- drivers/net/iavf/iavf_ethdev.c | 14 +++---- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_ethdev.c | 16 ++++---- drivers/net/ipn3ke/ipn3ke_representor.c | 9 ++-- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++-- drivers/net/ixgbe/ixgbe_flow.c | 8 ++-- drivers/net/ixgbe/ixgbe_pf.c | 5 ++- drivers/net/ixgbe/rte_pmd_ixgbe.c | 3 +- drivers/net/kni/rte_eth_kni.c | 2 +- drivers/net/liquidio/lio_ethdev.c | 2 +- drivers/net/mlx4/mlx4_ethdev.c | 2 +- drivers/net/mlx4/mlx4_flow.c | 2 +- drivers/net/mlx5/mlx5_flow_tcf.c | 4 +- drivers/net/mlx5/mlx5_mac.c | 4 +- drivers/net/mlx5/mlx5_nl.c | 6 +-- drivers/net/mvneta/mvneta_ethdev.c | 6 +-- drivers/net/mvpp2/mrvl_ethdev.c | 6 +-- drivers/net/netvsc/hn_rxtx.c | 4 +- drivers/net/netvsc/hn_vf.c | 2 +- drivers/net/nfb/nfb_ethdev.c | 6 +-- drivers/net/nfp/nfp_net.c | 6 +-- drivers/net/null/rte_eth_null.c | 2 +- drivers/net/qede/qede_ethdev.c | 29 ++++++------- drivers/net/sfc/sfc_ethdev.c | 6 +-- drivers/net/sfc/sfc_flow.c | 10 ++--- drivers/net/sfc/sfc_port.c | 2 +- drivers/net/softnic/rte_eth_softnic_flow.c | 4 +- drivers/net/szedata2/rte_eth_szedata2.c | 2 +- drivers/net/tap/rte_eth_tap.c | 13 +++--- drivers/net/tap/tap_flow.c | 4 +- drivers/net/thunderx/nicvf_ethdev.c | 6 +-- drivers/net/vdev_netvsc/vdev_netvsc.c | 4 +- drivers/net/vhost/rte_eth_vhost.c | 4 +- drivers/net/virtio/virtio_ethdev.c | 10 ++--- drivers/net/virtio/virtio_rxtx.c | 4 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 4 +- examples/bond/main.c | 9 ++-- examples/ethtool/ethtool-app/main.c | 4 +- examples/ethtool/lib/rte_ethtool.c | 2 +- examples/eventdev_pipeline/pipeline_common.h | 4 +- examples/flow_filtering/main.c | 2 +- examples/ip_fragmentation/main.c | 5 ++- examples/ip_reassembly/main.c | 4 +- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/ipv4_multicast/main.c | 6 +-- examples/kni/main.c | 2 +- examples/l2fwd-crypto/main.c | 2 +- examples/l2fwd-jobstats/main.c | 2 +- examples/l2fwd-keepalive/main.c | 2 +- examples/l2fwd/main.c | 2 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 8 ++-- examples/l3fwd-vf/main.c | 4 +- examples/l3fwd/l3fwd_em.h | 6 ++- examples/l3fwd/l3fwd_lpm.h | 6 ++- examples/l3fwd/main.c | 4 +- examples/link_status_interrupt/main.c | 2 +- examples/performance-thread/l3fwd-thread/main.c | 42 ++++++++++--------- examples/ptpclient/ptpclient.c | 2 +- examples/quota_watermark/qw/main.c | 2 +- examples/tep_termination/vxlan_setup.c | 16 ++++---- examples/vhost/main.c | 4 +- examples/vmdq/main.c | 2 +- examples/vmdq_dcb/main.c | 2 +- lib/librte_ethdev/rte_class_eth.c | 2 +- lib/librte_ethdev/rte_ethdev.c | 20 ++++----- lib/librte_gro/gro_tcp4.c | 8 ++-- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 21 +++++----- lib/librte_net/rte_arp.c | 6 +-- lib/librte_net/rte_ether.h | 24 +++++------ lib/librte_pipeline/rte_table_action.c | 48 +++++++++++++--------- 122 files changed, 506 insertions(+), 444 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 90e35022e..1fb609940 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -8813,8 +8813,8 @@ cmd_tunnel_filter_parsed(void *parsed_result, memset(&tunnel_filter_conf, 0, sizeof(tunnel_filter_conf)); - ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); - ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&res->outer_mac, &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&res->inner_mac, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.inner_vlan = res->inner_vlan; if (res->ip_value.family == AF_INET) { @@ -12472,7 +12472,7 @@ static void cmd_mcast_addr_parsed(void *parsed_result, { struct cmd_mcast_addr_result *res = parsed_result; - if (!is_multicast_ether_addr(&res->mc_addr)) { + if (!rte_is_multicast_ether_addr(&res->mc_addr)) { printf("Invalid multicast addr %02X:%02X:%02X:%02X:%02X:%02X\n", res->mc_addr.addr_bytes[0], res->mc_addr.addr_bytes[1], res->mc_addr.addr_bytes[2], res->mc_addr.addr_bytes[3], diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 03ce502ba..7a67690f2 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -111,7 +111,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3536,7 +3536,7 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) * in the pool of multicast addresses. */ for (i = 0; i < port->mc_addr_nb; i++) { - if (is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) { + if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) { printf("multicast address already filtered by port\n"); return; } @@ -3544,7 +3544,7 @@ mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr) if (mcast_addr_pool_extend(port) != 0) return; - ether_addr_copy(mc_addr, &port->mc_addr_pool[i]); + rte_ether_addr_copy(mc_addr, &port->mc_addr_pool[i]); eth_port_multicast_addr_list_set(port_id); } @@ -3563,7 +3563,7 @@ mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr) * Search the pool of multicast MAC addresses for the removed address. */ for (i = 0; i < port->mc_addr_nb; i++) { - if (is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) + if (rte_is_same_ether_addr(mc_addr, &port->mc_addr_pool[i])) break; } if (i == port->mc_addr_nb) { diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 481b91a26..8de37c87e 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -767,9 +767,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) * and inner headers */ eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); parse_ethernet(eth_hdr, &info); l3_hdr = (char *)eth_hdr + info.l2_len; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index ac56ca1d8..3f29e9408 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -171,8 +171,8 @@ pkt_burst_flow_gen(struct fwd_stream *fs) /* Initialize Ethernet header. */ eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ether_addr_copy(&cfg_ether_dst, ð_hdr->d_addr); - ether_addr_copy(&cfg_ether_src, ð_hdr->s_addr); + 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); /* Initialize IP header. */ diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 3cc4d25a4..f41179208 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -225,7 +225,7 @@ ether_addr_dump(const char *what, const struct rte_ether_addr *ea) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, ea); if (what) printf("%s", what); printf("%s", buf); @@ -370,12 +370,14 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) continue; } if (verbose_level > 0) { - ether_addr_copy(&arp_h->arp_data.arp_sha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_sha, + ð_addr); ether_addr_dump(" sha=", ð_addr); ip_addr = arp_h->arp_data.arp_sip; ipv4_addr_dump(" sip=", ip_addr); printf("\n"); - ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_tha, + ð_addr); ether_addr_dump(" tha=", ð_addr); ip_addr = arp_h->arp_data.arp_tip; ipv4_addr_dump(" tip=", ip_addr); @@ -391,15 +393,18 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) */ /* Use source MAC address as destination MAC address. */ - ether_addr_copy(ð_h->s_addr, ð_h->d_addr); + rte_ether_addr_copy(ð_h->s_addr, ð_h->d_addr); /* Set source MAC address with MAC address of TX port */ - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_h->s_addr); arp_h->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); - ether_addr_copy(&arp_h->arp_data.arp_tha, ð_addr); - ether_addr_copy(&arp_h->arp_data.arp_sha, &arp_h->arp_data.arp_tha); - ether_addr_copy(ð_h->s_addr, &arp_h->arp_data.arp_sha); + rte_ether_addr_copy(&arp_h->arp_data.arp_tha, + ð_addr); + rte_ether_addr_copy(&arp_h->arp_data.arp_sha, + &arp_h->arp_data.arp_tha); + rte_ether_addr_copy(ð_h->s_addr, + &arp_h->arp_data.arp_sha); /* Swap IP addresses in ARP payload */ ip_addr = arp_h->arp_data.arp_sip; @@ -456,9 +461,9 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ - ether_addr_copy(ð_h->s_addr, ð_addr); - ether_addr_copy(ð_h->d_addr, ð_h->s_addr); - ether_addr_copy(ð_addr, ð_h->d_addr); + rte_ether_addr_copy(ð_h->s_addr, ð_addr); + rte_ether_addr_copy(ð_h->d_addr, ð_h->s_addr); + rte_ether_addr_copy(ð_addr, ð_h->d_addr); ip_addr = ip_h->src_addr; if (is_multicast_ipv4_addr(ip_h->dst_addr)) { uint32_t ip_src; diff --git a/app/test-pmd/ieee1588fwd.c b/app/test-pmd/ieee1588fwd.c index c6aa3c618..2b7003be4 100644 --- a/app/test-pmd/ieee1588fwd.c +++ b/app/test-pmd/ieee1588fwd.c @@ -178,9 +178,9 @@ ieee1588_packet_fwd(struct fwd_stream *fs) port_ieee1588_rx_timestamp_check(fs->rx_port, timesync_index); /* Swap dest and src mac addresses. */ - ether_addr_copy(ð_hdr->d_addr, &addr); - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - ether_addr_copy(&addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->d_addr, &addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&addr, ð_hdr->s_addr); /* Forward PTP packet with hardware TX timestamp */ mb->ol_flags |= PKT_TX_IEEE1588_TMST; diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index 631f86f3e..f15149252 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -92,9 +92,9 @@ pkt_burst_mac_forward(struct fwd_stream *fs) void *)); mb = pkts_burst[i]; eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], + rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr->d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, + rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr->s_addr); mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; diff --git a/app/test-pmd/macswap.h b/app/test-pmd/macswap.h index d53e5d482..013844156 100644 --- a/app/test-pmd/macswap.h +++ b/app/test-pmd/macswap.h @@ -29,9 +29,9 @@ do_macswap(struct rte_mbuf *pkts[], uint16_t nb, eth_hdr = rte_pktmbuf_mtod(mb, struct rte_ether_hdr *); /* Swap dest and src mac addresses. */ - ether_addr_copy(ð_hdr->d_addr, &addr); - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - ether_addr_copy(&addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->d_addr, &addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&addr, ð_hdr->s_addr); mbuf_field_set(mb, ol_flags); } diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index e558b4018..eb3a245d2 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -266,8 +266,8 @@ pkt_burst_transmit(struct fwd_stream *fs) /* * Initialize Ethernet header. */ - ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ð_hdr.d_addr); - ether_addr_copy(&ports[fs->tx_port].eth_addr, ð_hdr.s_addr); + 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); if (rte_mempool_get_bulk(mbp, (void **)pkts_burst, diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 0544b8e53..55f3844dd 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -17,7 +17,7 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 a05e3c86c..ba94e6193 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -58,8 +58,8 @@ initialize_eth_header(struct rte_ether_hdr *eth_hdr, struct rte_ether_addr *dst_mac, uint16_t ether_type, uint8_t vlan_enabled, uint16_t van_id) { - ether_addr_copy(dst_mac, ð_hdr->d_addr); - ether_addr_copy(src_mac, ð_hdr->s_addr); + rte_ether_addr_copy(dst_mac, ð_hdr->d_addr); + rte_ether_addr_copy(src_mac, ð_hdr->s_addr); if (vlan_enabled) { struct rte_vlan_hdr *vhdr = (struct rte_vlan_hdr *)( @@ -86,9 +86,9 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, arp_hdr->arp_hlen = ETHER_ADDR_LEN; arp_hdr->arp_plen = sizeof(uint32_t); arp_hdr->arp_opcode = rte_cpu_to_be_16(opcode); - ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(src_mac, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = src_ip; - ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); + rte_ether_addr_copy(dst_mac, &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = dst_ip; } diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index e4946dcca..5a7f45f94 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -4510,7 +4510,7 @@ test_alb_change_mac_in_reply_sent(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); @@ -4583,12 +4583,14 @@ test_alb_change_mac_in_reply_sent(void) sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { - if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac1, + &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac2, + &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } @@ -4629,7 +4631,7 @@ test_alb_reply_from_client(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); @@ -4710,12 +4712,14 @@ test_alb_reply_from_client(void) sizeof(struct rte_ether_hdr)); if (slave_idx%2 == 0) { - if (!is_same_ether_addr(slave_mac1, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac1, + &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } } else { - if (!is_same_ether_addr(slave_mac2, &arp_pkt->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(slave_mac2, + &arp_pkt->arp_data.arp_sha)) { retval = -1; goto test_end; } @@ -4762,7 +4766,7 @@ test_alb_receive_vlan_reply(void) MAX_PKT_BURST); } - ether_addr_copy( + rte_ether_addr_copy( rte_eth_devices[test_params->bonded_port_id].data->mac_addrs, &bond_mac); diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index de23dd959..0bb81fd2e 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -232,7 +232,7 @@ add_slave(struct slave_conf *slave, uint8_t start) RTE_VERIFY(slave->bonded == 0); RTE_VERIFY(slave->port_id != INVALID_PORT_ID); - ether_addr_copy(&slave_mac_default, &addr); + rte_ether_addr_copy(&slave_mac_default, &addr); addr.addr_bytes[ETHER_ADDR_LEN - 1] = slave->port_id; rte_eth_dev_mac_addr_remove(slave->port_id, &addr); @@ -253,7 +253,7 @@ add_slave(struct slave_conf *slave, uint8_t start) } rte_eth_macaddr_get(slave->port_id, &addr_check); - TEST_ASSERT_EQUAL(is_same_ether_addr(&addr, &addr_check), 1, + TEST_ASSERT_EQUAL(rte_is_same_ether_addr(&addr, &addr_check), 1, "Slave MAC address is not as expected"); RTE_VERIFY(slave->lacp_parnter_state == 0); @@ -491,7 +491,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) slow_hdr = rte_pktmbuf_mtod(pkt, struct slow_protocol_frame *); /* Change source address to partner address */ - ether_addr_copy(&parnter_mac_default, &slow_hdr->eth_hdr.s_addr); + 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; lacp = (struct lacpdu *) &slow_hdr->slow_protocol; @@ -503,7 +503,7 @@ make_lacp_reply(struct slave_conf *slave, struct rte_mbuf *pkt) lacp->partner.state = lacp->actor.state; - ether_addr_copy(&parnter_system, &lacp->actor.port_params.system); + rte_ether_addr_copy(&parnter_system, &lacp->actor.port_params.system); lacp->actor.state = STATE_LACP_ACTIVE | STATE_SYNCHRONIZATION | STATE_AGGREGATION | @@ -812,7 +812,7 @@ test_mode4_rx(void) TEST_ASSERT_SUCCESS(retval, "Initial handshake failed"); rte_eth_macaddr_get(test_params.bonded_port_id, &bonded_mac); - ether_addr_copy(&bonded_mac, &dst_mac); + rte_ether_addr_copy(&bonded_mac, &dst_mac); /* Assert that dst address is not bonding address. Do not set the * least significant bit of the zero byte as this would create a @@ -847,7 +847,8 @@ test_mode4_rx(void) for (i = 0; i < expected_pkts_cnt; i++) { hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); - cnt[is_same_ether_addr(&hdr->d_addr, &bonded_mac)]++; + cnt[rte_is_same_ether_addr(&hdr->d_addr, + &bonded_mac)]++; } free_pkts(pkts, expected_pkts_cnt); @@ -891,7 +892,8 @@ test_mode4_rx(void) for (i = 0; i < expected_pkts_cnt; i++) { hdr = rte_pktmbuf_mtod(pkts[i], struct rte_ether_hdr *); - eq_cnt += is_same_ether_addr(&hdr->d_addr, &bonded_mac); + eq_cnt += rte_is_same_ether_addr(&hdr->d_addr, + &bonded_mac); } free_pkts(pkts, expected_pkts_cnt); @@ -1133,10 +1135,11 @@ init_marker(struct rte_mbuf *pkt, struct slave_conf *slave) struct marker_header *); /* Copy multicast destination address */ - ether_addr_copy(&slow_protocol_mac_addr, &marker_hdr->eth_hdr.d_addr); + rte_ether_addr_copy(&slow_protocol_mac_addr, + &marker_hdr->eth_hdr.d_addr); /* Init source address */ - ether_addr_copy(&parnter_mac_default, &marker_hdr->eth_hdr.s_addr); + 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.ether_type = rte_cpu_to_be_16(ETHER_TYPE_SLOW); @@ -1361,8 +1364,8 @@ test_mode4_ext_ctrl(void) }, }; - ether_addr_copy(&parnter_system, &src_mac); - ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); + rte_ether_addr_copy(&parnter_system, &src_mac); + 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); @@ -1415,8 +1418,8 @@ test_mode4_ext_lacp(void) }, }; - ether_addr_copy(&parnter_system, &src_mac); - ether_addr_copy(&slow_protocol_mac_addr, &dst_mac); + rte_ether_addr_copy(&parnter_system, &src_mac); + 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); diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index b85da914c..a0c3eb956 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -174,7 +174,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 1fe6bf113..0b44ab90b 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -227,8 +227,8 @@ The actual packet transmission is done in the mcast_send_pkt() function: RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_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); /* Put new packet into the output queue */ diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index 02c1367f5..8d0c38721 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -467,7 +467,7 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); l2fwd_send_packet(m, (uint8_t) dst_port); } diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index 54e5b8022..bede06ed1 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -383,7 +383,7 @@ Naturally, the number of ports in the portmask must be even, otherwise, the appl /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); l2fwd_send_packet(m, (uint8_t) dst_port); } diff --git a/doc/guides/sample_app_ug/link_status_intr.rst b/doc/guides/sample_app_ug/link_status_intr.rst index 3fd043e82..cfb1bcd58 100644 --- a/doc/guides/sample_app_ug/link_status_intr.rst +++ b/doc/guides/sample_app_ug/link_status_intr.rst @@ -324,7 +324,7 @@ The processing is very simple: processes the TX port from the RX port and then r *((uint64_t *)tmp) = 0x000000000002 + (dst_port << 40); /* src addr */ - ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); lsi_send_packet(m, dst_port); } diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c index 9460318ae..6b395806c 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -1578,7 +1578,7 @@ static int atl_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, uint32_t index __rte_unused, uint32_t pool __rte_unused) { - if (is_zero_ether_addr(mac_addr)) { + if (rte_is_zero_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); return -EINVAL; } diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/atlantic/hw_atl/hw_atl_utils.c index 26a53a203..84d11ab3a 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils.c @@ -657,7 +657,7 @@ static int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self, mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct rte_ether_addr *)mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mac_addr, (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { @@ -868,7 +868,7 @@ static int aq_fw1x_set_wol(struct aq_hw_s *self, bool wol_enabled, u8 *mac) prpc->msg_wol.pattern_id = 1U; prpc->msg_wol.wol_packet_type = 2U; /* Magic Packet */ - ether_addr_copy((struct rte_ether_addr *)mac, + rte_ether_addr_copy((struct rte_ether_addr *)mac, (struct rte_ether_addr *)&prpc->msg_wol.wol_pattern); } else { rpc_size = sizeof(prpc->msg_id) + sizeof(prpc->msg_del_id); diff --git a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c index 55b5ce3e3..70d6e14bb 100644 --- a/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +++ b/drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c @@ -228,7 +228,7 @@ int aq_fw2x_get_mac_permanent(struct aq_hw_s *self, u8 *mac) mac_addr[1] = rte_constant_bswap32(mac_addr[1]); } - ether_addr_copy((struct rte_ether_addr *)mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)mac_addr, (struct rte_ether_addr *)mac); if ((mac[0] & 0x01U) || ((mac[0] | mac[1] | mac[2]) == 0x00U)) { diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 69a70d2cc..38e5eae05 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -1014,7 +1014,7 @@ eth_avp_dev_init(struct rte_eth_dev *eth_dev) } /* Get a mac from device config */ - ether_addr_copy(&avp->ethaddr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&avp->ethaddr, ð_dev->data->mac_addrs[0]); return 0; } @@ -1216,12 +1216,12 @@ _avp_mac_filter(struct avp_dev *avp, struct rte_mbuf *m) return 0; } - if (likely(is_broadcast_ether_addr(ð->d_addr))) { + if (likely(rte_is_broadcast_ether_addr(ð->d_addr))) { /* allow all broadcast packets */ return 0; } - if (likely(is_multicast_ether_addr(ð->d_addr))) { + if (likely(rte_is_multicast_ether_addr(ð->d_addr))) { /* allow all multicast packets */ return 0; } diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index e89c0ec2c..237b75c5d 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -634,11 +634,11 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } - if (!is_valid_assigned_ether_addr(&pdata->mac_addr)) - eth_random_addr(pdata->mac_addr.addr_bytes); + if (!rte_is_valid_assigned_ether_addr(&pdata->mac_addr)) + rte_eth_random_addr(pdata->mac_addr.addr_bytes); /* Copy the permanent MAC address */ - ether_addr_copy(&pdata->mac_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&pdata->mac_addr, ð_dev->data->mac_addrs[0]); /* Clock settings */ pdata->sysclk_rate = AXGBE_V2_DMA_CLOCK_FREQ; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 17b6817b6..39d30913b 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2214,8 +2214,8 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_parse_bd = &txq->tx_ring[TX_BD(bd_prod, txq)].parse_bd_e2; - if (is_multicast_ether_addr(&eh->d_addr)) { - if (is_broadcast_ether_addr(&eh->d_addr)) + if (rte_is_multicast_ether_addr(&eh->d_addr)) { + if (rte_is_broadcast_ether_addr(&eh->d_addr)) mac_type = BROADCAST_ADDRESS; else mac_type = MULTICAST_ADDRESS; diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c index cd5522d03..7cf738a82 100644 --- a/drivers/net/bnx2x/bnx2x_vfpf.c +++ b/drivers/net/bnx2x/bnx2x_vfpf.c @@ -300,11 +300,11 @@ int bnx2x_vf_get_resources(struct bnx2x_softc *sc, uint8_t tx_count, uint8_t rx_ sc->igu_sb_cnt, sc->igu_base_sb); strncpy(sc->fw_ver, sc_resp.fw_ver, sizeof(sc->fw_ver)); - if (is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) - ether_addr_copy(&sc_resp.resc.current_mac_addr, + if (rte_is_valid_assigned_ether_addr(&sc_resp.resc.current_mac_addr)) + rte_ether_addr_copy(&sc_resp.resc.current_mac_addr, (struct rte_ether_addr *)sc->link_params.mac_addr); else - eth_random_addr(sc->link_params.mac_addr); + rte_eth_random_addr(sc->link_params.mac_addr); out: bnx2x_vf_finalize(sc, &acq->first_tlv); diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 1afe67407..a1f527d4f 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -187,10 +187,10 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, * Destination MAC address mask must not be partially * set. Should be all 1's or all 0's. */ - if ((!is_zero_ether_addr(ð_mask->src) && - !is_broadcast_ether_addr(ð_mask->src)) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if ((!rte_is_zero_ether_addr(ð_mask->src) && + !rte_is_broadcast_ether_addr(ð_mask->src)) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -209,7 +209,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, return -rte_errno; } - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { rte_memcpy(filter->dst_macaddr, ð_spec->dst, 6); en |= use_ntuple ? @@ -217,7 +217,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, EM_FLOW_ALLOC_INPUT_EN_DST_MACADDR; } - if (is_broadcast_ether_addr(ð_mask->src)) { + if (rte_is_broadcast_ether_addr(ð_mask->src)) { rte_memcpy(filter->src_macaddr, ð_spec->src, 6); en |= use_ntuple ? diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 59e75b0be..e2fe4f7a0 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -2586,7 +2586,7 @@ static void add_random_mac_if_needed(struct bnxt *bp, if (memcmp(mac.addr_bytes, "\x00\x00\x00\x00\x00", 6) == 0) { cfg_req->enables |= rte_cpu_to_le_32(HWRM_FUNC_CFG_INPUT_ENABLES_DFLT_MAC_ADDR); - eth_random_addr(cfg_req->dflt_mac_addr); + 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); diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 51bf3f52e..6077c3dc8 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -322,7 +322,7 @@ rx_machine(struct bond_dev_private *internals, uint16_t slave_id, agg = &bond_mode_8023ad_ports[port->aggregator_port_id]; bool match = port->actor.system_priority == lacp->partner.port_params.system_priority && - is_same_ether_addr(&agg->actor.system, + rte_is_same_ether_addr(&agg->actor.system, &lacp->partner.port_params.system) && port->actor.port_priority == lacp->partner.port_params.port_priority && @@ -575,7 +575,7 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) hdr = rte_pktmbuf_mtod(lacp_pkt, struct lacpdu_header *); /* Source and destination MAC */ - ether_addr_copy(&lacp_mac_addr, &hdr->eth_hdr.d_addr); + 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); @@ -592,7 +592,8 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) memcpy(&hdr->lacpdu.actor.port_params, &port->actor, sizeof(port->actor)); agg = &bond_mode_8023ad_ports[port->aggregator_port_id]; - ether_addr_copy(&agg->actor.system, &hdr->lacpdu.actor.port_params.system); + rte_ether_addr_copy(&agg->actor.system, + &hdr->lacpdu.actor.port_params.system); lacpdu->actor.state = port->actor_state; /* PARTNER */ @@ -694,9 +695,10 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) * ID (MAC address). */ if ((agg->actor.key == port->actor.key && agg->partner.system_priority == port->partner.system_priority && - is_same_ether_addr(&agg->partner.system, &port->partner.system) == 1 + rte_is_same_ether_addr(&agg->partner.system, + &port->partner.system) == 1 && (agg->partner.key == port->partner.key)) && - is_zero_ether_addr(&port->partner.system) != 1 && + rte_is_zero_ether_addr(&port->partner.system) != 1 && (agg->actor.key & rte_cpu_to_be_16(BOND_LINK_FULL_DUPLEX_KEY)) != 0) { @@ -791,7 +793,7 @@ rx_machine_update(struct bond_dev_private *internals, uint16_t slave_id, RTE_ASSERT(lacp->lacpdu.subtype == SLOW_SUBTYPE_LACP); partner = &lacp->lacpdu.partner; - if (is_same_ether_addr(&partner->port_params.system, + if (rte_is_same_ether_addr(&partner->port_params.system, &internals->mode4.mac_addr)) { /* This LACP frame is sending to the bonding port * so pass it to rx_machine. @@ -842,8 +844,8 @@ bond_mode_8023ad_periodic_cb(void *arg) SM_FLAG_SET(port, NTT); } - if (!is_same_ether_addr(&port->actor.system, &slave_addr)) { - ether_addr_copy(&slave_addr, &port->actor.system); + if (!rte_is_same_ether_addr(&port->actor.system, &slave_addr)) { + rte_ether_addr_copy(&slave_addr, &port->actor.system); if (port->aggregator_port_id == slave_id) SM_FLAG_SET(port, NTT); } @@ -1055,10 +1057,10 @@ bond_mode_8023ad_mac_address_update(struct rte_eth_dev *bond_dev) slave = &bond_mode_8023ad_ports[slave_id]; rte_eth_macaddr_get(slave_id, &slave_addr); - if (is_same_ether_addr(&slave_addr, &slave->actor.system)) + if (rte_is_same_ether_addr(&slave_addr, &slave->actor.system)) continue; - ether_addr_copy(&slave_addr, &slave->actor.system); + rte_ether_addr_copy(&slave_addr, &slave->actor.system); /* Do nothing if this port is not an aggregator. In other case * Set NTT flag on every port that use this aggregator. */ if (slave->aggregator_port_id != slave_id) diff --git a/drivers/net/bonding/rte_eth_bond_alb.c b/drivers/net/bonding/rte_eth_bond_alb.c index da0b062a0..00d6b50e4 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -102,17 +102,21 @@ void bond_mode_alb_arp_recv(struct rte_ether_hdr *eth_h, uint16_t offset, if (client_info->in_use == 0 || client_info->app_ip != arp->arp_data.arp_tip || client_info->cli_ip != arp->arp_data.arp_sip || - !is_same_ether_addr(&client_info->cli_mac, &arp->arp_data.arp_sha) || + !rte_is_same_ether_addr(&client_info->cli_mac, + &arp->arp_data.arp_sha) || client_info->vlan_count != offset / sizeof(struct rte_vlan_hdr) || memcmp(client_info->vlan, eth_h + 1, offset) != 0 ) { client_info->in_use = 1; client_info->app_ip = arp->arp_data.arp_tip; client_info->cli_ip = arp->arp_data.arp_sip; - ether_addr_copy(&arp->arp_data.arp_sha, &client_info->cli_mac); + rte_ether_addr_copy(&arp->arp_data.arp_sha, + &client_info->cli_mac); client_info->slave_idx = calculate_slave(internals); - rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_tha); + rte_eth_macaddr_get(client_info->slave_idx, + &client_info->app_mac); + rte_ether_addr_copy(&client_info->app_mac, + &arp->arp_data.arp_tha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); } @@ -140,7 +144,7 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, * current primary port. */ rte_eth_macaddr_get(internals->port_id, &bonding_mac); - if (!is_same_ether_addr(&bonding_mac, &arp->arp_data.arp_sha)) { + if (!rte_is_same_ether_addr(&bonding_mac, &arp->arp_data.arp_sha)) { rte_eth_macaddr_get(internals->current_primary_port, &arp->arp_data.arp_sha); return internals->current_primary_port; @@ -156,13 +160,16 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, if (client_info->app_ip == arp->arp_data.arp_sip && client_info->cli_ip == arp->arp_data.arp_tip) { /* Entry is already assigned to this client */ - if (!is_broadcast_ether_addr(&arp->arp_data.arp_tha)) { - ether_addr_copy(&arp->arp_data.arp_tha, - &client_info->cli_mac); + if (!rte_is_broadcast_ether_addr( + &arp->arp_data.arp_tha)) { + rte_ether_addr_copy( + &arp->arp_data.arp_tha, + &client_info->cli_mac); } rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, + &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); @@ -174,11 +181,14 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, client_info->in_use = 1; client_info->ntt = 0; client_info->app_ip = arp->arp_data.arp_sip; - ether_addr_copy(&arp->arp_data.arp_tha, &client_info->cli_mac); + rte_ether_addr_copy(&arp->arp_data.arp_tha, + &client_info->cli_mac); client_info->cli_ip = arp->arp_data.arp_tip; client_info->slave_idx = calculate_slave(internals); - rte_eth_macaddr_get(client_info->slave_idx, &client_info->app_mac); - ether_addr_copy(&client_info->app_mac, &arp->arp_data.arp_sha); + rte_eth_macaddr_get(client_info->slave_idx, + &client_info->app_mac); + rte_ether_addr_copy(&client_info->app_mac, + &arp->arp_data.arp_sha); memcpy(client_info->vlan, eth_h + 1, offset); client_info->vlan_count = offset / sizeof(struct rte_vlan_hdr); rte_spinlock_unlock(&internals->mode6.lock); @@ -203,8 +213,8 @@ bond_mode_alb_arp_upd(struct client_data *client_info, rte_spinlock_lock(&internals->mode6.lock); eth_h = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ether_addr_copy(&client_info->app_mac, ð_h->s_addr); - ether_addr_copy(&client_info->cli_mac, ð_h->d_addr); + 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); else @@ -217,9 +227,9 @@ bond_mode_alb_arp_upd(struct client_data *client_info, memcpy(eth_h + 1, client_info->vlan, client_info->vlan_count * sizeof(struct rte_vlan_hdr)); - ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); + rte_ether_addr_copy(&client_info->app_mac, &arp_h->arp_data.arp_sha); arp_h->arp_data.arp_sip = client_info->app_ip; - ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); + rte_ether_addr_copy(&client_info->cli_mac, &arp_h->arp_data.arp_tha); arp_h->arp_data.arp_tip = client_info->cli_ip; arp_h->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index d960e7ff6..e83e668ad 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -454,8 +454,8 @@ bond_ethdev_rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, if (unlikely(is_lacp_packets(hdr->ether_type, subtype, bufs[j]) || !collecting || (!promisc && - !is_multicast_ether_addr(&hdr->d_addr) && - !is_same_ether_addr(bond_mac, + !rte_is_multicast_ether_addr(&hdr->d_addr) && + !rte_is_same_ether_addr(bond_mac, &hdr->d_addr)))) { if (hdr->ether_type == ether_type_slow_be) { @@ -1021,7 +1021,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) sizeof(internals->tlb_slaves_order[0]) * num_of_slaves); - ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); + rte_ether_addr_copy(primary_port->data->mac_addrs, &primary_slave_addr); if (nb_pkts > 3) { for (i = 0; i < 3; i++) @@ -1036,8 +1036,10 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) ether_hdr = rte_pktmbuf_mtod(bufs[j], struct rte_ether_hdr *); - if (is_same_ether_addr(ðer_hdr->s_addr, &primary_slave_addr)) - ether_addr_copy(&active_slave_addr, ðer_hdr->s_addr); + if (rte_is_same_ether_addr(ðer_hdr->s_addr, + &primary_slave_addr)) + rte_ether_addr_copy(&active_slave_addr, + ðer_hdr->s_addr); #if defined(RTE_LIBRTE_BOND_DEBUG_ALB) || defined(RTE_LIBRTE_BOND_DEBUG_ALB_L1) mode6_debug("TX IPv4:", ether_hdr, slaves[i], &burstnumberTX); #endif @@ -1523,7 +1525,7 @@ mac_address_get(struct rte_eth_dev *eth_dev, mac_addr = eth_dev->data->mac_addrs; - ether_addr_copy(mac_addr, dst_mac_addr); + rte_ether_addr_copy(mac_addr, dst_mac_addr); return 0; } @@ -1566,7 +1568,7 @@ slave_add_mac_addresses(struct rte_eth_dev *bonded_eth_dev, for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; - if (is_same_ether_addr(mac_addr, &null_mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; ret = rte_eth_dev_mac_addr_add(slave_port_id, mac_addr, 0); @@ -1595,7 +1597,7 @@ slave_remove_mac_addresses(struct rte_eth_dev *bonded_eth_dev, rc = 0; for (i = 1; i < BOND_MAX_MAC_ADDRS; i++) { mac_addr = &bonded_eth_dev->data->mac_addrs[i]; - if (is_same_ether_addr(mac_addr, &null_mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &null_mac_addr)) break; ret = rte_eth_dev_mac_addr_remove(slave_port_id, mac_addr); diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index b54f75ebc..122166410 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -671,7 +671,7 @@ static inline void t4_os_set_hw_addr(struct adapter *adapter, int port_idx, { struct port_info *pi = adap2pinfo(adapter, port_idx); - ether_addr_copy((struct rte_ether_addr *)hw_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw_addr, &pi->eth_dev->data->mac_addrs[0]); } diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c index ee9920ad6..a7b053b4a 100644 --- a/drivers/net/cxgbe/cxgbe_flow.c +++ b/drivers/net/cxgbe/cxgbe_flow.c @@ -115,12 +115,12 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item, mask = umask ? umask : (const struct rte_flow_item_eth *)dmask; /* we don't support SRC_MAC filtering*/ - if (!is_zero_ether_addr(&mask->src)) + if (!rte_is_zero_ether_addr(&mask->src)) return rte_flow_error_set(e, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, "src mac filtering not supported"); - if (!is_zero_ether_addr(&mask->dst)) { + if (!rte_is_zero_ether_addr(&mask->dst)) { const u8 *addr = (const u8 *)&spec->dst.addr_bytes[0]; const u8 *m = (const u8 *)&mask->dst.addr_bytes[0]; struct rte_flow *flow = (struct rte_flow *)fs->private; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 0e1dc1ae8..6716dd0cf 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1374,7 +1374,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) } /* copy the primary mac address */ - ether_addr_copy(&fman_intf->mac_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(&fman_intf->mac_addr, ð_dev->data->mac_addrs[0]); RTE_LOG(INFO, PMD, "net: dpaa: %s: %02x:%02x:%02x:%02x:%02x:%02x\n", dpaa_device->name, diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index ae4d7e1cc..1afeaa919 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2021,9 +2021,9 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, * If empty_mac(phy), return prime. * if both are empty, create random MAC, set as prime and return */ - if (!is_zero_ether_addr(&phy_mac)) { + if (!rte_is_zero_ether_addr(&phy_mac)) { /* If the addresses are not same, overwrite prime */ - if (!is_same_ether_addr(&phy_mac, &prime_mac)) { + if (!rte_is_same_ether_addr(&phy_mac, &prime_mac)) { ret = dpni_set_primary_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, phy_mac.addr_bytes); @@ -2035,9 +2035,9 @@ populate_mac_addr(struct fsl_mc_io *dpni_dev, struct dpaa2_dev_priv *priv, memcpy(&prime_mac, &phy_mac, sizeof(struct rte_ether_addr)); } - } else if (is_zero_ether_addr(&prime_mac)) { + } else if (rte_is_zero_ether_addr(&prime_mac)) { /* In case phys and prime, both are zero, create random MAC */ - eth_random_addr(prime_mac.addr_bytes); + rte_eth_random_addr(prime_mac.addr_bytes); ret = dpni_set_primary_mac_addr(dpni_dev, CMD_PRI_LOW, priv->token, prime_mac.addr_bytes); diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index b2fdb5e10..cd70f2802 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -294,7 +294,7 @@ eth_em_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, eth_dev->data->mac_addrs); /* initialize the vfta */ diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index e21a772fb..03047afa7 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -840,7 +840,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* initialize the vfta */ @@ -1039,8 +1039,8 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) } /* Generate a random MAC address, if none was assigned by PF. */ - if (is_zero_ether_addr(perm_addr)) { - eth_random_addr(perm_addr->addr_bytes); + if (rte_is_zero_ether_addr(perm_addr)) { + rte_eth_random_addr(perm_addr->addr_bytes); PMD_INIT_LOG(INFO, "\tVF MAC address not assigned by Host PF"); PMD_INIT_LOG(INFO, "\tAssign randomly generated MAC address " "%02x:%02x:%02x:%02x:%02x:%02x", @@ -1059,7 +1059,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev) return diag; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x " diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c index 33683498a..8dcfc71c5 100644 --- a/drivers/net/e1000/igb_flow.c +++ b/drivers/net/e1000/igb_flow.c @@ -548,9 +548,9 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid ether address mask"); @@ -567,7 +567,7 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index 9f1521350..ab48a269f 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -43,7 +43,7 @@ int igb_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) uint16_t vfn; for (vfn = 0; vfn < vf_num; vfn++) { - eth_random_addr(vf_mac_addr); + 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); @@ -306,8 +306,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); int rah; - if (is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { - if (!is_zero_ether_addr((struct rte_ether_addr *)new_mac)) + if (rte_is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { + if (!rte_is_zero_ether_addr((struct rte_ether_addr *)new_mac)) rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 1d832f91f..5ed86f0b1 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1814,7 +1814,8 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) /* Copy MAC address and point DPDK to it */ eth_dev->data->mac_addrs = (struct rte_ether_addr *)adapter->mac_addr; - ether_addr_copy((struct rte_ether_addr *)get_feat_ctx.dev_attr.mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *) + get_feat_ctx.dev_attr.mac_addr, (struct rte_ether_addr *)adapter->mac_addr); /* diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 2f473358d..e637c8628 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -840,7 +840,7 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* Set MTU */ diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 71e1b9c7d..3b55ebad4 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -648,7 +648,7 @@ static void debug_log_add_del_addr(struct rte_ether_addr *addr, bool add) { char mac_str[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + rte_ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(DEBUG, " %s address %s\n", add ? "add" : "remove", mac_str); } @@ -668,9 +668,10 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, /* Validate the given addresses first */ for (i = 0; i < nb_mc_addr && mc_addr_set != NULL; i++) { addr = &mc_addr_set[i]; - if (!is_multicast_ether_addr(addr) || - is_broadcast_ether_addr(addr)) { - ether_format_addr(mac_str, ETHER_ADDR_FMT_SIZE, addr); + if (!rte_is_multicast_ether_addr(addr) || + rte_is_broadcast_ether_addr(addr)) { + rte_ether_format_addr(mac_str, + ETHER_ADDR_FMT_SIZE, addr); PMD_INIT_LOG(ERR, " invalid multicast address %s\n", mac_str); return -EINVAL; @@ -704,7 +705,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, for (i = 0; i < enic->mc_count; i++) { addr = &enic->mc_addrs[i]; for (j = 0; j < nb_mc_addr; j++) { - if (is_same_ether_addr(addr, &mc_addr_set[j])) + if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) break; } if (j < nb_mc_addr) @@ -718,7 +719,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, for (i = 0; i < nb_mc_addr; i++) { addr = &mc_addr_set[i]; for (j = 0; j < enic->mc_count; j++) { - if (is_same_ether_addr(addr, &enic->mc_addrs[j])) + if (rte_is_same_ether_addr(addr, &enic->mc_addrs[j])) break; } if (j < enic->mc_count) diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 6b7683914..cbd283946 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1673,7 +1673,7 @@ static int enic_dev_init(struct enic *enic) dev_err(enic, "mac addr storage alloc failed, aborting.\n"); return -1; } - ether_addr_copy((struct rte_ether_addr *)enic->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)enic->mac_addr, eth_dev->data->mac_addrs); vnic_dev_set_reset_flag(enic->vdev, 0); diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c index 8f7d91169..e91c274d8 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -253,8 +253,8 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) */ FOREACH_SUBDEV(sdev, i, dev) if (sdev->state >= DEV_PROBED) { - ether_addr_copy(Ð(sdev)->data->mac_addrs[0], - mac); + rte_ether_addr_copy( + Ð(sdev)->data->mac_addrs[0], mac); break; } /* @@ -265,7 +265,7 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) * probed slaves. */ if (i == priv->subs_tail) - eth_random_addr(&mac->addr_bytes[0]); + rte_eth_random_addr(&mac->addr_bytes[0]); } INFO("MAC address is %02x:%02x:%02x:%02x:%02x:%02x", mac->addr_bytes[0], mac->addr_bytes[1], diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c index 549ee6bb8..325c67ca9 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -174,7 +174,7 @@ fs_eth_dev_conf_apply(struct rte_eth_dev *dev, if (ret) { char ea_fmt[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); + rte_ether_format_addr(ea_fmt, ETHER_ADDR_FMT_SIZE, ea); ERROR("Adding MAC address %s failed", ea_fmt); return ret; } diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index ac00828dd..e6956cbdb 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -614,7 +614,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); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); memset(macvlan, 0, sizeof(*macvlan)); macvlan->nb_queue_pools = nb_queue_pools; @@ -1525,7 +1525,7 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) for (mac_index = 0; (mac_index < FM10K_MAX_MACADDR_NUM) && (result == FM10K_SUCCESS); mac_index++) { - if (is_zero_ether_addr(&data->mac_addrs[mac_index])) + if (rte_is_zero_ether_addr(&data->mac_addrs[mac_index])) continue; if (mac_num > macvlan->mac_num - 1) { PMD_INIT_LOG(ERR, "MAC address number " @@ -3080,16 +3080,16 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev) diag = fm10k_read_mac_addr(hw); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); if (diag != FM10K_SUCCESS || - !is_valid_assigned_ether_addr(dev->data->mac_addrs)) { + !rte_is_valid_assigned_ether_addr(dev->data->mac_addrs)) { /* Generate a random addr */ - eth_random_addr(hw->mac.addr); + rte_eth_random_addr(hw->mac.addr); memcpy(hw->mac.perm_addr, hw->mac.addr, ETH_ALEN); - ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((const struct rte_ether_addr *)hw->mac.addr, &dev->data->mac_addrs[0]); } diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 802900dc7..b16d5c02a 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1468,7 +1468,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) goto err_get_mac_addr; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, (struct rte_ether_addr *)hw->mac.perm_addr); /* Disable flow control */ @@ -1520,7 +1520,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) "Failed to allocated memory for storing mac address"); goto err_mac_alloc; } - ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, &dev->data->mac_addrs[0]); /* Init dcb to sw mode by default */ @@ -4122,7 +4122,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, new_mac = &filter->mac_addr; - if (is_zero_ether_addr(new_mac)) { + if (rte_is_zero_ether_addr(new_mac)) { PMD_DRV_LOG(ERR, "Invalid ethernet address."); return -EINVAL; } @@ -4135,7 +4135,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } vf = &pf->vfs[vf_id]; - if (add && is_same_ether_addr(new_mac, &(pf->dev_addr))) { + if (add && rte_is_same_ether_addr(new_mac, &pf->dev_addr)) { PMD_DRV_LOG(INFO, "Ignore adding permanent MAC address."); return -EINVAL; } @@ -4153,7 +4153,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, PMD_DRV_LOG(ERR, "Failed to add MAC filter."); return -1; } - ether_addr_copy(new_mac, &pf->dev_addr); + rte_ether_addr_copy(new_mac, &pf->dev_addr); } else { rte_memcpy(hw->mac.addr, hw->mac.perm_addr, ETHER_ADDR_LEN); @@ -4164,7 +4164,7 @@ i40e_vf_mac_filter_set(struct i40e_pf *pf, } /* Clear device address as it has been removed */ - if (is_same_ether_addr(&(pf->dev_addr), new_mac)) + if (rte_is_same_ether_addr(&pf->dev_addr, new_mac)) memset(&pf->dev_addr, 0, sizeof(struct rte_ether_addr)); } @@ -6912,7 +6912,7 @@ i40e_find_mac_filter(struct i40e_vsi *vsi, struct i40e_mac_filter *f; TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) return f; } @@ -7585,9 +7585,11 @@ i40e_tunnel_filter_convert( struct i40e_aqc_cloud_filters_element_bb *cld_filter, struct i40e_tunnel_filter *tunnel_filter) { - ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *) + &cld_filter->element.outer_mac, (struct rte_ether_addr *)&tunnel_filter->input.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&cld_filter->element.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *) + &cld_filter->element.inner_mac, (struct rte_ether_addr *)&tunnel_filter->input.inner_mac); tunnel_filter->input.inner_vlan = cld_filter->element.inner_vlan; if ((rte_le_to_cpu_16(cld_filter->element.flags) & @@ -7696,9 +7698,9 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - ether_addr_copy(&tunnel_filter->outer_mac, + rte_ether_addr_copy(&tunnel_filter->outer_mac, (struct rte_ether_addr *)&pfilter->element.outer_mac); - ether_addr_copy(&tunnel_filter->inner_mac, + rte_ether_addr_copy(&tunnel_filter->inner_mac, (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = @@ -8143,9 +8145,9 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, } pfilter = cld_filter; - ether_addr_copy(&tunnel_filter->outer_mac, + rte_ether_addr_copy(&tunnel_filter->outer_mac, (struct rte_ether_addr *)&pfilter->element.outer_mac); - ether_addr_copy(&tunnel_filter->inner_mac, + rte_ether_addr_copy(&tunnel_filter->inner_mac, (struct rte_ether_addr *)&pfilter->element.inner_mac); pfilter->element.inner_vlan = @@ -8626,13 +8628,13 @@ i40e_tunnel_filter_param_check(struct i40e_pf *pf, } if ((filter->filter_type & ETH_TUNNEL_FILTER_OMAC) && - (is_zero_ether_addr(&filter->outer_mac))) { + (rte_is_zero_ether_addr(&filter->outer_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL outer MAC address"); return -EINVAL; } if ((filter->filter_type & ETH_TUNNEL_FILTER_IMAC) && - (is_zero_ether_addr(&filter->inner_mac))) { + (rte_is_zero_ether_addr(&filter->inner_mac))) { PMD_DRV_LOG(ERR, "Cannot add NULL inner MAC address"); return -EINVAL; } @@ -11959,13 +11961,14 @@ static int i40e_set_default_mac_addr(struct rte_eth_dev *dev, struct i40e_mac_filter *f; int ret; - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(&pf->dev_addr, + &f->mac_info.mac_addr)) break; } @@ -12083,9 +12086,11 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) vsi = vf->vsi; } memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct rte_ether_addr *)&f->input.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *) + &f->input.outer_mac, (struct rte_ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&f->input.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *) + &f->input.inner_mac, (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = f->input.inner_vlan; cld_filter.element.flags = f->input.flags; diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 0b05ddb34..f7f193c1f 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -788,7 +788,7 @@ i40evf_add_mac_addr(struct rte_eth_dev *dev, int err; struct vf_cmd_info args; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { PMD_DRV_LOG(ERR, "Invalid mac:%x:%x:%x:%x:%x:%x", addr->addr_bytes[0], addr->addr_bytes[1], addr->addr_bytes[2], addr->addr_bytes[3], @@ -1274,10 +1274,11 @@ i40evf_init_vf(struct rte_eth_dev *dev) vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); /* Store the MAC address configured by host, or generate random one */ - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)hw->mac.addr)) + if (rte_is_valid_assigned_ether_addr( + (struct rte_ether_addr *)hw->mac.addr)) vf->flags |= I40E_FLAG_VF_MAC_BY_PF; else - eth_random_addr(hw->mac.addr); /* Generate a random one */ + rte_eth_random_addr(hw->mac.addr); /* Generate a random one */ I40E_WRITE_REG(hw, I40E_VFINT_DYN_CTL01, (I40E_ITR_INDEX_DEFAULT << @@ -1512,7 +1513,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev) ETHER_ADDR_LEN * I40E_NUM_MACADDR_MAX); return -ENOMEM; } - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); return 0; @@ -1937,7 +1938,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) j = 0; len = sizeof(struct virtchnl_ether_addr_list); for (i = begin; i < I40E_NUM_MACADDR_MAX; i++, next_begin++) { - if (is_zero_ether_addr(&dev->data->mac_addrs[i])) + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[i])) continue; len += sizeof(struct virtchnl_ether_addr); if (len >= I40E_AQ_BUF_SZ) { @@ -1954,7 +1955,7 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add) for (i = begin; i < next_begin; i++) { addr = &dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); @@ -2707,7 +2708,7 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } @@ -2720,7 +2721,7 @@ i40evf_set_default_mac_addr(struct rte_eth_dev *dev, if (i40evf_add_mac_addr(dev, mac_addr, 0, 0) != 0) return -EIO; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 0640137a8..6feaaa818 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2006,9 +2006,9 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2027,7 +2027,7 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { @@ -2484,8 +2484,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, eth_mask = item->mask; if (eth_spec && eth_mask) { - if (!is_zero_ether_addr(ð_mask->src) || - !is_zero_ether_addr(ð_mask->dst)) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + !rte_is_zero_ether_addr(ð_mask->dst)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -3325,8 +3325,8 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, /* DST address of inner MAC shouldn't be masked. * SRC address of Inner MAC should be masked. */ - if (!is_broadcast_ether_addr(ð_mask->dst) || - !is_zero_ether_addr(ð_mask->src) || + if (!rte_is_broadcast_ether_addr(ð_mask->dst) || + !rte_is_zero_ether_addr(ð_mask->src) || eth_mask->type) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -3555,8 +3555,8 @@ i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, /* DST address of inner MAC shouldn't be masked. * SRC address of Inner MAC should be masked. */ - if (!is_broadcast_ether_addr(ð_mask->dst) || - !is_zero_ether_addr(ð_mask->src) || + if (!rte_is_broadcast_ether_addr(ð_mask->dst) || + !rte_is_zero_ether_addr(ð_mask->src) || eth_mask->type) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -4802,9 +4802,9 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, int ret = 0; memset(&cld_filter, 0, sizeof(cld_filter)); - ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac, (struct rte_ether_addr *)&cld_filter.element.outer_mac); - ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, + rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac, (struct rte_ether_addr *)&cld_filter.element.inner_mac); cld_filter.element.inner_vlan = filter->input.inner_vlan; cld_filter.element.flags = filter->input.flags; diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 4d7001df5..b7636c7fa 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -348,7 +348,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, vf_res->vsi_res[0].vsi_type = VIRTCHNL_VSI_SRIOV; vf_res->vsi_res[0].vsi_id = vf->vsi->vsi_id; vf_res->vsi_res[0].num_queue_pairs = vf->vsi->nb_qps; - ether_addr_copy(&vf->mac_addr, + rte_ether_addr_copy(&vf->mac_addr, (struct rte_ether_addr *)vf_res->vsi_res[0].default_mac_addr); send_msg: @@ -845,7 +845,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, mac = (struct rte_ether_addr *)(addr_list->list[i].addr); rte_memcpy(&filter.mac_addr, mac, ETHER_ADDR_LEN); filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - if (is_zero_ether_addr(mac) || + if (rte_is_zero_ether_addr(mac) || i40e_vsi_add_mac(vf->vsi, &filter)) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; @@ -887,7 +887,7 @@ i40e_pf_host_process_cmd_del_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); - if(is_zero_ether_addr(mac) || + if (rte_is_zero_ether_addr(mac) || i40e_vsi_delete_mac(vf->vsi, mac)) { ret = I40E_ERR_INVALID_MAC_ADDR; goto send_msg; diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index 8e562553a..3d66b635c 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -560,7 +560,7 @@ rte_pmd_i40e_set_vf_mac_addr(uint16_t port, uint16_t vf_id, return -EINVAL; } - ether_addr_copy(mac_addr, &vf->mac_addr); + rte_ether_addr_copy(mac_addr, &vf->mac_addr); /* Remove all existing mac */ TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) @@ -604,9 +604,9 @@ rte_pmd_i40e_remove_vf_mac_addr(uint16_t port, uint16_t vf_id, return -EINVAL; } - if (is_same_ether_addr(mac_addr, &vf->mac_addr)) + if (rte_is_same_ether_addr(mac_addr, &vf->mac_addr)) /* Reset the mac with NULL address */ - ether_addr_copy(&null_mac_addr, &vf->mac_addr); + rte_ether_addr_copy(&null_mac_addr, &vf->mac_addr); /* Remove the mac */ i40e_vsi_delete_mac(vsi, mac_addr); @@ -2387,7 +2387,7 @@ rte_pmd_i40e_add_vf_mac_addr(uint16_t port, uint16_t vf_id, } mac_filter.filter_type = RTE_MACVLAN_PERFECT_MATCH; - ether_addr_copy(mac_addr, &mac_filter.mac_addr); + rte_ether_addr_copy(mac_addr, &mac_filter.mac_addr); ret = i40e_vsi_add_mac(vsi, &mac_filter); if (ret != I40E_SUCCESS) { PMD_DRV_LOG(ERR, "Failed to add MAC filter."); @@ -2515,7 +2515,7 @@ rte_pmd_i40e_query_vfid_by_mac(uint16_t port, vf = &pf->vfs[vf_id]; mac = &vf->mac_addr; - if (is_same_ether_addr(mac, vf_mac)) + if (rte_is_same_ether_addr(mac, vf_mac)) return vf_id; } diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index c98355025..f545bd907 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -706,7 +706,7 @@ iavf_dev_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *addr, struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); int err; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { PMD_DRV_LOG(ERR, "Invalid Ethernet Address"); return -EINVAL; } @@ -951,11 +951,11 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, old_addr = (struct rte_ether_addr *)hw->mac.addr; perm_addr = (struct rte_ether_addr *)hw->mac.perm_addr; - if (is_same_ether_addr(mac_addr, old_addr)) + if (rte_is_same_ether_addr(mac_addr, old_addr)) return 0; /* If the MAC address is configured by host, skip the setting */ - if (is_valid_assigned_ether_addr(perm_addr)) + if (rte_is_valid_assigned_ether_addr(perm_addr)) return -EPERM; ret = iavf_add_del_eth_addr(adapter, old_addr, FALSE); @@ -983,7 +983,7 @@ iavf_dev_set_default_mac_addr(struct rte_eth_dev *dev, if (ret) return -EIO; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)hw->mac.addr); return 0; } @@ -1317,10 +1317,10 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) /* If the MAC address is not configured by host, * generate a random one. */ - if (!is_valid_assigned_ether_addr( + if (!rte_is_valid_assigned_ether_addr( (struct rte_ether_addr *)hw->mac.addr)) - eth_random_addr(hw->mac.addr); - ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, + rte_eth_random_addr(hw->mac.addr); + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, ð_dev->data->mac_addrs[0]); /* register callback func to eal lib */ diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index a705dbdfc..14395fed3 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -647,7 +647,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) len = sizeof(struct virtchnl_ether_addr_list); for (i = begin; i < IAVF_NUM_MACADDR_MAX; i++, next_begin++) { addr = &adapter->eth_dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; len += sizeof(struct virtchnl_ether_addr); if (len >= IAVF_AQ_BUF_SZ) { @@ -664,7 +664,7 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) for (i = begin; i < next_begin; i++) { addr = &adapter->eth_dev->data->mac_addrs[i]; - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; rte_memcpy(list->list[j].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 098570794..61624d76f 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -480,13 +480,14 @@ ice_init_mac_address(struct rte_eth_dev *dev) { struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); - if (!is_unicast_ether_addr + if (!rte_is_unicast_ether_addr ((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr)) { PMD_INIT_LOG(ERR, "Invalid MAC address"); return -EINVAL; } - ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, + rte_ether_addr_copy( + (struct rte_ether_addr *)hw->port_info[0].mac.lan_addr, (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); dev->data->mac_addrs = @@ -497,8 +498,9 @@ ice_init_mac_address(struct rte_eth_dev *dev) return -ENOMEM; } /* store it to dev data */ - ether_addr_copy((struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, - &dev->data->mac_addrs[0]); + rte_ether_addr_copy( + (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr, + &dev->data->mac_addrs[0]); return 0; } @@ -509,7 +511,7 @@ ice_find_mac_filter(struct ice_vsi *vsi, struct rte_ether_addr *macaddr) struct ice_mac_filter *f; TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(macaddr, &f->mac_info.mac_addr)) return f; } @@ -2264,13 +2266,13 @@ static int ice_macaddr_set(struct rte_eth_dev *dev, uint8_t flags = 0; int ret; - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { PMD_DRV_LOG(ERR, "Tried to set invalid MAC address."); return -EINVAL; } TAILQ_FOREACH(f, &vsi->mac_list, next) { - if (is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) + if (rte_is_same_ether_addr(&pf->dev_addr, &f->mac_info.mac_addr)) break; } diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index aee2aac6c..b18d183f0 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -124,9 +124,10 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev) snprintf(attr_name, IPN3KE_RAWDEV_ATTR_LEN_MAX, "%s", "LineSideBaseMAC"); rawdev->dev_ops->attr_get(rawdev, attr_name, &base_mac); - ether_addr_copy((struct rte_ether_addr *)&base_mac, &rpst->mac_addr); + rte_ether_addr_copy((struct rte_ether_addr *)&base_mac, + &rpst->mac_addr); - ether_addr_copy(&rpst->mac_addr, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(&rpst->mac_addr, &dev->data->mac_addrs[0]); dev->data->mac_addrs->addr_bytes[ETHER_ADDR_LEN - 1] = (uint8_t)rpst->port_id + 1; @@ -656,13 +657,13 @@ ipn3ke_rpst_mac_addr_set(struct rte_eth_dev *ethdev, struct ipn3ke_rpst *rpst = IPN3KE_DEV_PRIVATE_TO_RPST(ethdev); uint32_t val; - if (!is_valid_assigned_ether_addr(mac_addr)) { + if (!rte_is_valid_assigned_ether_addr(mac_addr)) { IPN3KE_AFU_PMD_ERR("Tried to set invalid MAC address."); return -EINVAL; } if (hw->retimer.mac_type == IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI) { - ether_addr_copy(&mac_addr[0], &rpst->mac_addr); + rte_ether_addr_copy(&mac_addr[0], &rpst->mac_addr); /* Set mac address */ rte_memcpy(((char *)(&val)), &mac_addr[0], sizeof(uint32_t)); diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 4d5fa87af..2f97f0f8d 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1223,7 +1223,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, ð_dev->data->mac_addrs[0]); /* Allocate memory for storing hash filter MAC addresses */ @@ -1658,7 +1658,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } /* Generate a random MAC address, if none was assigned by PF. */ - if (is_zero_ether_addr(perm_addr)) { + if (rte_is_zero_ether_addr(perm_addr)) { generate_random_mac_addr(perm_addr); diag = ixgbe_set_rar_vf(hw, 1, perm_addr->addr_bytes, 0, 1); if (diag) { @@ -1678,7 +1678,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) } /* Copy the permanent MAC address */ - ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]); + rte_ether_addr_copy(perm_addr, ð_dev->data->mac_addrs[0]); /* reset the hardware with the new settings */ diag = hw->mac.ops.start_hw(hw); @@ -6089,7 +6089,7 @@ ixgbevf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t index) if (i == index) continue; /* Skip NULL MAC addresses */ - if (is_zero_ether_addr(mac_addr)) + if (rte_is_zero_ether_addr(mac_addr)) continue; /* Skip the permanent MAC address */ if (memcmp(perm_addr, mac_addr, diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index f0fafebc8..7024354cd 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -744,9 +744,9 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, * Mask bits of destination MAC address must be full * of 1 or full of 0. */ - if (!is_zero_ether_addr(ð_mask->src) || - (!is_zero_ether_addr(ð_mask->dst) && - !is_broadcast_ether_addr(ð_mask->dst))) { + if (!rte_is_zero_ether_addr(ð_mask->src) || + (!rte_is_zero_ether_addr(ð_mask->dst) && + !rte_is_broadcast_ether_addr(ð_mask->dst))) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "Invalid ether address mask"); @@ -763,7 +763,7 @@ cons_parse_ethertype_filter(const struct rte_flow_attr *attr, /* If mask bits of destination MAC address * are full of 1, set RTE_ETHTYPE_FLAGS_MAC. */ - if (is_broadcast_ether_addr(ð_mask->dst)) { + if (rte_is_broadcast_ether_addr(ð_mask->dst)) { filter->mac_addr = eth_spec->dst; filter->flags |= RTE_ETHTYPE_FLAGS_MAC; } else { diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 6180c9473..a2ae703df 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -46,7 +46,7 @@ int ixgbe_vf_perm_addr_gen(struct rte_eth_dev *dev, uint16_t vf_num) uint16_t vfn; for (vfn = 0; vfn < vf_num; vfn++) { - eth_random_addr(vf_mac_addr); + 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); @@ -463,7 +463,8 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) int rar_entry = hw->mac.num_rar_entries - (vf + 1); uint8_t *new_mac = (uint8_t *)(&msgbuf[1]); - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { + if (rte_is_valid_assigned_ether_addr( + (struct rte_ether_addr *)new_mac)) { rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index 3defba175..db2191862 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -35,7 +35,8 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private)); rar_entry = hw->mac.num_rar_entries - (vf + 1); - if (is_valid_assigned_ether_addr((struct rte_ether_addr *)new_mac)) { + 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); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c index 180cfd6c9..1cb1f067f 100644 --- a/drivers/net/kni/rte_eth_kni.c +++ b/drivers/net/kni/rte_eth_kni.c @@ -363,7 +363,7 @@ eth_kni_create(struct rte_vdev_device *vdev, data->dev_link = pmd_link; data->mac_addrs = &internals->eth_addr; - eth_random_addr(internals->eth_addr.addr_bytes); + rte_eth_random_addr(internals->eth_addr.addr_bytes); eth_dev->dev_ops = ð_kni_ops; diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index de234e903..21ded9ef3 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -1835,7 +1835,7 @@ lio_dev_configure(struct rte_eth_dev *eth_dev) 2 + i)); /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)mac, + rte_ether_addr_copy((struct rte_ether_addr *)mac, ð_dev->data->mac_addrs[0]); /* enable firmware checksum support for tunnel packets */ diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c index 6995c14a5..6639037f0 100644 --- a/drivers/net/mlx4/mlx4_ethdev.c +++ b/drivers/net/mlx4/mlx4_ethdev.c @@ -522,7 +522,7 @@ mlx4_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *list, for (i = RTE_DIM(priv->mac) - num; i != RTE_DIM(priv->mac) - priv->mac_mc; ++i) - if (!is_zero_ether_addr(&priv->mac[i])) { + if (!rte_is_zero_ether_addr(&priv->mac[i])) { rte_errno = EBUSY; return -rte_errno; } diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c index 78bd452bd..244f19311 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -1398,7 +1398,7 @@ mlx4_flow_internal(struct mlx4_priv *priv, struct rte_flow_error *error) mac = &priv->mac[i]; else mac = ð_mask.dst; - if (is_zero_ether_addr(mac)) + if (rte_is_zero_ether_addr(mac)) continue; /* Check if MAC flow rule is already present. */ for (flow = LIST_FIRST(&priv->flows); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 789748d08..48d54e8de 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -3334,7 +3334,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, " parameter is ignored"); break; } - if (!is_zero_ether_addr(&mask.eth->dst)) { + if (!rte_is_zero_ether_addr(&mask.eth->dst)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, spec.eth->dst.addr_bytes); @@ -3342,7 +3342,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, ETHER_ADDR_LEN, mask.eth->dst.addr_bytes); } - if (!is_zero_ether_addr(&mask.eth->src)) { + if (!rte_is_zero_ether_addr(&mask.eth->src)) { mnl_attr_put(nlh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, spec.eth->src.addr_bytes); diff --git a/drivers/net/mlx5/mlx5_mac.c b/drivers/net/mlx5/mlx5_mac.c index 9f6b89a82..9204c5f52 100644 --- a/drivers/net/mlx5/mlx5_mac.c +++ b/drivers/net/mlx5/mlx5_mac.c @@ -71,7 +71,7 @@ mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) const int vf = priv->config.vf; assert(index < MLX5_MAX_MAC_ADDRESSES); - if (is_zero_ether_addr(&dev->data->mac_addrs[index])) + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[index])) return; if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], @@ -101,7 +101,7 @@ mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, unsigned int i; assert(index < MLX5_MAX_MAC_ADDRESSES); - if (is_zero_ether_addr(mac)) { + if (rte_is_zero_ether_addr(mac)) { rte_errno = EINVAL; return -rte_errno; } diff --git a/drivers/net/mlx5/mlx5_nl.c b/drivers/net/mlx5/mlx5_nl.c index ce4c93748..50cd32a09 100644 --- a/drivers/net/mlx5/mlx5_nl.c +++ b/drivers/net/mlx5/mlx5_nl.c @@ -340,7 +340,7 @@ mlx5_nl_mac_addr_cb(struct nlmsghdr *nh, void *arg) #ifndef NDEBUG char m[18]; - ether_format_addr(m, 18, RTA_DATA(attribute)); + rte_ether_format_addr(m, 18, RTA_DATA(attribute)); DRV_LOG(DEBUG, "bridge MAC address %s", m); #endif memcpy(&(*data->mac)[data->mac_n++], @@ -555,14 +555,14 @@ mlx5_nl_mac_addr_sync(struct rte_eth_dev *dev) /* Verify the address is not in the array yet. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) - if (is_same_ether_addr(&macs[i], + if (rte_is_same_ether_addr(&macs[i], &dev->data->mac_addrs[j])) break; if (j != MLX5_MAX_MAC_ADDRESSES) continue; /* Find the first entry available. */ for (j = 0; j != MLX5_MAX_MAC_ADDRESSES; ++j) { - if (is_zero_ether_addr(&dev->data->mac_addrs[j])) { + if (rte_is_zero_ether_addr(&dev->data->mac_addrs[j])) { dev->data->mac_addrs[j] = macs[i]; break; } diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index d539ba6a1..9ec71c3c1 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -595,7 +595,7 @@ mvneta_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = neta_ppio_remove_mac_addr(priv->ppio, dev->data->mac_addrs[index].addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), + rte_ether_format_addr(buf, sizeof(buf), &dev->data->mac_addrs[index]); MVNETA_LOG(ERR, "Failed to remove mac %s", buf); } @@ -633,7 +633,7 @@ mvneta_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, ret = neta_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to add mac %s", buf); return -1; } @@ -661,7 +661,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]; - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MVNETA_LOG(ERR, "Failed to set mac to %s", buf); } return 0; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 8647c9b0d..4c6edb41d 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1080,7 +1080,7 @@ mrvl_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) ret = pp2_ppio_remove_mac_addr(priv->ppio, dev->data->mac_addrs[index].addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), + rte_ether_format_addr(buf, sizeof(buf), &dev->data->mac_addrs[index]); MRVL_LOG(ERR, "Failed to remove mac %s", buf); } @@ -1134,7 +1134,7 @@ mrvl_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, */ ret = pp2_ppio_add_mac_addr(priv->ppio, mac_addr->addr_bytes); if (ret) { - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to add mac %s", buf); return -1; } @@ -1168,7 +1168,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]; - ether_format_addr(buf, sizeof(buf), mac_addr); + rte_ether_format_addr(buf, sizeof(buf), mac_addr); MRVL_LOG(ERR, "Failed to set mac to %s", buf); } diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index a5850c249..61924209c 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -128,8 +128,8 @@ hn_update_packet_stats(struct hn_stats *stats, const struct rte_mbuf *m) } ea = rte_pktmbuf_mtod(m, const struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) stats->broadcast++; else stats->multicast++; diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c index f1be7e22f..27ac87e7e 100644 --- a/drivers/net/netvsc/hn_vf.c +++ b/drivers/net/netvsc/hn_vf.c @@ -42,7 +42,7 @@ static int hn_vf_match(const struct rte_eth_dev *dev) if (vf_dev == dev) continue; - if (is_same_ether_addr(mac, vf_mac)) + if (rte_is_same_ether_addr(mac, vf_mac)) return i; } return -ENOENT; diff --git a/drivers/net/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c index 679af6eb2..ffdc2bf46 100644 --- a/drivers/net/nfb/nfb_ethdev.c +++ b/drivers/net/nfb/nfb_ethdev.c @@ -360,7 +360,7 @@ nfb_eth_mac_addr_set(struct rte_eth_dev *dev, struct pmd_internals *internals = (struct pmd_internals *) data->dev_private; - if (!is_valid_assigned_ether_addr(mac_addr)) + if (!rte_is_valid_assigned_ether_addr(mac_addr)) return -EINVAL; for (i = 0; i < ETHER_ADDR_LEN; i++) { @@ -371,7 +371,7 @@ nfb_eth_mac_addr_set(struct rte_eth_dev *dev, for (i = 0; i < internals->max_rxmac; ++i) nc_rxmac_set_mac(internals->rxmac[i], 0, mac, 1); - ether_addr_copy(mac_addr, data->mac_addrs); + rte_ether_addr_copy(mac_addr, data->mac_addrs); return 0; } @@ -472,7 +472,7 @@ nfb_eth_dev_init(struct rte_eth_dev *dev) return -EINVAL; } - eth_random_addr(eth_addr_init.addr_bytes); + rte_eth_random_addr(eth_addr_init.addr_bytes); eth_addr_init.addr_bytes[0] = eth_addr.addr_bytes[0]; eth_addr_init.addr_bytes[1] = eth_addr.addr_bytes[1]; eth_addr_init.addr_bytes[2] = eth_addr.addr_bytes[2]; diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 95c2be127..853b7800b 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -2962,17 +2962,17 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_vf_read_mac(hw); } - if (!is_valid_assigned_ether_addr( + if (!rte_is_valid_assigned_ether_addr( (struct rte_ether_addr *)&hw->mac_addr)) { PMD_INIT_LOG(INFO, "Using random mac address for port %d", port); /* Using random mac addresses for VFs */ - eth_random_addr(&hw->mac_addr[0]); + rte_eth_random_addr(&hw->mac_addr[0]); nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr); } /* Copying mac address to DPDK eth_dev struct */ - ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); if (!(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR)) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 7683511cf..d1d49b53b 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -535,7 +535,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, internals->packet_size = packet_size; internals->packet_copy = packet_copy; internals->port_id = eth_dev->data->port_id; - eth_random_addr(internals->eth_addr.addr_bytes); + rte_eth_random_addr(internals->eth_addr.addr_bytes); internals->flow_type_rss_offloads = ETH_RSS_PROTO_MASK; internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_RETA_GROUP_SIZE; diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index a72d46657..c7fadf27f 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -580,7 +580,7 @@ qede_ucast_filter(struct rte_eth_dev *eth_dev, struct ecore_filter_ucast *ucast, DP_ERR(edev, "Did not allocate memory for ucast\n"); return -ENOMEM; } - ether_addr_copy(mac_addr, &u->mac); + rte_ether_addr_copy(mac_addr, &u->mac); u->vlan = ucast->vlan; u->vni = ucast->vni; SLIST_INSERT_HEAD(&qdev->uc_list_head, u, list); @@ -623,14 +623,14 @@ qede_add_mcast_filters(struct rte_eth_dev *eth_dev, DP_ERR(edev, "Did not allocate memory for mcast\n"); return -ENOMEM; } - ether_addr_copy(&mc_addrs[i], &m->mac); + rte_ether_addr_copy(&mc_addrs[i], &m->mac); SLIST_INSERT_HEAD(&qdev->mc_list_head, m, list); } memset(&mcast, 0, sizeof(mcast)); mcast.num_mc_addrs = mc_addrs_num; mcast.opcode = ECORE_FILTER_ADD; for (i = 0; i < mc_addrs_num; i++) - ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) + rte_ether_addr_copy(&mc_addrs[i], (struct rte_ether_addr *) &mcast.mac[i]); rc = ecore_filter_mcast_cmd(edev, &mcast, ECORE_SPQ_MODE_CB, NULL); if (rc != ECORE_SUCCESS) { @@ -655,7 +655,7 @@ static int qede_del_mcast_filters(struct rte_eth_dev *eth_dev) mcast.opcode = ECORE_FILTER_REMOVE; j = 0; SLIST_FOREACH(tmp, &qdev->mc_list_head, list) { - ether_addr_copy(&tmp->mac, + rte_ether_addr_copy(&tmp->mac, (struct rte_ether_addr *)&mcast.mac[j]); j++; } @@ -709,13 +709,13 @@ qede_mac_addr_add(struct rte_eth_dev *eth_dev, struct rte_ether_addr *mac_addr, struct ecore_filter_ucast ucast; int re; - if (!is_valid_assigned_ether_addr(mac_addr)) + if (!rte_is_valid_assigned_ether_addr(mac_addr)) return -EINVAL; qede_set_ucast_cmn_params(&ucast); ucast.opcode = ECORE_FILTER_ADD; ucast.type = ECORE_FILTER_MAC; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)&ucast.mac); re = (int)qede_mac_int_ops(eth_dev, &ucast, 1); return re; } @@ -735,7 +735,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) return; } - if (!is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) + if (!rte_is_valid_assigned_ether_addr(ð_dev->data->mac_addrs[index])) return; qede_set_ucast_cmn_params(&ucast); @@ -743,7 +743,7 @@ qede_mac_addr_remove(struct rte_eth_dev *eth_dev, uint32_t index) ucast.type = ECORE_FILTER_MAC; /* Use the index maintained by rte */ - ether_addr_copy(ð_dev->data->mac_addrs[index], + rte_ether_addr_copy(ð_dev->data->mac_addrs[index], (struct rte_ether_addr *)&ucast.mac); qede_mac_int_ops(eth_dev, &ucast, false); @@ -1774,7 +1774,7 @@ qede_set_mc_addr_list(struct rte_eth_dev *eth_dev, } for (i = 0; i < mc_addrs_num; i++) { - if (!is_multicast_ether_addr(&mc_addrs[i])) { + if (!rte_is_multicast_ether_addr(&mc_addrs[i])) { DP_ERR(edev, "Not a valid multicast MAC\n"); return -EINVAL; } @@ -2552,10 +2552,10 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) } if (!is_vf) { - ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. + rte_ether_addr_copy((struct rte_ether_addr *)edev->hwfns[0]. hw_info.hw_mac_addr, ð_dev->data->mac_addrs[0]); - ether_addr_copy(ð_dev->data->mac_addrs[0], + rte_ether_addr_copy(ð_dev->data->mac_addrs[0], &adapter->primary_mac); } else { ecore_vf_read_bulletin(ECORE_LEADING_HWFN(edev), @@ -2568,11 +2568,12 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf) &is_mac_forced); if (is_mac_exist) { DP_INFO(edev, "VF macaddr received from PF\n"); - ether_addr_copy( + rte_ether_addr_copy( (struct rte_ether_addr *)&vf_mac, ð_dev->data->mac_addrs[0]); - ether_addr_copy(ð_dev->data->mac_addrs[0], - &adapter->primary_mac); + rte_ether_addr_copy( + ð_dev->data->mac_addrs[0], + &adapter->primary_mac); } else { DP_ERR(edev, "No VF macaddr assigned\n"); } diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index fadcdb56a..dd9897d70 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -983,7 +983,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) * Copy the address to the device private data so that * it could be recalled in the case of adapter restart. */ - ether_addr_copy(mac_addr, &port->default_mac_addr); + rte_ether_addr_copy(mac_addr, &port->default_mac_addr); /* * Neither of the two following checks can return @@ -1043,7 +1043,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) unlock: if (rc != 0) - ether_addr_copy(old_addr, &port->default_mac_addr); + rte_ether_addr_copy(old_addr, &port->default_mac_addr); sfc_adapter_unlock(sa); @@ -2126,7 +2126,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev) * Linux kernel. Copy from NIC config to Ethernet device data. */ from = (const struct rte_ether_addr *)(encp->enc_mac_addr); - ether_addr_copy(from, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(from, &dev->data->mac_addrs[0]); sfc_adapter_unlock(sa); diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 944296d7d..e1d981b4e 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -277,7 +277,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, if (spec == NULL) return 0; - if (is_same_ether_addr(&mask->dst, &supp_mask.dst)) { + if (rte_is_same_ether_addr(&mask->dst, &supp_mask.dst)) { efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_LOC_MAC : EFX_FILTER_MATCH_LOC_MAC; @@ -285,7 +285,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, EFX_MAC_ADDR_LEN); } else if (memcmp(mask->dst.addr_bytes, ig_mask, EFX_MAC_ADDR_LEN) == 0) { - if (is_unicast_ether_addr(&spec->dst)) + if (rte_is_unicast_ether_addr(&spec->dst)) efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_UNKNOWN_UCAST_DST : EFX_FILTER_MATCH_UNKNOWN_UCAST_DST; @@ -293,7 +293,7 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_UNKNOWN_MCAST_DST : EFX_FILTER_MATCH_UNKNOWN_MCAST_DST; - } else if (!is_zero_ether_addr(&mask->dst)) { + } else if (!rte_is_zero_ether_addr(&mask->dst)) { goto fail_bad_mask; } @@ -302,11 +302,11 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, * ethertype masks are equal to zero in inner frame, * so these fields are filled in only for the outer frame */ - if (is_same_ether_addr(&mask->src, &supp_mask.src)) { + if (rte_is_same_ether_addr(&mask->src, &supp_mask.src)) { efx_spec->efs_match_flags |= EFX_FILTER_MATCH_REM_MAC; rte_memcpy(efx_spec->efs_rem_mac, spec->src.addr_bytes, EFX_MAC_ADDR_LEN); - } else if (!is_zero_ether_addr(&mask->src)) { + } else if (!rte_is_zero_ether_addr(&mask->src)) { goto fail_bad_mask; } diff --git a/drivers/net/sfc/sfc_port.c b/drivers/net/sfc/sfc_port.c index 8de5f0c60..23313e125 100644 --- a/drivers/net/sfc/sfc_port.c +++ b/drivers/net/sfc/sfc_port.c @@ -402,7 +402,7 @@ sfc_port_attach(struct sfc_adapter *sa) RTE_BUILD_BUG_ON(sizeof(encp->enc_mac_addr) != sizeof(*from)); from = (const struct rte_ether_addr *)(encp->enc_mac_addr); - ether_addr_copy(from, &port->default_mac_addr); + rte_ether_addr_copy(from, &port->default_mac_addr); port->max_mcast_addrs = EFX_MAC_MULTICAST_LIST_MAX; port->nb_mcast_addrs = 0; diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c index ccd58c01c..f05ff092f 100644 --- a/drivers/net/softnic/rte_eth_softnic_flow.c +++ b/drivers/net/softnic/rte_eth_softnic_flow.c @@ -1681,9 +1681,9 @@ flow_rule_action_get(struct pmd_internals *softnic, item, "VXLAN ENCAP: first encap item should be ether"); } - ether_addr_copy(&spec.eth.dst, + rte_ether_addr_copy(&spec.eth.dst, &rule_action->encap.vxlan.ether.da); - ether_addr_copy(&spec.eth.src, + rte_ether_addr_copy(&spec.eth.src, &rule_action->encap.vxlan.ether.sa); item++; diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index 43a66432a..99de9f4e6 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -1522,7 +1522,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev, struct port_info *pi) return -ENOMEM; } - ether_addr_copy(ð_addr, data->mac_addrs); + rte_ether_addr_copy(ð_addr, data->mac_addrs); PMD_INIT_LOG(INFO, "%s device %s successfully initialized", RTE_STR(RTE_SZEDATA2_DRIVER_NAME), data->name); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 71be763d6..949b72d0c 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1163,7 +1163,7 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) return -ENOTSUP; } - if (is_zero_ether_addr(mac_addr)) { + if (rte_is_zero_ether_addr(mac_addr)) { TAP_LOG(ERR, "%s: can't set an empty MAC address", dev->device->name); return -EINVAL; @@ -1172,14 +1172,15 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, LOCAL_ONLY); if (ret < 0) return ret; - if (is_same_ether_addr((struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, - mac_addr)) + if (rte_is_same_ether_addr( + (struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, + mac_addr)) return 0; /* Check the current MAC address on the remote */ ret = tap_ioctl(pmd, SIOCGIFHWADDR, &ifr, 0, REMOTE_ONLY); if (ret < 0) return ret; - if (!is_same_ether_addr( + if (!rte_is_same_ether_addr( (struct rte_ether_addr *)&ifr.ifr_hwaddr.sa_data, mac_addr)) mode = LOCAL_AND_REMOTE; @@ -1754,8 +1755,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, } if (pmd->type == ETH_TUNTAP_TYPE_TAP) { - if (is_zero_ether_addr(mac_addr)) - eth_random_addr((uint8_t *)&pmd->eth_addr); + if (rte_is_zero_ether_addr(mac_addr)) + rte_eth_random_addr((uint8_t *)&pmd->eth_addr); else rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); } diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c index d155618fc..20963090c 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -537,14 +537,14 @@ tap_flow_create_eth(const struct rte_flow_item *item, void *data) if (!flow) return 0; msg = &flow->msg; - if (!is_zero_ether_addr(&mask->dst)) { + if (!rte_is_zero_ether_addr(&mask->dst)) { tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST, ETHER_ADDR_LEN, &spec->dst.addr_bytes); tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_DST_MASK, ETHER_ADDR_LEN, &mask->dst.addr_bytes); } - if (!is_zero_ether_addr(&mask->src)) { + if (!rte_is_zero_ether_addr(&mask->src)) { tap_nlattr_add(&msg->nh, TCA_FLOWER_KEY_ETH_SRC, ETHER_ADDR_LEN, &spec->src.addr_bytes); tap_nlattr_add(&msg->nh, diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index ec2087924..482968b7a 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -2179,10 +2179,10 @@ nicvf_eth_dev_init(struct rte_eth_dev *eth_dev) ret = -ENOMEM; goto alarm_fail; } - if (is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) - eth_random_addr(&nic->mac_addr[0]); + if (rte_is_zero_ether_addr((struct rte_ether_addr *)nic->mac_addr)) + rte_eth_random_addr(&nic->mac_addr[0]); - ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)nic->mac_addr, ð_dev->data->mac_addrs[0]); ret = nicvf_mbox_set_mac_addr(nic, nic->mac_addr); diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index ef02fdcdd..ad13eac3b 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -387,7 +387,7 @@ vdev_netvsc_device_probe(const struct if_nameindex *iface, strlcpy(ctx->if_name, iface->if_name, sizeof(ctx->if_name)); return 0; } - if (!is_same_ether_addr(eth_addr, &ctx->if_addr)) + if (!rte_is_same_ether_addr(eth_addr, &ctx->if_addr)) return 0; /* Look for associated PCI device. */ ret = vdev_netvsc_sysfs_readlink(buf, sizeof(buf), iface->if_name, @@ -544,7 +544,7 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface, pair->value); return -EINVAL; } - if (is_same_ether_addr(eth_addr, &tmp)) + if (rte_is_same_ether_addr(eth_addr, &tmp)) break; } } diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 6705e90db..774774b94 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -329,8 +329,8 @@ vhost_count_multicast_broadcast(struct vhost_queue *vq, struct vhost_stats *pstats = &vq->stats; ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) pstats->xstats[VHOST_BROADCAST_PKT]++; else pstats->xstats[VHOST_MULTICAST_PKT]++; diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 9b99bf3eb..2762dcf97 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1108,7 +1108,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) offsetof(struct virtio_net_config, mac), &hw->mac_addr, ETHER_ADDR_LEN); } else { - eth_random_addr(&hw->mac_addr[0]); + rte_eth_random_addr(&hw->mac_addr[0]); virtio_set_hwaddr(hw); } } @@ -1164,7 +1164,7 @@ virtio_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, const struct rte_ether_addr *addr = (i == index) ? mac_addr : addrs + i; struct virtio_net_ctrl_mac *tbl - = is_multicast_ether_addr(addr) ? mc : uc; + = rte_is_multicast_ether_addr(addr) ? mc : uc; memcpy(&tbl->macs[tbl->entries++], addr, ETHER_ADDR_LEN); } @@ -1193,10 +1193,10 @@ virtio_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) for (i = 0; i < VIRTIO_MAX_MAC_ADDRS; i++) { struct virtio_net_ctrl_mac *tbl; - if (i == index || is_zero_ether_addr(addrs + i)) + if (i == index || rte_is_zero_ether_addr(addrs + i)) continue; - tbl = is_multicast_ether_addr(addrs + i) ? mc : uc; + tbl = rte_is_multicast_ether_addr(addrs + i) ? mc : uc; memcpy(&tbl->macs[tbl->entries++], addrs + i, ETHER_ADDR_LEN); } @@ -1662,7 +1662,7 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features) /* Copy the permanent MAC address to: virtio_hw */ virtio_get_hwaddr(hw); - ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->mac_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "PORT MAC: %02X:%02X:%02X:%02X:%02X:%02X", diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index fa9c855e8..3de467768 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1114,8 +1114,8 @@ virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) } ea = rte_pktmbuf_mtod(mbuf, struct rte_ether_addr *); - if (is_multicast_ether_addr(ea)) { - if (is_broadcast_ether_addr(ea)) + if (rte_is_multicast_ether_addr(ea)) { + if (rte_is_broadcast_ether_addr(ea)) stats->broadcast++; else stats->multicast++; diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 3ad1e9e09..f718b8b65 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -316,7 +316,7 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) return -ENOMEM; } /* Copy the permanent MAC address */ - ether_addr_copy((struct rte_ether_addr *)hw->perm_addr, + rte_ether_addr_copy((struct rte_ether_addr *)hw->perm_addr, ð_dev->data->mac_addrs[0]); PMD_INIT_LOG(DEBUG, "MAC Address : %02x:%02x:%02x:%02x:%02x:%02x", @@ -1209,7 +1209,7 @@ vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { struct vmxnet3_hw *hw = dev->data->dev_private; - ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); + rte_ether_addr_copy(mac_addr, (struct rte_ether_addr *)(hw->perm_addr)); vmxnet3_write_mac(hw, mac_addr->addr_bytes); return 0; } diff --git a/examples/bond/main.c b/examples/bond/main.c index 38d1b40c2..f053e5bd8 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -390,12 +390,13 @@ static int lcore_main(__attribute__((unused)) void *arg1) if (arp_hdr->arp_opcode == rte_cpu_to_be_16(RTE_ARP_OP_REQUEST)) { arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); /* Switch src and dst data and set bonding MAC */ - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); - ether_addr_copy(&arp_hdr->arp_data.arp_sha, &arp_hdr->arp_data.arp_tha); + rte_ether_addr_copy(&arp_hdr->arp_data.arp_sha, + &arp_hdr->arp_data.arp_tha); arp_hdr->arp_data.arp_tip = arp_hdr->arp_data.arp_sip; rte_eth_macaddr_get(BOND_PORT, &d_addr); - ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); + rte_ether_addr_copy(&d_addr, &arp_hdr->arp_data.arp_sha); arp_hdr->arp_data.arp_sip = bond_ip; rte_eth_tx_burst(BOND_PORT, 0, &pkts[i], 1); is_free = 1; @@ -410,7 +411,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) } ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { - ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); ipv4_hdr->dst_addr = ipv4_hdr->src_addr; ipv4_hdr->src_addr = bond_ip; diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c index 27c22cf90..3d2a70d52 100644 --- a/examples/ethtool/ethtool-app/main.c +++ b/examples/ethtool/ethtool-app/main.c @@ -161,8 +161,8 @@ static void process_frame(struct app_port *ptr_port, struct rte_ether_hdr *ptr_mac_hdr; ptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct rte_ether_hdr *); - ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); - ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); + rte_ether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr); + rte_ether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr); } static int slave_main(__attribute__((unused)) void *ptr_data) diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c index 299488c1c..571c4e5aa 100644 --- a/examples/ethtool/lib/rte_ethtool.c +++ b/examples/ethtool/lib/rte_ethtool.c @@ -327,7 +327,7 @@ rte_ethtool_net_validate_addr(uint16_t port_id __rte_unused, { if (addr == NULL) return -EINVAL; - return is_valid_assigned_ether_addr(addr); + return rte_is_valid_assigned_ether_addr(addr); } int diff --git a/examples/eventdev_pipeline/pipeline_common.h b/examples/eventdev_pipeline/pipeline_common.h index ef23d963a..8e30393d0 100644 --- a/examples/eventdev_pipeline/pipeline_common.h +++ b/examples/eventdev_pipeline/pipeline_common.h @@ -104,8 +104,8 @@ exchange_mac(struct rte_mbuf *m) /* change mac addresses on packet (to use mbuf data) */ eth = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ether_addr_copy(ð->d_addr, &addr); - ether_addr_copy(&addr, ð->d_addr); + rte_ether_addr_copy(ð->d_addr, &addr); + rte_ether_addr_copy(&addr, ð->d_addr); } static __rte_always_inline void diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c index 7b8e7c4fa..cf9421874 100644 --- a/examples/flow_filtering/main.c +++ b/examples/flow_filtering/main.c @@ -48,7 +48,7 @@ static inline void print_ether_addr(const char *what, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 a9efb4baa..8d82a6411 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -354,7 +354,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, *((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)port_out << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[port_out], ð_hdr->s_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); else @@ -572,7 +573,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index d9ecac006..fe92fcdd2 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -410,7 +410,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, *((uint64_t *)d_addr_bytes) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); } @@ -695,7 +695,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 66e92165d..9a2c6e3ba 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1428,7 +1428,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 a047197c7..938375230 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -278,8 +278,8 @@ mcast_send_pkt(struct rte_mbuf *pkt, struct rte_ether_addr *dest_addr, rte_pktmbuf_prepend(pkt, (uint16_t)sizeof(*ethdr)); RTE_ASSERT(ethdr != NULL); - ether_addr_copy(dest_addr, ðdr->d_addr); - ether_addr_copy(&ports_eth_addr[port], ðdr->s_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); /* Put new packet into the output queue */ @@ -540,7 +540,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/kni/main.c b/examples/kni/main.c index 8bea07182..a6d6fc2d2 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -835,7 +835,7 @@ static void print_ethaddr(const char *name, struct rte_ether_addr *mac_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, mac_addr); RTE_LOG(INFO, APP, "\t%s%s\n", name, buf); } diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index dd09855e7..a77b000a9 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -603,7 +603,7 @@ l2fwd_mac_updating(struct rte_mbuf *m, uint16_t dest_portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } static void diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 033104d63..77e44dc82 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -349,7 +349,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 21d19932d..9831a4323 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -179,7 +179,7 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index c1d6797b0..1e2b14297 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -161,7 +161,7 @@ l2fwd_mac_updating(struct rte_mbuf *m, unsigned dest_portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dest_portid << 40); /* src addr */ - ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); + rte_ether_addr_copy(&l2fwd_ports_eth_addr[dest_portid], ð->s_addr); } static void diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 3a0f5820e..4b15853e3 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1757,7 +1757,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 bcd584d3e..7f7be22c6 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -700,7 +700,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -725,7 +726,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(m, dst_port); #else @@ -1580,7 +1582,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, 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 2c0c89e21..56a55ac28 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -450,7 +450,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, #endif /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); send_single_packet(m, dst_port); @@ -791,7 +791,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index de1278b04..e787691e1 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -47,7 +47,8 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { @@ -68,7 +69,8 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else { diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 0c98d3fc4..950cde32a 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -43,7 +43,8 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -64,7 +65,8 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(qconf, m, dst_port); } else { diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index b0a700ab1..3f4625abd 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -650,7 +650,7 @@ static void print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -914,7 +914,7 @@ main(int argc, char **argv) /* * prepare src MACs for each port. */ - ether_addr_copy(&ports_eth_addr[portid], + rte_ether_addr_copy(&ports_eth_addr[portid], (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index 9997c58f4..9cd4dc7a6 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -176,7 +176,7 @@ lsi_simple_forward(struct rte_mbuf *m, unsigned portid) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&lsi_ports_eth_addr[dst_port], ð->s_addr); buffer = tx_buffer[dst_port]; sent = rte_eth_tx_buffer(dst_port, 0, buffer, m); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index b29ed9e97..8e28c16e1 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -1070,14 +1070,14 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); send_single_packet(m[0], (uint8_t)dst_port[0]); send_single_packet(m[1], (uint8_t)dst_port[1]); @@ -1204,14 +1204,14 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) *(uint64_t *)ð_hdr[7]->d_addr = dest_eth_addr[dst_port[7]]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); - ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[0]], ð_hdr[0]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[1]], ð_hdr[1]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[2]], ð_hdr[2]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[3]], ð_hdr[3]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[4]], ð_hdr[4]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[5]], ð_hdr[5]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[6]], ð_hdr[6]->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port[7]], ð_hdr[7]->s_addr); send_single_packet(m[0], dst_port[0]); send_single_packet(m[1], dst_port[1]); @@ -1262,7 +1262,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { @@ -1283,7 +1284,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) *(uint64_t *)ð_hdr->d_addr = dest_eth_addr[dst_port]; /* src addr */ - ether_addr_copy(&ports_eth_addr[dst_port], ð_hdr->s_addr); + rte_ether_addr_copy(&ports_eth_addr[dst_port], + ð_hdr->s_addr); send_single_packet(m, dst_port); } else @@ -3024,7 +3026,7 @@ print_ethaddr(const char *name, const struct rte_ether_addr *eth_addr) { char buf[ETHER_ADDR_FMT_SIZE]; - ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); + rte_ether_format_addr(buf, ETHER_ADDR_FMT_SIZE, eth_addr); printf("%s%s", name, buf); } @@ -3582,7 +3584,7 @@ main(int argc, char **argv) /* * prepare src MACs for each port. */ - ether_addr_copy(&ports_eth_addr[portid], + rte_ether_addr_copy(&ports_eth_addr[portid], (struct rte_ether_addr *)(val_eth + portid) + 1); /* init memory */ diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index 7d28f59ce..1266f521c 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -401,7 +401,7 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) rte_eth_macaddr_get(ptp_data->portid, ð_hdr->s_addr); /* Set multicast address 01-1B-19-00-00-00. */ - ether_addr_copy(ð_multicast, ð_hdr->d_addr); + rte_ether_addr_copy(ð_multicast, ð_hdr->d_addr); eth_hdr->ether_type = htons(PTP_PROTOCOL); ptp_msg = (struct ptp_message *) diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index 61e92a820..a61360b99 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -67,7 +67,7 @@ static void send_pause_frame(uint16_t port_id, uint16_t duration) pause_frame = (struct ether_fc_frame *) &hdr[1]; rte_eth_macaddr_get(port_id, &mac_addr); - ether_addr_copy(&mac_addr, &hdr->s_addr); + rte_ether_addr_copy(&mac_addr, &hdr->s_addr); void *tmp = &hdr->d_addr.addr_bytes[0]; *((uint64_t *)tmp) = 0x010000C28001ULL; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index e4af7bc4d..3316df13a 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -243,7 +243,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) /* Learn MAC address of guest device from packet */ pkt_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { + if (rte_is_same_ether_addr(&(pkt_hdr->s_addr), &vdev->mac_address)) { RTE_LOG(INFO, VHOST_DATA, "(%d) WARNING: This device is using an existing" " MAC address and has not been registered.\n", @@ -261,11 +261,11 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; /* inner MAC */ - ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); tunnel_filter_conf.queue_id = vdev->rx_q; tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; @@ -309,9 +309,9 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) } vxdev.out_key = tenant_id_conf[vdev->rx_q]; - ether_addr_copy(&vxdev.port[portid].peer_mac, + rte_ether_addr_copy(&vxdev.port[portid].peer_mac, &app_l2_hdr[portid].d_addr); - ether_addr_copy(&ports_eth_addr[0], + 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); @@ -349,8 +349,10 @@ vxlan_unlink(struct vhost_dev *vdev) memset(&tunnel_filter_conf, 0, sizeof(struct rte_eth_tunnel_filter_conf)); - ether_addr_copy(&ports_eth_addr[0], &tunnel_filter_conf.outer_mac); - ether_addr_copy(&vdev->mac_address, &tunnel_filter_conf.inner_mac); + rte_ether_addr_copy(&ports_eth_addr[0], + &tunnel_filter_conf.outer_mac); + rte_ether_addr_copy(&vdev->mac_address, + &tunnel_filter_conf.inner_mac); tunnel_filter_conf.tenant_id = tenant_id_conf[vdev->rx_q]; tunnel_filter_conf.filter_type = tep_filter_type[filter_idx]; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index cd1a51bfa..f4f0fc862 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -666,7 +666,7 @@ find_vhost_dev(struct rte_ether_addr *mac) TAILQ_FOREACH(vdev, &vhost_dev_list, global_vdev_entry) { if (vdev->ready == DEVICE_RX && - is_same_ether_addr(mac, &vdev->mac_address)) + rte_is_same_ether_addr(mac, &vdev->mac_address)) return vdev; } @@ -916,7 +916,7 @@ virtio_tx_route(struct vhost_dev *vdev, struct rte_mbuf *m, uint16_t vlan_tag) nh = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - if (unlikely(is_broadcast_ether_addr(&nh->d_addr))) { + if (unlikely(rte_is_broadcast_ether_addr(&nh->d_addr))) { struct vhost_dev *vdev2; TAILQ_FOREACH(vdev2, &vhost_dev_list, global_vdev_entry) { diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 5195a515a..7281ffd7f 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -417,7 +417,7 @@ update_mac_address(struct rte_mbuf *m, unsigned dst_port) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); } /* When we receive a HUP signal, print out our stats */ diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 75cf31a10..389000327 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -504,7 +504,7 @@ update_mac_address(struct rte_mbuf *m, unsigned dst_port) *((uint64_t *)tmp) = 0x000000000002 + ((uint64_t)dst_port << 40); /* src addr */ - ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); + rte_ether_addr_copy(&vmdq_ports_eth_addr[dst_port], ð->s_addr); } /* When we receive a HUP signal, print out our stats */ diff --git a/lib/librte_ethdev/rte_class_eth.c b/lib/librte_ethdev/rte_class_eth.c index e554668da..873a65353 100644 --- a/lib/librte_ethdev/rte_class_eth.c +++ b/lib/librte_ethdev/rte_class_eth.c @@ -61,7 +61,7 @@ eth_mac_cmp(const char *key __rte_unused, /* Return 0 if devargs MAC is matching one of the device MACs. */ rte_eth_dev_info_get(data->port_id, &dev_info); for (index = 0; index < dev_info.max_mac_addrs; index++) - if (is_same_ether_addr(&mac, &data->mac_addrs[index])) + if (rte_is_same_ether_addr(&mac, &data->mac_addrs[index])) return 0; return -1; /* no match */ } diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index b868535c2..1af36dead 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1363,7 +1363,7 @@ rte_eth_dev_mac_restore(struct rte_eth_dev *dev, addr = &dev->data->mac_addrs[i]; /* skip zero address */ - if (is_zero_ether_addr(addr)) + if (rte_is_zero_ether_addr(addr)) continue; pool = 0; @@ -2597,7 +2597,7 @@ rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr) RTE_ETH_VALID_PORTID_OR_RET(port_id); dev = &rte_eth_devices[port_id]; - ether_addr_copy(&dev->data->mac_addrs[0], mac_addr); + rte_ether_addr_copy(&dev->data->mac_addrs[0], mac_addr); } @@ -3109,7 +3109,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, dev = &rte_eth_devices[port_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->mac_addr_add, -ENOTSUP); - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n", port_id); return -EINVAL; @@ -3140,7 +3140,7 @@ rte_eth_dev_mac_addr_add(uint16_t port_id, struct rte_ether_addr *addr, if (ret == 0) { /* Update address in NIC data structure */ - ether_addr_copy(addr, &dev->data->mac_addrs[index]); + rte_ether_addr_copy(addr, &dev->data->mac_addrs[index]); /* Update pool bitmap in NIC data structure */ dev->data->mac_pool_sel[index] |= (1ULL << pool); @@ -3172,7 +3172,7 @@ rte_eth_dev_mac_addr_remove(uint16_t port_id, struct rte_ether_addr *addr) (*dev->dev_ops->mac_addr_remove)(dev, index); /* Update address in NIC data structure */ - ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]); + rte_ether_addr_copy(&null_mac_addr, &dev->data->mac_addrs[index]); /* reset pool bitmap */ dev->data->mac_pool_sel[index] = 0; @@ -3188,7 +3188,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); - if (!is_valid_assigned_ether_addr(addr)) + if (!rte_is_valid_assigned_ether_addr(addr)) return -EINVAL; dev = &rte_eth_devices[port_id]; @@ -3199,7 +3199,7 @@ rte_eth_dev_default_mac_addr_set(uint16_t port_id, struct rte_ether_addr *addr) return ret; /* Update default address in NIC data structure */ - ether_addr_copy(addr, &dev->data->mac_addrs[0]); + rte_ether_addr_copy(addr, &dev->data->mac_addrs[0]); return 0; } @@ -3239,7 +3239,7 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); dev = &rte_eth_devices[port_id]; - if (is_zero_ether_addr(addr)) { + if (rte_is_zero_ether_addr(addr)) { RTE_ETHDEV_LOG(ERR, "Port %u: Cannot add NULL MAC address\n", port_id); return -EINVAL; @@ -3271,10 +3271,10 @@ rte_eth_dev_uc_hash_table_set(uint16_t port_id, struct rte_ether_addr *addr, if (ret == 0) { /* Update address in NIC data structure */ if (on) - ether_addr_copy(addr, + rte_ether_addr_copy(addr, &dev->data->hash_mac_addrs[index]); else - ether_addr_copy(&null_mac_addr, + rte_ether_addr_copy(&null_mac_addr, &dev->data->hash_mac_addrs[index]); } diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 284219517..99c9c7d91 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -160,8 +160,8 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, dst = &(tbl->flows[flow_idx].key); - ether_addr_copy(&(src->eth_saddr), &(dst->eth_saddr)); - ether_addr_copy(&(src->eth_daddr), &(dst->eth_daddr)); + rte_ether_addr_copy(&(src->eth_saddr), &(dst->eth_saddr)); + rte_ether_addr_copy(&(src->eth_daddr), &(dst->eth_daddr)); dst->ip_src_addr = src->ip_src_addr; dst->ip_dst_addr = src->ip_dst_addr; dst->recv_ack = src->recv_ack; @@ -243,8 +243,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); - ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr)); - ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr)); + rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.eth_saddr)); + rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.eth_daddr)); key.ip_src_addr = ipv4_hdr->src_addr; key.ip_dst_addr = ipv4_hdr->dst_addr; key.src_port = tcp_hdr->src_port; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 988cca8c6..ce3471a4d 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -187,8 +187,8 @@ uint32_t gro_tcp4_tbl_pkt_count(void *tbl); static inline int is_same_tcp4_flow(struct tcp4_flow_key k1, struct tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && - is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && + return (rte_is_same_ether_addr(&k1.eth_saddr, &k2.eth_saddr) && + rte_is_same_ether_addr(&k1.eth_daddr, &k2.eth_daddr) && (k1.ip_src_addr == k2.ip_src_addr) && (k1.ip_dst_addr == k2.ip_dst_addr) && (k1.recv_ack == k2.recv_ack) && diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index d713e3dd6..350793b69 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -164,9 +164,9 @@ insert_new_flow(struct gro_vxlan_tcp4_tbl *tbl, dst = &(tbl->flows[flow_idx].key); - ether_addr_copy(&(src->inner_key.eth_saddr), + rte_ether_addr_copy(&(src->inner_key.eth_saddr), &(dst->inner_key.eth_saddr)); - ether_addr_copy(&(src->inner_key.eth_daddr), + rte_ether_addr_copy(&(src->inner_key.eth_daddr), &(dst->inner_key.eth_daddr)); dst->inner_key.ip_src_addr = src->inner_key.ip_src_addr; dst->inner_key.ip_dst_addr = src->inner_key.ip_dst_addr; @@ -176,8 +176,8 @@ insert_new_flow(struct gro_vxlan_tcp4_tbl *tbl, dst->vxlan_hdr.vx_flags = src->vxlan_hdr.vx_flags; dst->vxlan_hdr.vx_vni = src->vxlan_hdr.vx_vni; - ether_addr_copy(&(src->outer_eth_saddr), &(dst->outer_eth_saddr)); - ether_addr_copy(&(src->outer_eth_daddr), &(dst->outer_eth_daddr)); + rte_ether_addr_copy(&(src->outer_eth_saddr), &(dst->outer_eth_saddr)); + rte_ether_addr_copy(&(src->outer_eth_daddr), &(dst->outer_eth_daddr)); dst->outer_ip_src_addr = src->outer_ip_src_addr; dst->outer_ip_dst_addr = src->outer_ip_dst_addr; dst->outer_src_port = src->outer_src_port; @@ -193,8 +193,9 @@ static inline int is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, struct vxlan_tcp4_flow_key k2) { - return (is_same_ether_addr(&k1.outer_eth_saddr, &k2.outer_eth_saddr) && - is_same_ether_addr(&k1.outer_eth_daddr, + return (rte_is_same_ether_addr(&k1.outer_eth_saddr, + &k2.outer_eth_saddr) && + rte_is_same_ether_addr(&k1.outer_eth_daddr, &k2.outer_eth_daddr) && (k1.outer_ip_src_addr == k2.outer_ip_src_addr) && (k1.outer_ip_dst_addr == k2.outer_ip_dst_addr) && @@ -356,8 +357,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); - ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr)); - ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr)); + rte_ether_addr_copy(&(eth_hdr->s_addr), &(key.inner_key.eth_saddr)); + rte_ether_addr_copy(&(eth_hdr->d_addr), &(key.inner_key.eth_daddr)); key.inner_key.ip_src_addr = ipv4_hdr->src_addr; key.inner_key.ip_dst_addr = ipv4_hdr->dst_addr; key.inner_key.recv_ack = tcp_hdr->recv_ack; @@ -366,8 +367,8 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, key.vxlan_hdr.vx_flags = vxlan_hdr->vx_flags; key.vxlan_hdr.vx_vni = vxlan_hdr->vx_vni; - ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr)); - ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr)); + rte_ether_addr_copy(&(outer_eth_hdr->s_addr), &(key.outer_eth_saddr)); + rte_ether_addr_copy(&(outer_eth_hdr->d_addr), &(key.outer_eth_daddr)); key.outer_ip_src_addr = outer_ipv4_hdr->src_addr; key.outer_ip_dst_addr = outer_ipv4_hdr->dst_addr; key.outer_src_port = udp_hdr->src_port; diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c index adda9f700..0b204a573 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -31,7 +31,7 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, /* Ethernet header. */ memset(eth_hdr->d_addr.addr_bytes, 0xff, ETHER_ADDR_LEN); - ether_addr_copy(mac, ð_hdr->s_addr); + rte_ether_addr_copy(mac, ð_hdr->s_addr); eth_hdr->ether_type = htons(ETHER_TYPE_RARP); /* RARP header. */ @@ -42,8 +42,8 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool, rarp->arp_plen = 4; rarp->arp_opcode = htons(RTE_ARP_OP_REVREQUEST); - ether_addr_copy(mac, &rarp->arp_data.arp_sha); - ether_addr_copy(mac, &rarp->arp_data.arp_tha); + rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha); + rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha); memset(&rarp->arp_data.arp_sip, 0x00, 4); memset(&rarp->arp_data.arp_tip, 0x00, 4); diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index afdbaa1a7..cc31fbd9b 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -75,7 +75,7 @@ struct rte_ether_addr { * True (1) if the given two ethernet address are the same; * False (0) otherwise. */ -static inline int is_same_ether_addr(const struct rte_ether_addr *ea1, +static inline int rte_is_same_ether_addr(const struct rte_ether_addr *ea1, const struct rte_ether_addr *ea2) { int i; @@ -95,7 +95,7 @@ static inline int is_same_ether_addr(const struct rte_ether_addr *ea1, * True (1) if the given ethernet address is filled with zeros; * false (0) otherwise. */ -static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_zero_ether_addr(const struct rte_ether_addr *ea) { int i; for (i = 0; i < ETHER_ADDR_LEN; i++) @@ -114,7 +114,7 @@ static inline int is_zero_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a unicast address; * false (0) otherwise. */ -static inline int is_unicast_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; } @@ -129,7 +129,7 @@ static inline int is_unicast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a multicast address; * false (0) otherwise. */ -static inline int is_multicast_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; } @@ -144,7 +144,7 @@ static inline int is_multicast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a broadcast address; * false (0) otherwise. */ -static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_broadcast_ether_addr(const struct rte_ether_addr *ea) { const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea; @@ -162,7 +162,7 @@ static inline int is_broadcast_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a universally assigned address; * false (0) otherwise. */ -static inline int is_universal_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; } @@ -177,7 +177,7 @@ static inline int is_universal_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is a locally assigned address; * false (0) otherwise. */ -static inline int is_local_admin_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; } @@ -193,9 +193,9 @@ static inline int is_local_admin_ether_addr(const struct rte_ether_addr *ea) * True (1) if the given ethernet address is valid; * false (0) otherwise. */ -static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) +static inline int rte_is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) { - return is_unicast_ether_addr(ea) && (!is_zero_ether_addr(ea)); + return rte_is_unicast_ether_addr(ea) && (!rte_is_zero_ether_addr(ea)); } /** @@ -204,7 +204,7 @@ static inline int is_valid_assigned_ether_addr(const struct rte_ether_addr *ea) * @param addr * A pointer to Ethernet address. */ -static inline void eth_random_addr(uint8_t *addr) +static inline void rte_eth_random_addr(uint8_t *addr) { uint64_t rand = rte_rand(); uint8_t *p = (uint8_t *)&rand; @@ -222,7 +222,7 @@ static inline void eth_random_addr(uint8_t *addr) * @param ea_to * A pointer to a ether_addr structure where to copy the Ethernet address. */ -static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, +static inline void rte_ether_addr_copy(const struct rte_ether_addr *ea_from, struct rte_ether_addr *ea_to) { #ifdef __INTEL_COMPILER @@ -252,7 +252,7 @@ static inline void ether_addr_copy(const struct rte_ether_addr *ea_from, * A pointer to a ether_addr structure. */ static inline void -ether_format_addr(char *buf, uint16_t size, +rte_ether_format_addr(char *buf, uint16_t size, const struct rte_ether_addr *eth_addr) { snprintf(buf, size, "%02X:%02X:%02X:%02X:%02X:%02X", diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 1e85cc9cf..a474148c7 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -615,8 +615,8 @@ encap_ether_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->ether.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->ether.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ethertype); return 0; @@ -633,8 +633,8 @@ encap_vlan_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->vlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -657,8 +657,8 @@ encap_qinq_apply(void *data, ETHER_TYPE_IPv6; /* Ethernet */ - ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); + 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); /* SVLAN */ @@ -683,8 +683,8 @@ encap_qinq_pppoe_apply(void *data, struct encap_qinq_pppoe_data *d = data; /* Ethernet */ - ether_addr_copy(&p->qinq.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->qinq.ether.sa, &d->ether.s_addr); + 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); /* SVLAN */ @@ -719,8 +719,8 @@ encap_mpls_apply(void *data, uint32_t i; /* Ethernet */ - ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->mpls.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->mpls.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ethertype); /* MPLS */ @@ -746,8 +746,8 @@ encap_pppoe_apply(void *data, struct encap_pppoe_data *d = data; /* Ethernet */ - ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr); + rte_ether_addr_copy(&p->pppoe.ether.da, &d->ether.d_addr); + rte_ether_addr_copy(&p->pppoe.ether.sa, &d->ether.s_addr); d->ether.ether_type = rte_htons(ETHER_TYPE_PPPOE_SESSION); /* PPPoE and PPP*/ @@ -776,8 +776,10 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv4_vlan_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -815,8 +817,10 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv4_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* IPv4*/ @@ -850,8 +854,10 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv6_vlan_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* VLAN */ @@ -889,8 +895,10 @@ encap_vxlan_apply(void *data, struct encap_vxlan_ipv6_data *d = data; /* Ethernet */ - ether_addr_copy(&p->vxlan.ether.da, &d->ether.d_addr); - ether_addr_copy(&p->vxlan.ether.sa, &d->ether.s_addr); + 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); /* IPv6*/ -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 05/15] net: add rte prefix to ether defines 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (3 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 04/15] net: add rte prefix to ether functions Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-24 11:37 ` Ferruh Yigit 2019-05-21 16:13 ` [dpdk-dev] [PATCH 06/15] net: add rte prefix to esp structure Olivier Matz ` (12 subsequent siblings) 17 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit 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 <olivier.matz@6wind.com> --- 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 | 11 +- 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 | 111 ++++++++++---------- app/test/test_link_bonding_mode4.c | 30 +++--- 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/include/compat.h | 2 + drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +- drivers/net/ark/ark_ethdev.c | 5 +- drivers/net/atlantic/atl_ethdev.c | 13 ++- drivers/net/avp/avp_ethdev.c | 9 +- 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 | 73 ++++++------- drivers/net/bnxt/bnxt_filter.c | 4 +- drivers/net/bnxt/bnxt_filter.h | 8 +- drivers/net/bnxt/bnxt_flow.c | 15 +-- drivers/net/bnxt/bnxt_hwrm.c | 35 ++++--- drivers/net/bnxt/bnxt_ring.c | 8 +- drivers/net/bnxt/bnxt_rxq.c | 2 +- drivers/net/bnxt/bnxt_rxr.c | 4 +- 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 | 42 ++++---- drivers/net/cxgbe/cxgbe.h | 5 +- drivers/net/cxgbe/cxgbe_compat.h | 1 + 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 | 9 +- 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 | 5 +- drivers/net/e1000/em_ethdev.c | 22 ++-- drivers/net/e1000/em_rxtx.c | 18 ++-- drivers/net/e1000/igb_ethdev.c | 46 ++++---- drivers/net/e1000/igb_flow.c | 4 +- drivers/net/e1000/igb_pf.c | 11 +- drivers/net/e1000/igb_rxtx.c | 14 +-- drivers/net/ena/ena_ethdev.h | 2 +- drivers/net/enetc/base/enetc_hw.h | 4 +- drivers/net/enetc/enetc_ethdev.c | 19 ++-- 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 | 5 +- drivers/net/failsafe/failsafe_args.c | 2 +- drivers/net/failsafe/failsafe_ether.c | 5 +- drivers/net/fm10k/fm10k.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 54 +++++----- drivers/net/i40e/i40e_ethdev.h | 2 +- drivers/net/i40e/i40e_ethdev_vf.c | 25 ++--- 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 | 22 ++-- drivers/net/iavf/iavf_rxtx.c | 8 +- drivers/net/ice/ice_ethdev.c | 21 ++-- drivers/net/ice/ice_ethdev.h | 2 +- drivers/net/ice/ice_rxtx.c | 22 ++-- drivers/net/ipn3ke/ipn3ke_ethdev.h | 2 +- drivers/net/ipn3ke/ipn3ke_flow.c | 4 +- drivers/net/ipn3ke/ipn3ke_representor.c | 10 +- drivers/net/ixgbe/ixgbe_ethdev.c | 49 +++++---- drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- drivers/net/ixgbe/ixgbe_flow.c | 14 +-- drivers/net/ixgbe/ixgbe_pf.c | 11 +- drivers/net/ixgbe/ixgbe_rxtx.c | 7 +- 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 | 10 +- 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 | 14 ++- 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 | 6 +- drivers/net/mvpp2/mrvl_ethdev.c | 12 +-- drivers/net/mvpp2/mrvl_ethdev.h | 6 +- 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/nfb/nfb_ethdev.c | 2 +- drivers/net/nfp/nfp_net.c | 11 +- drivers/net/nfp/nfp_net_pmd.h | 2 +- drivers/net/octeontx/octeontx_ethdev.c | 7 +- drivers/net/octeontx/octeontx_ethdev.h | 2 +- drivers/net/pcap/rte_eth_pcap.c | 18 ++-- drivers/net/qede/base/bcm_osal.h | 4 +- drivers/net/qede/qede_ethdev.c | 18 ++-- drivers/net/qede/qede_filter.c | 24 +++-- 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 | 6 +- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/softnic/parser.c | 6 +- drivers/net/tap/rte_eth_tap.c | 24 +++-- drivers/net/tap/tap_flow.c | 12 ++- drivers/net/thunderx/base/nicvf_plat.h | 4 +- drivers/net/thunderx/nicvf_ethdev.c | 13 +-- drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/virtio/virtio_ethdev.c | 52 ++++++---- 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 | 21 ++-- 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 | 16 +-- 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 | 19 ++-- lib/librte_ethdev/rte_ethdev.h | 2 +- lib/librte_ethdev/rte_flow.h | 8 +- 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 | 121 +++++++++++----------- 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 +- 212 files changed, 1150 insertions(+), 1077 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 1fb609940..d1e0d4402 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1925,16 +1925,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; @@ -1996,8 +1996,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); @@ -8236,7 +8236,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; @@ -9210,7 +9210,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; } @@ -15301,9 +15301,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 = { @@ -15492,9 +15492,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 = { @@ -15609,9 +15609,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 = { @@ -15801,9 +15801,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 = { @@ -16039,9 +16039,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 2e274f9b1..7a1c5aba9 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3493,9 +3493,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, @@ -3616,9 +3616,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, @@ -3680,22 +3680,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); } @@ -3744,7 +3744,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) { @@ -3815,22 +3815,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); } @@ -3910,22 +3910,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); } @@ -4006,22 +4006,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); } @@ -4103,22 +4103,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 7a67690f2..ab458c8d2 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 8de37c87e..d1344b923 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); @@ -159,11 +159,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; @@ -201,7 +201,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 */ @@ -223,7 +223,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; @@ -234,10 +234,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; @@ -247,11 +247,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; @@ -265,7 +265,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 */ @@ -286,7 +286,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; @@ -296,10 +296,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; @@ -308,11 +308,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; @@ -349,10 +349,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; } @@ -384,7 +384,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; @@ -398,7 +398,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 */ @@ -459,7 +459,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; @@ -495,7 +495,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 3f29e9408..ccc5dd85c 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 f41179208..c6c7cb6bd 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_op = RTE_BE_TO_CPU_16(arp_h->arp_opcode); arp_pro = 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_pro != ETHER_TYPE_IPv4) || + (arp_pro != RTE_ETHER_TYPE_IPv4) || (arp_h->arp_hlen != 6) || (arp_h->arp_plen != 4) ) { @@ -414,7 +414,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 41eb3ffa8..245b61064 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -879,15 +879,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 2c736ecac..55e1b9d27 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -413,7 +413,8 @@ 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 = { @@ -526,7 +527,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. @@ -582,7 +583,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; } } @@ -1223,8 +1224,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 abee0a952..e3a6f7c71 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -501,8 +501,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; @@ -516,8 +516,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; @@ -526,8 +526,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; @@ -547,8 +547,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; @@ -571,8 +571,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 eb3a245d2..91fb1f6fb 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -268,7 +268,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 ba94e6193..0999b87e1 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -65,7 +65,7 @@ initialize_eth_header(struct rte_ether_hdr *eth_hdr, 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; @@ -82,8 +82,8 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, 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); @@ -322,10 +322,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); } @@ -437,10 +437,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 5a7f45f94..eb6f1a9f1 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, @@ -237,7 +237,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); @@ -396,7 +396,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( @@ -752,7 +752,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); @@ -902,7 +902,8 @@ 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); @@ -942,8 +943,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), @@ -974,13 +975,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)), @@ -1005,13 +1006,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)), @@ -1042,19 +1043,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)), @@ -1271,9 +1272,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, @@ -1953,7 +1954,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) { @@ -2046,7 +2047,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, @@ -2583,7 +2584,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, @@ -2599,7 +2600,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], @@ -3425,7 +3426,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); @@ -4011,12 +4012,12 @@ test_tlb_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); } 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); + RTE_ETHER_TYPE_IPv4, 0, 0); } pktlen = initialize_udp_header(test_params->pkt_udp_hdr, src_port, dst_port_0, 16); @@ -4519,10 +4520,10 @@ 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, - 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, @@ -4530,10 +4531,10 @@ 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, - 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, @@ -4541,10 +4542,10 @@ 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, - 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, @@ -4552,10 +4553,10 @@ 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, - 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, @@ -4640,10 +4641,10 @@ 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, - 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, @@ -4652,10 +4653,10 @@ 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, - 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, @@ -4664,10 +4665,10 @@ 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, - 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, @@ -4676,10 +4677,10 @@ 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, - 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, @@ -4774,16 +4775,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, - 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); @@ -4810,7 +4811,8 @@ 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; } @@ -4819,7 +4821,8 @@ 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 0bb81fd2e..96466a1ac 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,8 @@ 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 */ @@ -930,11 +931,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."); @@ -995,7 +996,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) @@ -1068,7 +1069,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) @@ -1140,9 +1141,10 @@ 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; @@ -1168,7 +1170,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); @@ -1368,7 +1370,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); @@ -1422,7 +1424,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 a782bf3e5..a08e1294c 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -95,7 +95,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 602a06b5f..593564d13 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 937f52bce..a34d012e5 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/include/compat.h b/drivers/bus/dpaa/include/compat.h index 412265779..86cecf67b 100644 --- a/drivers/bus/dpaa/include/compat.h +++ b/drivers/bus/dpaa/include/compat.h @@ -109,6 +109,8 @@ typedef uint32_t phandle; typedef uint32_t gfp_t; typedef uint32_t irqreturn_t; +#define ETHER_ADDR_LEN 6 + #define IRQ_HANDLED 0 #define request_irq qbman_request_irq #define free_irq qbman_free_irq diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 893c9ed9f..28e6aa27e 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -352,7 +352,7 @@ eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) dev_info->max_rx_queues = 1; dev_info->max_tx_queues = 1; - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->max_mtu = ETH_AF_XDP_FRAME_SIZE - ETH_AF_XDP_DATA_HEADROOM; dev_info->default_rxportconf.nb_queues = 1; @@ -816,7 +816,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 6a1530aa2..7692aa2d9 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,8 @@ 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 6b395806c..d110e351e 100644 --- a/drivers/net/atlantic/atl_ethdev.c +++ b/drivers/net/atlantic/atl_ethdev.c @@ -416,7 +416,8 @@ 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; @@ -897,7 +898,8 @@ int atl_macsec_config_txsc(struct rte_eth_dev *dev, uint8_t *mac) ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private); memset(&cfg->aq_macsec.txsc.mac, 0, sizeof(cfg->aq_macsec.txsc.mac)); - memcpy((uint8_t *)&cfg->aq_macsec.txsc.mac + 2, mac, ETHER_ADDR_LEN); + memcpy((uint8_t *)&cfg->aq_macsec.txsc.mac + 2, mac, + RTE_ETHER_ADDR_LEN); return 0; } @@ -909,7 +911,8 @@ int atl_macsec_config_rxsc(struct rte_eth_dev *dev, ATL_DEV_PRIVATE_TO_CFG(dev->data->dev_private); memset(&cfg->aq_macsec.rxsc.mac, 0, sizeof(cfg->aq_macsec.rxsc.mac)); - memcpy((uint8_t *)&cfg->aq_macsec.rxsc.mac + 2, mac, ETHER_ADDR_LEN); + memcpy((uint8_t *)&cfg->aq_macsec.rxsc.mac + 2, mac, + RTE_ETHER_ADDR_LEN); cfg->aq_macsec.rxsc.pi = pi; return 0; @@ -1604,11 +1607,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..bd5eba4a0 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,11 @@ 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 39d30913b..e771e40cb 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -9787,13 +9787,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 7126097db..fce715b6d 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 c64315053..b0244d6d1 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,8 +462,8 @@ 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 - + VLAN_TAG_SIZE * 2; + 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; if (bp->flags & BNXT_FLAG_PTP_SUPPORTED) @@ -595,9 +595,9 @@ 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 * - BNXT_NUM_VLANS; + eth_dev->data->dev_conf.rxmode.max_rx_pkt_len - + RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN - VLAN_TAG_SIZE * + BNXT_NUM_VLANS; bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu); } return 0; @@ -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; @@ -1472,8 +1472,8 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, 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 | @@ -1508,8 +1508,9 @@ 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; @@ -1582,13 +1583,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; @@ -1599,7 +1600,8 @@ 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); @@ -1608,8 +1610,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; @@ -1794,8 +1796,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; @@ -1818,7 +1820,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)) { @@ -1829,7 +1831,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)) { @@ -1884,9 +1886,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; @@ -2397,7 +2399,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 @@ -2441,13 +2443,14 @@ 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, @@ -3354,16 +3357,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], @@ -3374,7 +3377,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..bb7f672fc 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,14 @@ 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..4f0142cdb 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,8 @@ 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 +3126,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 +3697,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 +3800,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..303549b5d 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -640,8 +640,8 @@ 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 + - (2 * VLAN_TAG_SIZE); + 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); rxr = rte_zmalloc_socket("bnxt_rx_ring", 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 6077c3dc8..d764dad33 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 00d6b50e4..a1c577b9e 100644 --- a/drivers/net/bonding/rte_eth_bond_alb.c +++ b/drivers/net/bonding/rte_eth_bond_alb.c @@ -216,9 +216,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) @@ -233,8 +233,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 e83e668ad..79962b43a 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -37,15 +37,15 @@ 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); @@ -108,7 +108,8 @@ 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 && @@ -122,7 +123,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 = { @@ -398,7 +399,8 @@ 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; @@ -605,7 +607,7 @@ mode6_debug(const char __attribute__((unused)) *info, 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 @@ -615,7 +617,7 @@ mode6_debug(const char __attribute__((unused)) *info, 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); @@ -644,14 +646,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 } @@ -809,12 +811,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); @@ -849,7 +851,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; @@ -880,7 +882,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); @@ -1107,7 +1109,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 */ @@ -2252,7 +2254,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 @@ -3084,12 +3086,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; } @@ -3148,7 +3150,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) { @@ -3158,7 +3160,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/cxgbe.h b/drivers/net/cxgbe/cxgbe.h index 6af3ee79b..3f97fa58b 100644 --- a/drivers/net/cxgbe/cxgbe.h +++ b/drivers/net/cxgbe/cxgbe.h @@ -15,8 +15,9 @@ #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_compat.h b/drivers/net/cxgbe/cxgbe_compat.h index edc8ea57d..cce51c2f9 100644 --- a/drivers/net/cxgbe/cxgbe_compat.h +++ b/drivers/net/cxgbe/cxgbe_compat.h @@ -101,6 +101,7 @@ #define PTR_ALIGN(p, a) ((typeof(p))CXGBE_ALIGN((unsigned long)(p), (a))) #define VLAN_HLEN 4 +#define ETHER_ADDR_LEN 6 #define rmb() rte_rmb() /* dpdk rte provided rmb */ #define wmb() rte_wmb() /* dpdk rte provided wmb */ diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index e36936959..c03559640 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -277,16 +277,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 @@ -587,7 +587,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", @@ -626,7 +626,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 28c3c66ba..b5d5cd081 100644 --- a/drivers/net/cxgbe/cxgbe_main.c +++ b/drivers/net/cxgbe/cxgbe_main.c @@ -1348,7 +1348,7 @@ int cxgbe_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 0ac2d98eb..d3345508f 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..b3c4ec2eb 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,8 @@ 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 +1231,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..4b0027929 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 7f174f7fb..6699b768c 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -222,10 +222,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) == @@ -233,10 +233,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 1afeaa919..d668f3e5d 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 @@ -2186,11 +2186,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..67acb7317 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -92,7 +92,8 @@ * 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 +156,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 cd70f2802..dc886613a 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -284,12 +284,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; } @@ -576,7 +576,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); @@ -821,7 +821,8 @@ 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) @@ -1037,7 +1038,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; } @@ -1697,7 +1698,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"); @@ -1747,7 +1748,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)); @@ -1773,10 +1774,11 @@ 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 @@ -1789,7 +1791,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..1da56b229 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); + rxm->data_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 03047afa7..bd1c64c03 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; } @@ -1028,13 +1028,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; } @@ -1322,7 +1322,8 @@ 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 */ @@ -1689,7 +1690,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; @@ -1708,7 +1709,8 @@ 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); @@ -1772,10 +1774,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); @@ -1788,10 +1790,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); @@ -1825,10 +1827,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); @@ -2288,7 +2290,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; } @@ -3081,7 +3083,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"); @@ -3137,7 +3139,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)); @@ -4485,8 +4487,8 @@ 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) || - (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 @@ -4498,7 +4500,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; @@ -4744,8 +4746,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; @@ -5156,7 +5158,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..9d74c08ab 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,11 @@ 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..01f5e735b 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); + rxm->data_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 ff2bda592..fd71155ee 100644 --- a/drivers/net/enetc/base/enetc_hw.h +++ b/drivers/net/enetc/base/enetc_hw.h @@ -215,8 +215,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 e637c8628..6c5501acb 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -417,7 +417,7 @@ enetc_rx_queue_setup(struct rte_eth_dev *dev, } rx_ring->crc_len = (uint8_t)((rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC) ? - ETHER_CRC_LEN : 0); + RTE_ETHER_CRC_LEN : 0); return 0; fail: @@ -595,7 +595,7 @@ enetc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) struct enetc_eth_hw *hw = ENETC_DEV_PRIVATE_TO_HW(dev->data->dev_private); struct enetc_hw *enetc_hw = &hw->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; /* check that mtu is within the allowed range */ if (mtu < ENETC_MAC_MINFRM_SIZE || frame_size > ENETC_MAC_MAXFRM_SIZE) @@ -612,7 +612,7 @@ enetc_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 @@ -654,7 +654,8 @@ enetc_dev_configure(struct rte_eth_dev *dev) ENETC_MAC_MAXFRM_SIZE); enetc_port_wr(enetc_hw, ENETC_PTXMBAR, 2 * ENETC_MAC_MAXFRM_SIZE); - dev->data->mtu = ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN; + dev->data->mtu = RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN - + RTE_ETHER_CRC_LEN; } if (rx_offloads & DEV_RX_OFFLOAD_KEEP_CRC) { @@ -830,11 +831,12 @@ 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; } @@ -845,8 +847,9 @@ enetc_dev_init(struct rte_eth_dev *eth_dev) /* Set MTU */ enetc_port_wr(&hw->hw, ENETC_PM0_MAXFRM, - ENETC_SET_MAXFRM(ETHER_MAX_LEN)); - eth_dev->data->mtu = ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN; + ENETC_SET_MAXFRM(RTE_ETHER_MAX_LEN)); + eth_dev->data->mtu = RTE_ETHER_MAX_LEN - RTE_ETHER_HDR_LEN - + RTE_ETHER_CRC_LEN; ENETC_PMD_DEBUG("port_id %d vendorID=0x%x deviceID=0x%x", eth_dev->data->port_id, pci_dev->id.vendor_id, 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 3b55ebad4..80fbf595e 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; @@ -671,7 +671,7 @@ static int enicpmd_set_mc_addr_list(struct rte_eth_dev *eth_dev, 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_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 9bddfb941..bdac1f755 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -593,7 +593,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 @@ -609,7 +609,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 @@ -625,7 +625,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 @@ -679,14 +679,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..21cfbb8c5 100644 --- a/drivers/net/enic/enic_res.c +++ b/drivers/net/enic/enic_res.c @@ -61,9 +61,10 @@ 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..4746fad36 100644 --- a/drivers/net/failsafe/failsafe_ether.c +++ b/drivers/net/failsafe/failsafe_ether.c @@ -172,9 +172,10 @@ 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 b16d5c02a..0815eb6fc 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1478,7 +1478,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 " @@ -1509,9 +1509,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); @@ -2834,7 +2834,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); @@ -2934,7 +2934,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), @@ -2954,10 +2954,11 @@ 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 @@ -3011,7 +3012,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 @@ -3510,7 +3511,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 | @@ -3776,9 +3777,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); @@ -4036,7 +4037,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 @@ -4141,11 +4142,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); @@ -4156,7 +4157,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."); @@ -5824,7 +5825,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); @@ -7110,7 +7111,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 */ @@ -7161,7 +7162,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 */ @@ -8622,7 +8623,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; } @@ -9902,7 +9903,8 @@ 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; @@ -9994,14 +9996,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."); @@ -12010,7 +12012,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 */ @@ -12020,7 +12022,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 ffaa7b949..6f2949e88 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -268,7 +268,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 f7f193c1f..63dbe14c3 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1505,12 +1505,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, - 0); + 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, @@ -1767,21 +1767,22 @@ 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; } } @@ -2218,7 +2219,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; @@ -2680,7 +2681,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 */ @@ -2690,7 +2691,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 6feaaa818..f7d77f3b6 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2035,9 +2035,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, @@ -2507,9 +2507,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, @@ -2552,9 +2552,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, @@ -3338,12 +3338,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; } } @@ -3568,12 +3568,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 b7636c7fa..b28d02ec2 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 1489552da..c0ded1d26 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 3d66b635c..0fbf79ca3 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 1227259f5..bbd4d75d0 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -57,7 +57,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) #define IAVF_32_BIT_WIDTH (CHAR_BIT * 4) #define IAVF_48_BIT_WIDTH (CHAR_BIT * 6) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index f545bd907..53dc05c78 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -225,23 +225,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; } } @@ -917,7 +917,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 */ @@ -926,7 +926,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 @@ -1305,13 +1305,11 @@ 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, - 0); + "iavf_mac", 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..3b83605e8 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 61624d76f..5f89310f1 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -651,7 +651,7 @@ ice_add_vlan_filter(struct ice_vsi *vsi, uint16_t vlan_id) struct ice_hw *hw; int ret = 0; - if (!vsi || vlan_id > ETHER_MAX_VLAN_ID) + if (!vsi || vlan_id > RTE_ETHER_MAX_VLAN_ID) return -EINVAL; hw = ICE_VSI_TO_HW(vsi); @@ -722,7 +722,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; hw = ICE_VSI_TO_HW(vsi); @@ -1224,12 +1224,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"); @@ -2233,7 +2233,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) uint32_t frame_size = mtu + ICE_ETH_OVERHEAD; /* 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 */ @@ -2244,7 +2244,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 @@ -3101,7 +3101,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); @@ -3174,10 +3174,11 @@ 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 */ @@ -3202,7 +3203,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_ethdev.h b/drivers/net/ice/ice_ethdev.h index 4baaf9498..1385afac3 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -122,7 +122,7 @@ * Considering QinQ packet, the VLAN tag needs to be counted twice. */ #define ICE_ETH_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2) struct ice_adapter; diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index ace766b1d..40e5db767 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; @@ -1412,17 +1412,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/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h index 566bc7607..af2da05c5 100644 --- a/drivers/net/ipn3ke/ipn3ke_ethdev.h +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h @@ -642,7 +642,7 @@ ipn3ke_tm_ops_get(struct rte_eth_dev *ethdev, * Considering QinQ packet, the VLAN tag needs to be counted twice. */ #define IPN3KE_ETH_OVERHEAD \ - (ETHER_HDR_LEN + ETHER_CRC_LEN + IPN3KE_VLAN_TAG_SIZE * 2) + (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + IPN3KE_VLAN_TAG_SIZE * 2) #define IPN3KE_MAC_FRAME_SIZE_MAX 9728 #define IPN3KE_MAC_RX_FRAME_MAXLENGTH 0x00AE diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c index e5937df9b..300d8f97a 100644 --- a/drivers/net/ipn3ke/ipn3ke_flow.c +++ b/drivers/net/ipn3ke/ipn3ke_flow.c @@ -96,7 +96,7 @@ ipn3ke_pattern_vxlan(const struct rte_flow_item patterns[], rte_memcpy(&parser->key[0], eth->src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); break; case RTE_FLOW_ITEM_TYPE_VXLAN: @@ -160,7 +160,7 @@ ipn3ke_pattern_mac(const struct rte_flow_item patterns[], rte_memcpy(parser->key, eth->src.addr_bytes, - ETHER_ADDR_LEN); + RTE_ETHER_ADDR_LEN); break; default: diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index b18d183f0..f4529f63f 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -128,7 +128,7 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev) &rpst->mac_addr); rte_ether_addr_copy(&rpst->mac_addr, &dev->data->mac_addrs[0]); - dev->data->mac_addrs->addr_bytes[ETHER_ADDR_LEN - 1] = + dev->data->mac_addrs->addr_bytes[RTE_ETHER_ADDR_LEN - 1] = (uint8_t)rpst->port_id + 1; if (hw->retimer.mac_type == IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI) { @@ -692,7 +692,7 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu) uint32_t frame_size = mtu + IPN3KE_ETH_OVERHEAD; /* check if mtu is within the allowed range */ - if (mtu < ETHER_MIN_MTU || + if (mtu < RTE_ETHER_MIN_MTU || frame_size > IPN3KE_MAC_FRAME_SIZE_MAX) return -EINVAL; @@ -712,7 +712,7 @@ ipn3ke_rpst_mtu_set(struct rte_eth_dev *ethdev, uint16_t mtu) return -EBUSY; } - if (frame_size > ETHER_MAX_LEN) + if (frame_size > RTE_ETHER_MAX_LEN) dev_data->dev_conf.rxmode.offloads |= (uint64_t)(DEV_RX_OFFLOAD_JUMBO_FRAME); else @@ -837,7 +837,7 @@ ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params) rpst->i40e_pf_eth = NULL; rpst->i40e_pf_eth_port_id = 0xFFFF; - ethdev->data->mac_addrs = rte_zmalloc("ipn3ke", ETHER_ADDR_LEN, 0); + ethdev->data->mac_addrs = rte_zmalloc("ipn3ke", RTE_ETHER_ADDR_LEN, 0); if (!ethdev->data->mac_addrs) { IPN3KE_AFU_PMD_ERR("Failed to " "allocated memory for storing mac address"); @@ -860,7 +860,7 @@ ipn3ke_rpst_init(struct rte_eth_dev *ethdev, void *init_params) ethdev->data->nb_tx_queues = 1; ethdev->data->mac_addrs = rte_zmalloc("ipn3ke_afu_representor", - ETHER_ADDR_LEN, + RTE_ETHER_ADDR_LEN, 0); if (!ethdev->data->mac_addrs) { IPN3KE_AFU_PMD_ERR("Failed to " diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 2f97f0f8d..581056d19 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1213,13 +1213,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 */ @@ -1227,12 +1227,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 * - IXGBE_VMDQ_NUM_UC_MAC, 0); + 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; } @@ -1499,7 +1499,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; } @@ -1540,7 +1540,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); @@ -1647,13 +1647,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; } @@ -3052,7 +3052,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] += @@ -3097,12 +3097,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 @@ -3132,7 +3132,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); @@ -3754,7 +3754,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) | @@ -4555,7 +4555,8 @@ 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"); @@ -4776,7 +4777,8 @@ 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"); @@ -4957,7 +4959,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 @@ -4974,7 +4976,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; @@ -6363,7 +6365,8 @@ 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 @@ -6660,8 +6663,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; @@ -7069,7 +7072,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 a2ae703df..c88d56e24 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 @@ -547,7 +547,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 && @@ -556,7 +556,8 @@ 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 1fbc754ae..ebe197852 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,8 @@ 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 +4949,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 db2191862..077afab0e 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -38,7 +38,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); } @@ -155,7 +155,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); @@ -477,7 +477,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 1cb1f067f..42a45333d 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 21ded9ef3..c25dab00c 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)); @@ -2090,7 +2090,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 460c10f89..640e06f74 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -945,7 +945,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 4e9bb9c1a..d4e56e879 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -199,7 +199,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 6639037f0..3d18aa4fc 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 244f19311..96479b83d 100644 --- a/drivers/net/mlx4/mlx4_flow.c +++ b/drivers/net/mlx4/mlx4_flow.c @@ -224,7 +224,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; @@ -252,12 +252,12 @@ 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; error: return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c index 391271a61..a941a8a2f 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 2798e0e95..57a62215a 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1282,7 +1282,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 80df971e5..6738a5067 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -440,7 +440,7 @@ void 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 e8560fd42..6a706fdfe 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1247,7 +1247,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]; @@ -1258,9 +1258,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; @@ -1276,9 +1276,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); @@ -3094,7 +3094,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 48d54e8de..7b9a15e7e 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 permanent 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 c44e15dfb..55aa8054f 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -290,14 +290,18 @@ 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 50cd32a09..5773fa75c 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 69681e296..d5ce74d8c 100644 --- a/drivers/net/mlx5/mlx5_trigger.c +++ b/drivers/net/mlx5/mlx5_trigger.c @@ -337,7 +337,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..d892d6c67 100644 --- a/drivers/net/mvneta/mvneta_ethdev.h +++ b/drivers/net/mvneta/mvneta_ethdev.h @@ -45,9 +45,9 @@ /** Rx queue descriptors alignment in B */ #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 + \ - MRVL_NETA_VLAN_TAG_LEN) +#define MRVL_NETA_VLAN_TAG_LEN 4 +#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) #define MRVL_NETA_MTU_TO_MRU(mtu) ((mtu) + MRVL_NETA_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..db6632f5b 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.h +++ b/drivers/net/mvpp2/mrvl_ethdev.h @@ -72,9 +72,9 @@ /** Minimum number of sent buffers to release from shadow queue to BM */ #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 + \ - (2 * MRVL_PP2_VLAN_TAG_LEN)) +#define MRVL_PP2_VLAN_TAG_LEN 4 +#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) #define MRVL_PP2_MRU_TO_MTU(mru) ((mru) - MRVL_PP2_HDRS_LEN) diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index 35503df32..9e7cf2df5 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -766,7 +766,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 61924209c..7212780c1 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/nfb/nfb_ethdev.c b/drivers/net/nfb/nfb_ethdev.c index ffdc2bf46..fdd0e701b 100644 --- a/drivers/net/nfb/nfb_ethdev.c +++ b/drivers/net/nfb/nfb_ethdev.c @@ -363,7 +363,7 @@ nfb_eth_mac_addr_set(struct rte_eth_dev *dev, if (!rte_is_valid_assigned_ether_addr(mac_addr)) return -EINVAL; - for (i = 0; i < ETHER_ADDR_LEN; i++) { + for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) { mac <<= 8; mac |= mac_addr->addr_bytes[i] & 0xFF; } diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index 853b7800b..1a7aa17ee 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,8 @@ 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 61a6eba6d..bc288bed6 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..1b853399d 100644 --- a/drivers/net/octeontx/octeontx_ethdev.c +++ b/drivers/net/octeontx/octeontx_ethdev.c @@ -142,7 +142,8 @@ 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 +1065,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 +1086,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 <rte_string_fns.h> #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..51edc4151 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -332,7 +332,9 @@ 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 ETHER_TYPE_VLAN RTE_ETHER_TYPE_VLAN +#define ETHER_TYPE_QINQ RTE_ETHER_TYPE_QINQ #define OSAL_BITMAP_WEIGHT(bitmap, count) 0 diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index c7fadf27f..84d898421 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; @@ -1216,7 +1216,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; @@ -2232,9 +2232,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; } @@ -2274,7 +2274,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; @@ -2408,7 +2408,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 */ @@ -2538,7 +2538,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); @@ -2596,7 +2596,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 792b9efb4..c2f39ceb9 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,8 @@ 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 +1284,8 @@ 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 dd9897d70..661432e11 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -93,7 +93,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) sfc_log_init(sa, "entry"); - dev_info->min_mtu = ETHER_MIN_MTU; + dev_info->min_mtu = RTE_ETHER_MIN_MTU; dev_info->max_mtu = EFX_MAC_SDU_MAX; dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX; @@ -941,7 +941,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; } @@ -2095,7 +2095,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 e1d981b4e..e4a9ba0ff 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -951,7 +951,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 949b72d0c..4a42bbeb1 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; @@ -1185,11 +1185,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); @@ -1782,7 +1782,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; } @@ -1837,7 +1837,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.", @@ -1996,8 +1996,10 @@ set_mac_type(const char *key __rte_unused, static int iface_idx; /* fixed mac = 00:64:74:61:70:<iface_idx> */ - 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..9d90361d9 100644 --- a/drivers/net/tap/tap_flow.c +++ b/drivers/net/tap/tap_flow.c @@ -538,17 +538,19 @@ 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, - &spec->src.addr_bytes); + 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 3f0519593..dd054627e 100644 --- a/drivers/net/thunderx/base/nicvf_plat.h +++ b/drivers/net/thunderx/base/nicvf_plat.h @@ -44,10 +44,10 @@ /* Constants */ #include <rte_ether.h> -#define NICVF_MAC_ADDR_SIZE ETHER_ADDR_LEN +#define NICVF_MAC_ADDR_SIZE RTE_ETHER_ADDR_LEN /* Ethernet */ -#define ether_addr_copy(x, y) memcpy(y, x, ETHER_ADDR_LEN) +#define ether_addr_copy(x, y) memcpy(y, x, RTE_ETHER_ADDR_LEN) #include <rte_io.h> #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..eb2c11da5 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,8 @@ 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 2762dcf97..c4570bbf8 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,11 @@ 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 +1168,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 +1187,11 @@ 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 +1201,8 @@ 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 +1213,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 +1302,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 +1715,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 +1726,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 +1741,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 +1840,12 @@ 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; } @@ -1990,7 +1996,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 3de467768..3805e217a 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 f718b8b65..79ec42e37 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -307,12 +307,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 319d73926..8c2b6f877 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -71,7 +71,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 2675a16f0..9acf666dc 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 f053e5bd8..2e81a9e7e 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,14 +304,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) { + 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; @@ -374,12 +374,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); @@ -404,7 +404,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); @@ -479,20 +479,20 @@ 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 8d82a6411..d071dae9c 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -52,15 +52,16 @@ * 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. @@ -357,9 +358,11 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, 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; @@ -572,8 +575,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); } @@ -677,9 +680,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 fe92fcdd2..7ce52150d 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; @@ -401,7 +401,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 */ @@ -694,8 +694,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 9a2c6e3ba..d47cdd55c 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; @@ -330,12 +330,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); + 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; @@ -343,13 +343,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, @@ -1427,8 +1427,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 938375230..adab3217a 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -280,7 +280,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; @@ -539,8 +539,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 a6d6fc2d2..a4d598bb7 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 4b15853e3..f38b3ae6f 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 7f7be22c6..8a991f5f7 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; @@ -1536,7 +1536,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)) { @@ -1581,8 +1581,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 b373047f6..eaa47aaa3 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -386,9 +386,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 3f4625abd..570693b32 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -120,7 +120,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, }, @@ -570,7 +570,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) { @@ -649,8 +649,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); } @@ -827,7 +827,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 8e28c16e1..46275e79a 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, }, @@ -2977,7 +2977,9 @@ 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)) { @@ -3024,9 +3026,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); } @@ -3490,7 +3492,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 431e84f4e..ce1f63dc7 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 6545b8ae4..cc171fbbc 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,7 +38,7 @@ 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); @@ -46,13 +46,13 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, } 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); @@ -85,7 +85,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, 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); @@ -94,14 +94,14 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, 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; @@ -212,7 +212,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); @@ -234,7 +234,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 3316df13a..2237c7559 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; @@ -373,7 +373,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 f4f0fc862..d7b34b3d4 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. */ @@ -858,7 +858,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); } @@ -949,7 +949,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 1194f62f8..aab19ba57 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 f8cab1162..bc15cb64e 100644 --- a/examples/vm_power_manager/main.c +++ b/examples/vm_power_manager/main.c @@ -54,7 +54,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 1af36dead..72bb33881 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -500,7 +500,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); @@ -1224,20 +1224,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 int)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 */ @@ -2552,7 +2552,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); @@ -3088,7 +3088,8 @@ 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; @@ -3222,7 +3223,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 bcc1bb71d..bd20745dd 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -2336,7 +2336,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 050af52f8..e87a70613 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -604,8 +604,8 @@ 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 - * pattern item. + * RTE_ETHER_TYPE_VLAN or RTE_ETHER_TYPE_QINQ. It can be overridden by + * the preceding pattern item. */ struct rte_flow_item_vlan { rte_be16_t tci; /**< Tag control information. */ @@ -768,7 +768,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 { /** @@ -2128,7 +2128,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 b6ff57b42..e01d61b24 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -622,21 +622,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 7a41788e2..e6507b07d 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 c93d3a985..45073af10 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 */ - uint8_t mac_addr[ETHER_ADDR_LEN]; /* MAC address assigned to KNI */ + uint8_t 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 0b204a573..35a743c13 100644 --- a/lib/librte_net/rte_arp.c +++ b/lib/librte_net/rte_arp.c @@ -30,15 +30,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..60a7dbe3a 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -23,25 +23,28 @@ extern "C" { #include <rte_mbuf.h> #include <rte_byteorder.h> -#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 +58,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 +82,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 +101,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 +119,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 +134,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 +167,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 +182,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 +212,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 +243,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,24 +298,26 @@ 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)) -/**< VXLAN tunnel header length. */ +#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. */ /** * VXLAN-GPE protocol header (draft-ietf-nvo3-vxlan-gpe-05). @@ -327,15 +332,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 +361,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 +370,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 +409,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 a474148c7..ea966cb94 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, @@ -780,13 +780,13 @@ encap_vxlan_apply(void *data, &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; @@ -821,7 +821,7 @@ encap_vxlan_apply(void *data, &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; @@ -858,13 +858,13 @@ encap_vxlan_apply(void *data, &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) | @@ -899,7 +899,7 @@ encap_vxlan_apply(void *data, &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 f97ec76f9..2394178f0 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); @@ -988,14 +988,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 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 05/15] net: add rte prefix to ether defines 2019-05-21 16:13 ` [dpdk-dev] [PATCH 05/15] net: add rte prefix to ether defines Olivier Matz @ 2019-05-24 11:37 ` Ferruh Yigit 0 siblings, 0 replies; 107+ messages in thread From: Ferruh Yigit @ 2019-05-24 11:37 UTC (permalink / raw) To: Olivier Matz, dev; +Cc: stephen On 5/21/2019 5:13 PM, Olivier Matz wrote: > 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. net/ice has RTE_ETHER_MTU in next-net, I am fixing it. > - 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 <olivier.matz@6wind.com> <...> ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 06/15] net: add rte prefix to esp structure 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (4 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 05/15] net: add rte prefix to ether defines Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 07/15] net: add rte prefix to gre structure Olivier Matz ` (11 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to structures: - rename struct esp_hdr as struct rte_esp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test/test_ipsec.c | 4 ++-- examples/ipsec-secgw/esp.c | 47 +++++++++++++++++++++++--------------------- examples/ipsec-secgw/sa.c | 6 +++--- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_ipsec/crypto.h | 2 +- lib/librte_ipsec/esp_inb.c | 10 +++++----- lib/librte_ipsec/esp_outb.c | 8 ++++---- lib/librte_ipsec/sa.c | 10 ++++++---- lib/librte_net/rte_esp.h | 2 +- 9 files changed, 48 insertions(+), 43 deletions(-) diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 64e56c056..4342b730b 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -569,12 +569,12 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, size_t len, uint32_t spi, uint32_t seq) { struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct esp_hdr); + uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct rte_esp_hdr); uint32_t taillen = sizeof(struct esp_tail); uint32_t t_len = len + hdrlen + taillen; uint32_t padlen; - struct esp_hdr esph = { + struct rte_esp_hdr esph = { .spi = rte_cpu_to_be_32(spi), .seq = rte_cpu_to_be_32(seq) }; diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c index faa84ddd1..f11d095ba 100644 --- a/examples/ipsec-secgw/esp.c +++ b/examples/ipsec-secgw/esp.c @@ -49,7 +49,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, } payload_len = rte_pktmbuf_pkt_len(m) - ip_hdr_len - - sizeof(struct esp_hdr) - sa->iv_len - sa->digest_len; + sizeof(struct rte_esp_hdr) - sa->iv_len - sa->digest_len; if ((payload_len & (sa->block_size - 1)) || (payload_len <= 0)) { RTE_LOG_DP(DEBUG, IPSEC_ESP, "payload %d not multiple of %u\n", @@ -61,13 +61,14 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->m_src = m; if (sa->aead_algo == RTE_CRYPTO_AEAD_AES_GCM) { - sym_cop->aead.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + - sa->iv_len; + sym_cop->aead.data.offset = + ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->aead.data.length = payload_len; struct cnt_blk *icb; uint8_t *aad; - uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct esp_hdr)); + uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + + sizeof(struct rte_esp_hdr)); icb = get_cnt_blk(m); icb->salt = sa->salt; @@ -75,7 +76,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, icb->cnt = rte_cpu_to_be_32(1); aad = get_aad(m); - memcpy(aad, iv - sizeof(struct esp_hdr), 8); + memcpy(aad, iv - sizeof(struct rte_esp_hdr), 8); sym_cop->aead.aad.data = aad; sym_cop->aead.aad.phys_addr = rte_pktmbuf_iova_offset(m, aad - rte_pktmbuf_mtod(m, uint8_t *)); @@ -85,12 +86,14 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->aead.digest.phys_addr = rte_pktmbuf_iova_offset(m, rte_pktmbuf_pkt_len(m) - sa->digest_len); } else { - sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct esp_hdr) + + sym_cop->cipher.data.offset = ip_hdr_len + + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = payload_len; struct cnt_blk *icb; - uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + sizeof(struct esp_hdr)); + uint8_t *iv = RTE_PTR_ADD(ip4, ip_hdr_len + + sizeof(struct rte_esp_hdr)); uint8_t *iv_ptr = rte_crypto_op_ctod_offset(cop, uint8_t *, IV_OFFSET); @@ -118,7 +121,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_AUTH_SHA1_HMAC: case RTE_CRYPTO_AUTH_SHA256_HMAC: sym_cop->auth.data.offset = ip_hdr_len; - sym_cop->auth.data.length = sizeof(struct esp_hdr) + + sym_cop->auth.data.length = sizeof(struct rte_esp_hdr) + sa->iv_len + payload_len; break; default: @@ -192,7 +195,7 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, if (unlikely(sa->flags == TRANSPORT)) { ip = rte_pktmbuf_mtod(m, struct ip *); ip4 = (struct ip *)rte_pktmbuf_adj(m, - sizeof(struct esp_hdr) + sa->iv_len); + sizeof(struct rte_esp_hdr) + sa->iv_len); if (likely(ip->ip_v == IPVERSION)) { memmove(ip4, ip, ip->ip_hl * 4); ip4->ip_p = *nexthdr; @@ -206,7 +209,7 @@ esp_inbound_post(struct rte_mbuf *m, struct ipsec_sa *sa, sizeof(struct ip6_hdr)); } } else - ipip_inbound(m, sizeof(struct esp_hdr) + sa->iv_len); + ipip_inbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len); return 0; } @@ -217,7 +220,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, { struct ip *ip4; struct ip6_hdr *ip6; - struct esp_hdr *esp = NULL; + struct rte_esp_hdr *esp = NULL; uint8_t *padding = NULL, *new_ip, nlp; struct rte_crypto_sym_op *sym_cop; int32_t i; @@ -268,7 +271,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, } /* Check maximum packet size */ - if (unlikely(ip_hdr_len + sizeof(struct esp_hdr) + sa->iv_len + + if (unlikely(ip_hdr_len + sizeof(struct rte_esp_hdr) + sa->iv_len + pad_payload_len + sa->digest_len > IP_MAXPACKET)) { RTE_LOG(ERR, IPSEC_ESP, "ipsec packet is too big\n"); return -EINVAL; @@ -290,20 +293,20 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, switch (sa->flags) { case IP4_TUNNEL: - ip4 = ip4ip_outbound(m, sizeof(struct esp_hdr) + sa->iv_len, + ip4 = ip4ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, &sa->src, &sa->dst); - esp = (struct esp_hdr *)(ip4 + 1); + esp = (struct rte_esp_hdr *)(ip4 + 1); break; case IP6_TUNNEL: - ip6 = ip6ip_outbound(m, sizeof(struct esp_hdr) + sa->iv_len, + ip6 = ip6ip_outbound(m, sizeof(struct rte_esp_hdr) + sa->iv_len, &sa->src, &sa->dst); - esp = (struct esp_hdr *)(ip6 + 1); + esp = (struct rte_esp_hdr *)(ip6 + 1); break; case TRANSPORT: new_ip = (uint8_t *)rte_pktmbuf_prepend(m, - sizeof(struct esp_hdr) + sa->iv_len); + sizeof(struct rte_esp_hdr) + sa->iv_len); memmove(new_ip, ip4, ip_hdr_len); - esp = (struct esp_hdr *)(new_ip + ip_hdr_len); + esp = (struct rte_esp_hdr *)(new_ip + ip_hdr_len); ip4 = (struct ip *)new_ip; if (likely(ip4->ip_v == IPVERSION)) { ip4->ip_p = IPPROTO_ESP; @@ -362,7 +365,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, uint8_t *aad; sym_cop->aead.data.offset = ip_hdr_len + - sizeof(struct esp_hdr) + sa->iv_len; + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->aead.data.length = pad_payload_len; /* Fill pad_len using default sequential scheme */ @@ -392,12 +395,12 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_CIPHER_3DES_CBC: case RTE_CRYPTO_CIPHER_AES_CBC: sym_cop->cipher.data.offset = ip_hdr_len + - sizeof(struct esp_hdr); + sizeof(struct rte_esp_hdr); sym_cop->cipher.data.length = pad_payload_len + sa->iv_len; break; case RTE_CRYPTO_CIPHER_AES_CTR: sym_cop->cipher.data.offset = ip_hdr_len + - sizeof(struct esp_hdr) + sa->iv_len; + sizeof(struct rte_esp_hdr) + sa->iv_len; sym_cop->cipher.data.length = pad_payload_len; break; default: @@ -422,7 +425,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, case RTE_CRYPTO_AUTH_SHA1_HMAC: case RTE_CRYPTO_AUTH_SHA256_HMAC: sym_cop->auth.data.offset = ip_hdr_len; - sym_cop->auth.data.length = sizeof(struct esp_hdr) + + sym_cop->auth.data.length = sizeof(struct rte_esp_hdr) + sa->iv_len + pad_payload_len; break; default: diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index b850e9839..c65dbe974 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -1219,7 +1219,7 @@ static inline void single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, struct ipsec_sa **sa_ret) { - struct esp_hdr *esp; + struct rte_esp_hdr *esp; struct ip *ip; uint32_t *src4_addr; uint8_t *src6_addr; @@ -1229,9 +1229,9 @@ single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt, ip = rte_pktmbuf_mtod(pkt, struct ip *); if (ip->ip_v == IPVERSION) - esp = (struct esp_hdr *)(ip + 1); + esp = (struct rte_esp_hdr *)(ip + 1); else - esp = (struct esp_hdr *)(((struct ip6_hdr *)ip) + 1); + esp = (struct rte_esp_hdr *)(((struct ip6_hdr *)ip) + 1); if (esp->spi == INVALID_SPI) return; diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index e87a70613..c8fa2720c 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -915,7 +915,7 @@ static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = { * Matches an ESP header. */ struct rte_flow_item_esp { - struct esp_hdr hdr; /**< ESP header definition. */ + struct rte_esp_hdr hdr; /**< ESP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ESP. */ diff --git a/lib/librte_ipsec/crypto.h b/lib/librte_ipsec/crypto.h index 45d4ef7bf..f8fbf8d4f 100644 --- a/lib/librte_ipsec/crypto.h +++ b/lib/librte_ipsec/crypto.h @@ -47,7 +47,7 @@ struct aead_gcm_aad { } __attribute__((packed)); struct gcm_esph_iv { - struct esp_hdr esph; + struct rte_esp_hdr esph; uint64_t iv; } __attribute__((packed)); diff --git a/lib/librte_ipsec/esp_inb.c b/lib/librte_ipsec/esp_inb.c index 4e0e12a85..3e12ca103 100644 --- a/lib/librte_ipsec/esp_inb.c +++ b/lib/librte_ipsec/esp_inb.c @@ -68,7 +68,7 @@ inb_cop_prepare(struct rte_crypto_op *cop, algo = sa->algo_type; ivp = rte_pktmbuf_mtod_offset(mb, uint64_t *, - pofs + sizeof(struct esp_hdr)); + pofs + sizeof(struct rte_esp_hdr)); /* fill sym op fields */ sop = cop->sym; @@ -139,9 +139,9 @@ inb_pkt_prepare(const struct rte_ipsec_sa *sa, const struct replay_sqn *rsn, uint64_t sqn; uint32_t clen, icv_ofs, plen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; - esph = rte_pktmbuf_mtod_offset(mb, struct esp_hdr *, hlen); + esph = rte_pktmbuf_mtod_offset(mb, struct rte_esp_hdr *, hlen); /* * retrieve and reconstruct SQN, then check it, then @@ -295,10 +295,10 @@ static inline void * tun_process_step2(struct rte_mbuf *mb, struct rte_mbuf *ml, uint32_t hlen, uint32_t adj, uint32_t tlen, uint32_t *sqn) { - const struct esp_hdr *ph; + const struct rte_esp_hdr *ph; /* read SQN value */ - ph = rte_pktmbuf_mtod_offset(mb, const struct esp_hdr *, hlen); + ph = rte_pktmbuf_mtod_offset(mb, const struct rte_esp_hdr *, hlen); sqn[0] = ph->seq; /* cut of ICV, ESP tail and padding bytes */ diff --git a/lib/librte_ipsec/esp_outb.c b/lib/librte_ipsec/esp_outb.c index c798bc4c4..862a9982d 100644 --- a/lib/librte_ipsec/esp_outb.c +++ b/lib/librte_ipsec/esp_outb.c @@ -108,7 +108,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, { uint32_t clen, hlen, l2len, pdlen, pdofs, plen, tlen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; struct esp_tail *espt; char *ph, *pt; uint64_t *iv; @@ -156,7 +156,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, sqn_low16(sqc)); /* update spi, seqn and iv */ - esph = (struct esp_hdr *)(ph + sa->hdr_len); + esph = (struct rte_esp_hdr *)(ph + sa->hdr_len); iv = (uint64_t *)(esph + 1); copy_iv(iv, ivp, sa->iv_len); @@ -275,7 +275,7 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, uint8_t np; uint32_t clen, hlen, pdlen, pdofs, plen, tlen, uhlen; struct rte_mbuf *ml; - struct esp_hdr *esph; + struct rte_esp_hdr *esph; struct esp_tail *espt; char *ph, *pt; uint64_t *iv; @@ -318,7 +318,7 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, IPPROTO_ESP); /* update spi, seqn and iv */ - esph = (struct esp_hdr *)(ph + uhlen); + esph = (struct rte_esp_hdr *)(ph + uhlen); iv = (uint64_t *)(esph + 1); copy_iv(iv, ivp, sa->iv_len); diff --git a/lib/librte_ipsec/sa.c b/lib/librte_ipsec/sa.c index 846e317fe..1cb71caa1 100644 --- a/lib/librte_ipsec/sa.c +++ b/lib/librte_ipsec/sa.c @@ -233,7 +233,7 @@ esp_inb_init(struct rte_ipsec_sa *sa) /* these params may differ with new algorithms support */ sa->ctp.auth.offset = 0; sa->ctp.auth.length = sa->icv_len - sa->sqh_len; - sa->ctp.cipher.offset = sizeof(struct esp_hdr) + sa->iv_len; + sa->ctp.cipher.offset = sizeof(struct rte_esp_hdr) + sa->iv_len; sa->ctp.cipher.length = sa->icv_len + sa->ctp.cipher.offset; } @@ -259,7 +259,8 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) /* these params may differ with new algorithms support */ sa->ctp.auth.offset = hlen; - sa->ctp.auth.length = sizeof(struct esp_hdr) + sa->iv_len + sa->sqh_len; + sa->ctp.auth.length = sizeof(struct rte_esp_hdr) + + sa->iv_len + sa->sqh_len; algo_type = sa->algo_type; @@ -267,13 +268,14 @@ esp_outb_init(struct rte_ipsec_sa *sa, uint32_t hlen) case ALGO_TYPE_AES_GCM: case ALGO_TYPE_AES_CTR: case ALGO_TYPE_NULL: - sa->ctp.cipher.offset = hlen + sizeof(struct esp_hdr) + + sa->ctp.cipher.offset = hlen + sizeof(struct rte_esp_hdr) + sa->iv_len; sa->ctp.cipher.length = 0; break; case ALGO_TYPE_AES_CBC: case ALGO_TYPE_3DES_CBC: - sa->ctp.cipher.offset = sa->hdr_len + sizeof(struct esp_hdr); + sa->ctp.cipher.offset = sa->hdr_len + + sizeof(struct rte_esp_hdr); sa->ctp.cipher.length = sa->iv_len; break; } diff --git a/lib/librte_net/rte_esp.h b/lib/librte_net/rte_esp.h index 8e1b3d2dd..c569b7906 100644 --- a/lib/librte_net/rte_esp.h +++ b/lib/librte_net/rte_esp.h @@ -20,7 +20,7 @@ extern "C" { /** * ESP Header */ -struct esp_hdr { +struct rte_esp_hdr { rte_be32_t spi; /**< Security Parameters Index */ rte_be32_t seq; /**< packet sequence number */ } __attribute__((__packed__)); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 07/15] net: add rte prefix to gre structure 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (5 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 06/15] net: add rte prefix to esp structure Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 08/15] net: add rte prefix to icmp structure Olivier Matz ` (10 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to structures: - rename struct gre_hdr as struct rte_gre_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- drivers/net/mlx5/mlx5_flow_dv.c | 4 ++-- lib/librte_net/rte_gre.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 6a706fdfe..b7a56ebdc 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1218,7 +1218,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, struct udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; - struct gre_hdr *gre = NULL; + struct rte_gre_hdr *gre = NULL; size_t len; size_t temp_size = 0; @@ -1331,7 +1331,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, break; case RTE_FLOW_ITEM_TYPE_GRE: case RTE_FLOW_ITEM_TYPE_NVGRE: - gre = (struct gre_hdr *)&buf[temp_size]; + gre = (struct rte_gre_hdr *)&buf[temp_size]; if (!gre->proto) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/lib/librte_net/rte_gre.h b/lib/librte_net/rte_gre.h index 05aa9d143..b5279ede1 100644 --- a/lib/librte_net/rte_gre.h +++ b/lib/librte_net/rte_gre.h @@ -16,7 +16,7 @@ extern "C" { * GRE Header */ __extension__ -struct gre_hdr { +struct rte_gre_hdr { #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN uint16_t res2:4; /**< Reserved */ uint16_t s:1; /**< Sequence Number Present bit */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 5551cce17..d858ab155 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -140,8 +140,8 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, [0xa] = 12, [0xb] = 16, }; - const struct gre_hdr *gh; - struct gre_hdr gh_copy; + const struct rte_gre_hdr *gh; + struct rte_gre_hdr gh_copy; uint16_t flags; gh = rte_pktmbuf_read(m, *off, sizeof(*gh), &gh_copy); -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 08/15] net: add rte prefix to icmp structure 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (6 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 07/15] net: add rte prefix to gre structure Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 09/15] net: add rte prefix to icmp defines Olivier Matz ` (9 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to structures: - rename struct icmp_hdr as struct rte_icmp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_icmp.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index c6c7cb6bd..bff0b8d9c 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -279,7 +279,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; struct ipv4_hdr *ip_h; - struct icmp_hdr *icmp_h; + struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; uint32_t ip_addr; @@ -430,7 +430,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) /* * Check if packet is a ICMP echo request. */ - icmp_h = (struct icmp_hdr *) ((char *)ip_h + + icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + sizeof(struct ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index c8fa2720c..5f52359b1 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -673,7 +673,7 @@ static const struct rte_flow_item_ipv6 rte_flow_item_ipv6_mask = { * Matches an ICMP header. */ struct rte_flow_item_icmp { - struct icmp_hdr hdr; /**< ICMP header definition. */ + struct rte_icmp_hdr hdr; /**< ICMP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_ICMP. */ diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h index 053b5f6a4..d0309537e 100644 --- a/lib/librte_net/rte_icmp.h +++ b/lib/librte_net/rte_icmp.h @@ -23,7 +23,7 @@ extern "C" { /** * ICMP Header */ -struct icmp_hdr { +struct rte_icmp_hdr { uint8_t icmp_type; /* ICMP packet type. */ uint8_t icmp_code; /* ICMP packet code. */ uint16_t icmp_cksum; /* ICMP packet checksum. */ -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 09/15] net: add rte prefix to icmp defines 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (7 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 08/15] net: add rte prefix to icmp structure Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 10/15] net: add rte prefix to ip structure Olivier Matz ` (8 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'RTE_' prefix to defines: - rename IP_ICMP_ECHO_REPLY as RTE_IP_ICMP_ECHO_REPLY. - rename IP_ICMP_ECHO_REQUEST as RTE_IP_ICMP_ECHO_REQUEST. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/icmpecho.c | 10 +++++----- lib/librte_net/rte_icmp.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index bff0b8d9c..949cc558d 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -433,7 +433,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + sizeof(struct ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && - (icmp_h->icmp_type == IP_ICMP_ECHO_REQUEST) && + (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { rte_pktmbuf_free(pkt); continue; @@ -457,7 +457,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * - switch the request IP source and destination * addresses in the reply IP header, * - keep the IP header checksum unchanged. - * - set IP_ICMP_ECHO_REPLY in ICMP header. + * - set RTE_IP_ICMP_ECHO_REPLY in ICMP header. * ICMP checksum is computed by assuming it is valid in the * echo request and not verified. */ @@ -480,10 +480,10 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) ip_h->src_addr = ip_h->dst_addr; ip_h->dst_addr = ip_addr; } - icmp_h->icmp_type = IP_ICMP_ECHO_REPLY; + icmp_h->icmp_type = RTE_IP_ICMP_ECHO_REPLY; cksum = ~icmp_h->icmp_cksum & 0xffff; - cksum += ~htons(IP_ICMP_ECHO_REQUEST << 8) & 0xffff; - cksum += htons(IP_ICMP_ECHO_REPLY << 8); + cksum += ~htons(RTE_IP_ICMP_ECHO_REQUEST << 8) & 0xffff; + cksum += htons(RTE_IP_ICMP_ECHO_REPLY << 8); cksum = (cksum & 0xffff) + (cksum >> 16); cksum = (cksum & 0xffff) + (cksum >> 16); icmp_h->icmp_cksum = ~cksum; diff --git a/lib/librte_net/rte_icmp.h b/lib/librte_net/rte_icmp.h index d0309537e..3f8100a5f 100644 --- a/lib/librte_net/rte_icmp.h +++ b/lib/librte_net/rte_icmp.h @@ -32,8 +32,8 @@ struct rte_icmp_hdr { } __attribute__((__packed__)); /* ICMP packet types */ -#define IP_ICMP_ECHO_REPLY 0 -#define IP_ICMP_ECHO_REQUEST 8 +#define RTE_IP_ICMP_ECHO_REPLY 0 +#define RTE_IP_ICMP_ECHO_REQUEST 8 #ifdef __cplusplus } -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 10/15] net: add rte prefix to ip structure 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (8 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 09/15] net: add rte prefix to icmp defines Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 11/15] net: add rte prefix to ip defines Olivier Matz ` (7 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to structures: - rename struct ipv4_hdr as struct rte_ipv4_hdr. - rename struct ipv6_hdr as struct rte_ipv6_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pipeline/pipeline_acl.c | 10 +- app/test-pipeline/pipeline_hash.c | 8 +- app/test-pmd/csumonly.c | 42 +++---- app/test-pmd/flowgen.c | 6 +- app/test-pmd/icmpecho.c | 8 +- app/test-pmd/macfwd.c | 2 +- app/test-pmd/macswap_common.h | 2 +- app/test-pmd/txonly.c | 16 +-- app/test-pmd/util.c | 12 +- app/test/packet_burst_generator.c | 60 +++++----- app/test/packet_burst_generator.h | 6 +- app/test/test_flow_classify.c | 16 +-- app/test/test_ipsec.c | 5 +- app/test/test_link_bonding.c | 8 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_pmd_perf.c | 2 +- app/test/test_sched.c | 4 +- app/test/test_thash.c | 2 +- .../prog_guide/packet_classif_access_ctrl.rst | 12 +- doc/guides/sample_app_ug/flow_classify.rst | 10 +- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- doc/guides/sample_app_ug/l3_forward.rst | 12 +- doc/guides/sample_app_ug/server_node_efd.rst | 8 +- drivers/net/bonding/rte_eth_bond_pmd.c | 16 +-- drivers/net/dpaa/dpaa_rxtx.c | 8 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/ena/ena_ethdev.c | 4 +- drivers/net/enic/enic_clsf.c | 16 +-- drivers/net/enic/enic_flow.c | 30 ++--- drivers/net/i40e/i40e_fdir.c | 36 +++--- drivers/net/mlx5/mlx5_flow.c | 6 +- drivers/net/mlx5/mlx5_flow_dv.c | 8 +- drivers/net/mlx5/mlx5_flow_tcf.c | 12 +- drivers/net/mvpp2/mrvl_flow.c | 2 +- drivers/net/qede/qede_filter.c | 14 +-- drivers/net/qede/qede_rxtx.c | 14 ++- drivers/net/sfc/sfc_tso.h | 4 +- drivers/net/softnic/rte_eth_softnic_pipeline.c | 32 +++--- drivers/net/tap/rte_eth_tap.c | 10 +- drivers/net/virtio/virtio_rxtx.c | 9 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 18 +-- examples/bond/main.c | 4 +- examples/flow_classify/flow_classify.c | 10 +- examples/ip_fragmentation/main.c | 12 +- examples/ip_pipeline/pipeline.c | 32 +++--- examples/ip_reassembly/main.c | 12 +- examples/ipsec-secgw/ipsec-secgw.c | 2 +- examples/ipsec-secgw/sa.c | 6 +- examples/ipv4_multicast/main.c | 4 +- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 84 +++++++------- examples/l3fwd-power/main.c | 28 ++--- examples/l3fwd-vf/main.c | 18 +-- examples/l3fwd/l3fwd.h | 6 +- examples/l3fwd/l3fwd_altivec.h | 22 ++-- examples/l3fwd/l3fwd_common.h | 4 +- examples/l3fwd/l3fwd_em.c | 16 +-- examples/l3fwd/l3fwd_em.h | 8 +- examples/l3fwd/l3fwd_em_hlm.h | 8 +- examples/l3fwd/l3fwd_em_hlm_neon.h | 16 +-- examples/l3fwd/l3fwd_em_hlm_sse.h | 8 +- examples/l3fwd/l3fwd_em_sequential.h | 8 +- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/l3fwd/l3fwd_lpm.h | 8 +- examples/l3fwd/l3fwd_lpm_altivec.h | 10 +- examples/l3fwd/l3fwd_lpm_neon.h | 10 +- examples/l3fwd/l3fwd_lpm_sse.h | 10 +- examples/l3fwd/l3fwd_neon.h | 22 ++-- examples/l3fwd/l3fwd_sse.h | 22 ++-- examples/load_balancer/runtime.c | 4 +- examples/performance-thread/l3fwd-thread/main.c | 121 +++++++++++---------- examples/server_node_efd/node/node.c | 6 +- examples/server_node_efd/server/main.c | 6 +- examples/tep_termination/vxlan.c | 32 +++--- examples/tep_termination/vxlan.h | 2 +- examples/tep_termination/vxlan_setup.c | 4 +- examples/vhost/main.c | 2 +- lib/librte_ethdev/rte_flow.h | 4 +- lib/librte_eventdev/rte_event_eth_rx_adapter.c | 16 +-- lib/librte_gro/gro_tcp4.c | 8 +- lib/librte_gro/gro_tcp4.h | 4 +- lib/librte_gro/gro_vxlan_tcp4.c | 12 +- lib/librte_gso/gso_common.h | 4 +- lib/librte_gso/gso_tcp4.c | 8 +- lib/librte_gso/gso_tunnel_tcp4.c | 10 +- lib/librte_gso/gso_udp4.c | 10 +- lib/librte_gso/rte_gso.h | 4 +- lib/librte_hash/rte_thash.h | 3 +- lib/librte_ip_frag/rte_ip_frag.h | 9 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 26 ++--- lib/librte_ip_frag/rte_ipv4_reassembly.c | 6 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 28 ++--- lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- lib/librte_ipsec/iph.h | 8 +- lib/librte_net/rte_ip.h | 22 ++-- lib/librte_net/rte_net.c | 18 +-- lib/librte_net/rte_net.h | 14 +-- lib/librte_pipeline/rte_table_action.c | 60 +++++----- lib/librte_port/rte_port_ras.c | 6 +- lib/librte_vhost/virtio_net.c | 10 +- 100 files changed, 713 insertions(+), 668 deletions(-) diff --git a/app/test-pipeline/pipeline_acl.c b/app/test-pipeline/pipeline_acl.c index e53e5ecef..5857bc285 100644 --- a/app/test-pipeline/pipeline_acl.c +++ b/app/test-pipeline/pipeline_acl.c @@ -40,7 +40,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -48,7 +48,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, { .type = RTE_ACL_FIELD_TYPE_MASK, @@ -56,7 +56,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, @@ -64,7 +64,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr), + sizeof(struct rte_ipv4_hdr), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, @@ -72,7 +72,7 @@ struct rte_acl_field_def ipv4_field_formats[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_FIELD_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + sizeof(uint16_t), + sizeof(struct rte_ipv4_hdr) + sizeof(uint16_t), }, }; diff --git a/app/test-pipeline/pipeline_hash.c b/app/test-pipeline/pipeline_hash.c index 3e4a0a1bb..25fb2e0da 100644 --- a/app/test-pipeline/pipeline_hash.c +++ b/app/test-pipeline/pipeline_hash.c @@ -426,8 +426,8 @@ app_main_loop_rx_metadata(void) { for (j = 0; j < n_mbufs; j++) { struct rte_mbuf *m; uint8_t *m_data, *key; - struct ipv4_hdr *ip_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ip_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t ip_dst; uint8_t *ipv6_dst; uint32_t *signature, *k32; @@ -440,14 +440,14 @@ app_main_loop_rx_metadata(void) { APP_METADATA_OFFSET(32)); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip_hdr = (struct ipv4_hdr *) + ip_hdr = (struct rte_ipv4_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ip_dst = ip_hdr->dst_addr; k32 = (uint32_t *) key; k32[0] = ip_dst & 0xFFFFFF00; } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) &m_data[sizeof(struct rte_ether_hdr)]; ipv6_dst = ipv6_hdr->dst_addr; diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index d1344b923..9e6630e80 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -100,7 +100,7 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) /* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) +parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; @@ -119,11 +119,11 @@ parse_ipv4(struct ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) /* Parse an IPv6 header to fill l3_len, l4_len, and l4_proto */ static void -parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) +parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { struct tcp_hdr *tcp_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ @@ -144,8 +144,8 @@ parse_ipv6(struct ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) static void parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; @@ -160,11 +160,13 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) switch (info->ethertype) { case _htons(RTE_ETHER_TYPE_IPv4): - ipv4_hdr = (struct ipv4_hdr *) ((char *)eth_hdr + info->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *) + ((char *)eth_hdr + info->l2_len); parse_ipv4(ipv4_hdr, info); break; case _htons(RTE_ETHER_TYPE_IPv6): - ipv6_hdr = (struct ipv6_hdr *) ((char *)eth_hdr + info->l2_len); + ipv6_hdr = (struct rte_ipv6_hdr *) + ((char *)eth_hdr + info->l2_len); parse_ipv6(ipv6_hdr, info); break; default: @@ -210,8 +212,8 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vxlan_gpe_hdr *vxlan_gpe_hdr; uint8_t vxlan_gpe_len = sizeof(*vxlan_gpe_hdr); @@ -230,7 +232,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)vxlan_gpe_hdr + + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); parse_ipv4(ipv4_hdr, info); @@ -244,7 +246,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)vxlan_gpe_hdr + + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)vxlan_gpe_hdr + vxlan_gpe_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); @@ -273,8 +275,8 @@ static void parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint8_t gre_len = 0; gre_len += sizeof(struct simple_gre_hdr); @@ -293,7 +295,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv4_hdr = (struct ipv4_hdr *)((char *)gre_hdr + gre_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)gre_hdr + gre_len); parse_ipv4(ipv4_hdr, info); info->ethertype = _htons(RTE_ETHER_TYPE_IPv4); @@ -306,7 +308,7 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) info->outer_l3_len = info->l3_len; info->outer_l4_proto = info->l4_proto; - ipv6_hdr = (struct ipv6_hdr *)((char *)gre_hdr + gre_len); + ipv6_hdr = (struct rte_ipv6_hdr *)((char *)gre_hdr + gre_len); info->ethertype = _htons(RTE_ETHER_TYPE_IPv6); parse_ipv6(ipv6_hdr, info); @@ -333,8 +335,8 @@ parse_gre(struct simple_gre_hdr *gre_hdr, struct testpmd_offload_info *info) static void parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) { - struct ipv4_hdr *ipv4_hdr = encap_ip; - struct ipv6_hdr *ipv6_hdr = encap_ip; + struct rte_ipv4_hdr *ipv4_hdr = encap_ip; + struct rte_ipv6_hdr *ipv6_hdr = encap_ip; uint8_t ip_version; ip_version = (ipv4_hdr->version_ihl & 0xf0) >> 4; @@ -363,7 +365,7 @@ static uint64_t process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { - struct ipv4_hdr *ipv4_hdr = l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -454,8 +456,8 @@ static uint64_t process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, uint64_t tx_offloads, int tso_enabled) { - struct ipv4_hdr *ipv4_hdr = outer_l3_hdr; - struct ipv6_hdr *ipv6_hdr = outer_l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; struct udp_hdr *udp_hdr; uint64_t ol_flags = 0; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index ccc5dd85c..989d86f89 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -120,7 +120,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mempool *mbp; struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags = 0; @@ -176,7 +176,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); /* Initialize IP header. */ - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); memset(ip_hdr, 0, sizeof(*ip_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -206,7 +206,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkts_burst[nb_pkt] = pkt; next_flow = (next_flow + 1) % cfg_n_flows; diff --git a/app/test-pmd/icmpecho.c b/app/test-pmd/icmpecho.c index 949cc558d..c055fc99f 100644 --- a/app/test-pmd/icmpecho.c +++ b/app/test-pmd/icmpecho.c @@ -243,7 +243,7 @@ ipv4_addr_dump(const char *what, uint32_t be_ipv4_addr) } static uint16_t -ipv4_hdr_cksum(struct ipv4_hdr *ip_h) +ipv4_hdr_cksum(struct rte_ipv4_hdr *ip_h) { uint16_t *v16_h; uint32_t ip_cksum; @@ -278,7 +278,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) struct rte_ether_hdr *eth_h; struct rte_vlan_hdr *vlan_h; struct rte_arp_hdr *arp_h; - struct ipv4_hdr *ip_h; + struct rte_ipv4_hdr *ip_h; struct rte_icmp_hdr *icmp_h; struct rte_ether_addr eth_addr; uint32_t retry; @@ -418,7 +418,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) rte_pktmbuf_free(pkt); continue; } - ip_h = (struct ipv4_hdr *) ((char *)eth_h + l2_len); + ip_h = (struct rte_ipv4_hdr *) ((char *)eth_h + l2_len); if (verbose_level > 0) { ipv4_addr_dump(" IPV4: src=", ip_h->src_addr); ipv4_addr_dump(" dst=", ip_h->dst_addr); @@ -431,7 +431,7 @@ reply_to_icmp_echo_rqsts(struct fwd_stream *fs) * Check if packet is a ICMP echo request. */ icmp_h = (struct rte_icmp_hdr *) ((char *)ip_h + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); if (! ((ip_h->next_proto_id == IPPROTO_ICMP) && (icmp_h->icmp_type == RTE_IP_ICMP_ECHO_REQUEST) && (icmp_h->icmp_code == 0))) { diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index f15149252..d2ebb1105 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -99,7 +99,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); mb->vlan_tci = txp->tx_vlan_id; mb->vlan_tci_outer = txp->tx_vlan_id_outer; } diff --git a/app/test-pmd/macswap_common.h b/app/test-pmd/macswap_common.h index 56f86baad..7e9a3590a 100644 --- a/app/test-pmd/macswap_common.h +++ b/app/test-pmd/macswap_common.h @@ -40,7 +40,7 @@ mbuf_field_set(struct rte_mbuf *mb, uint64_t ol_flags) mb->ol_flags &= IND_ATTACHED_MBUF | EXT_ATTACHED_MBUF; mb->ol_flags |= ol_flags; mb->l2_len = sizeof(struct rte_ether_hdr); - mb->l3_len = sizeof(struct ipv4_hdr); + mb->l3_len = sizeof(struct rte_ipv4_hdr); } #endif /* _MACSWAP_COMMON_H_ */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index 91fb1f6fb..c16b6b47e 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -53,7 +53,7 @@ uint32_t tx_ip_dst_addr = (192U << 24) | (18 << 16) | (0 << 8) | 2; #define IP_HDRLEN 0x05 /* default IP header length == five 32-bits words. */ #define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) -static struct ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ +static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ @@ -95,7 +95,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) } static void -setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, +setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, struct udp_hdr *udp_hdr, uint16_t pkt_data_len) { @@ -115,7 +115,7 @@ setup_pkt_udp_ip_headers(struct ipv4_hdr *ip_hdr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; ip_hdr->fragment_offset = 0; @@ -177,7 +177,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, pkt->vlan_tci = vlan_tci; pkt->vlan_tci_outer = vlan_tci_outer; pkt->l2_len = sizeof(struct rte_ether_hdr); - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); pkt_len = pkt->data_len; pkt_seg = pkt; @@ -195,11 +195,11 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, copy_buf_to_pkt(&pkt_ip_hdr, sizeof(pkt_ip_hdr), pkt, sizeof(struct rte_ether_hdr)); if (txonly_multi_flow) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t addr; ip_hdr = rte_pktmbuf_mtod_offset(pkt, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* * Generate multiple flows by varying IP src addr. This @@ -213,7 +213,7 @@ pkt_burst_prepare(struct rte_mbuf *pkt, struct rte_mempool *mbp, } copy_buf_to_pkt(&pkt_udp_hdr, sizeof(pkt_udp_hdr), pkt, sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); /* * Complete first mbuf of packet and append it to the * burst of packets to be transmitted. @@ -349,7 +349,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) pkt_data_len = (uint16_t) (tx_pkt_length - ( sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 105c56090..b8e5548ca 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -103,8 +103,8 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (sw_packet_type & RTE_PTYPE_INNER_L4_MASK) printf(" - inner_l4_len=%d", hdr_lens.inner_l4_len); if (is_encapsulation) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; @@ -116,15 +116,15 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], /* Do not support ipv4 option field */ if (RTE_ETH_IS_IPV4_HDR(packet_type)) { - l3_len = sizeof(struct ipv4_hdr); + l3_len = sizeof(struct rte_ipv4_hdr); ipv4_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv4_hdr *, + struct rte_ipv4_hdr *, l2_len); l4_proto = ipv4_hdr->next_proto_id; } else { - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); ipv6_hdr = rte_pktmbuf_mtod_offset(mb, - struct ipv6_hdr *, + struct rte_ipv6_hdr *, l2_len); l4_proto = ipv6_hdr->proto; } diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 0999b87e1..02afc5547 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -140,7 +140,7 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, } uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len) { ip_hdr->vtc_flow = 0; @@ -151,11 +151,11 @@ initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, rte_memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); rte_memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); - return (uint16_t) (pkt_data_len + sizeof(struct ipv6_hdr)); + return (uint16_t) (pkt_data_len + sizeof(struct rte_ipv6_hdr)); } uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -165,7 +165,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -203,7 +203,7 @@ initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, } uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto) { uint16_t pkt_len; @@ -213,7 +213,7 @@ initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, /* * Initialize IP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr)); ip_hdr->version_ihl = IP_VHL_DEF; ip_hdr->type_of_service = 0; @@ -304,13 +304,15 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, eth_hdr_size); - copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv4_hdr)); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), + pkt, eth_hdr_size); + copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, + eth_hdr_size + sizeof(struct rte_ipv4_hdr)); } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, eth_hdr_size); - copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, eth_hdr_size + - sizeof(struct ipv6_hdr)); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), + pkt, eth_hdr_size); + copy_buf_to_pkt(udp_hdr, sizeof(*udp_hdr), pkt, + eth_hdr_size + sizeof(struct rte_ipv6_hdr)); } /* @@ -323,10 +325,10 @@ generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; @@ -383,45 +385,51 @@ generate_packet_burst_proto(struct rte_mempool *mp, copy_buf_to_pkt(eth_hdr, eth_hdr_size, pkt, 0); if (ipv4) { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv4_hdr), pkt, - eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv4_hdr), + pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + + sizeof(struct rte_ipv4_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv4_hdr)); + eth_hdr_size + + sizeof(struct rte_ipv4_hdr)); break; default: break; } } else { - copy_buf_to_pkt(ip_hdr, sizeof(struct ipv6_hdr), pkt, - eth_hdr_size); + copy_buf_to_pkt(ip_hdr, sizeof(struct rte_ipv6_hdr), + pkt, eth_hdr_size); switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, sizeof(struct udp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, sizeof(struct tcp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + + sizeof(struct rte_ipv6_hdr)); break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, sizeof(struct sctp_hdr), pkt, - eth_hdr_size + sizeof(struct ipv6_hdr)); + eth_hdr_size + + sizeof(struct rte_ipv6_hdr)); break; default: break; @@ -438,10 +446,10 @@ generate_packet_burst_proto(struct rte_mempool *mp, if (ipv4) { pkt->vlan_tci = RTE_ETHER_TYPE_IPv4; - pkt->l3_len = sizeof(struct ipv4_hdr); + pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { pkt->vlan_tci = RTE_ETHER_TYPE_IPv6; - pkt->l3_len = sizeof(struct ipv6_hdr); + pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkts_burst[nb_pkt] = pkt; diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 744e21a1f..c8bc372db 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -47,15 +47,15 @@ initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_ipv6_header(struct ipv6_hdr *ip_hdr, uint8_t *src_addr, +initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, uint8_t *dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len); uint16_t -initialize_ipv4_header_proto(struct ipv4_hdr *ip_hdr, uint32_t src_addr, +initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, uint32_t dst_addr, uint16_t pkt_data_len, uint8_t proto); int diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 3f06f3005..96e371691 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -40,7 +40,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -50,7 +50,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -60,7 +60,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -73,7 +73,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -83,7 +83,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -490,7 +490,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); @@ -527,7 +527,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); @@ -564,7 +564,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 4342b730b..d8860fba0 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -531,7 +531,7 @@ const char null_encrypted_data[] = "Network Security People Have A Strange Sense Of Humor unlike Other " "People who have a normal sense of humour"; -struct ipv4_hdr ipv4_outer = { +struct rte_ipv4_hdr ipv4_outer = { .version_ihl = IPVERSION << 4 | sizeof(ipv4_outer) / IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, @@ -569,7 +569,8 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, size_t len, uint32_t spi, uint32_t seq) { struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); - uint32_t hdrlen = sizeof(struct ipv4_hdr) + sizeof(struct rte_esp_hdr); + uint32_t hdrlen = sizeof(struct rte_ipv4_hdr) + + sizeof(struct rte_esp_hdr); uint32_t taillen = sizeof(struct esp_tail); uint32_t t_len = len + hdrlen + taillen; uint32_t padlen; diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index eb6f1a9f1..c1c22fb96 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -78,14 +78,14 @@ struct link_bonding_unittest_params { /* Packet Headers */ struct rte_ether_hdr *pkt_eth_hdr; - struct ipv4_hdr *pkt_ipv4_hdr; - struct ipv6_hdr *pkt_ipv6_hdr; + struct rte_ipv4_hdr *pkt_ipv4_hdr; + struct rte_ipv6_hdr *pkt_ipv6_hdr; struct udp_hdr *pkt_udp_hdr; }; -static struct ipv4_hdr pkt_ipv4_hdr; -static struct ipv6_hdr pkt_ipv6_hdr; +static struct rte_ipv4_hdr pkt_ipv4_hdr; +static struct rte_ipv6_hdr pkt_ipv6_hdr; static struct udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 96466a1ac..e67bfacdd 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -735,8 +735,8 @@ generate_packets(struct rte_ether_addr *src_mac, struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; union { - struct ipv4_hdr v4; - struct ipv6_hdr v6; + struct rte_ipv4_hdr v4; + struct rte_ipv6_hdr v6; } pkt_ip_hdr; int retval; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 4b973ffc4..0d1c1b1ab 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -183,7 +183,7 @@ init_traffic(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, uint32_t burst_size) { struct rte_ether_hdr pkt_eth_hdr; - struct ipv4_hdr pkt_ipv4_hdr; + struct rte_ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; diff --git a/app/test/test_sched.c b/app/test/test_sched.c index a08e1294c..c6fb7871a 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -80,7 +80,7 @@ prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) { struct rte_ether_hdr *eth_hdr; struct rte_vlan_hdr *vlan1, *vlan2; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; /* Simulate a classifier */ eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); @@ -90,7 +90,7 @@ prepare_pkt(struct rte_sched_port *port, struct rte_mbuf *mbuf) eth_hdr = (struct rte_ether_hdr *)( (uintptr_t)ð_hdr->ether_type + 2 * sizeof(struct rte_vlan_hdr)); - ip_hdr = (struct ipv4_hdr *)( + ip_hdr = (struct rte_ipv4_hdr *)( (uintptr_t)eth_hdr + sizeof(eth_hdr->ether_type)); vlan1->vlan_tci = rte_cpu_to_be_16(SUBPORT); diff --git a/app/test/test_thash.c b/app/test/test_thash.c index 61754a947..bf332c9e9 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -110,7 +110,7 @@ test_thash(void) union rte_thash_tuple tuple; uint32_t rss_l3, rss_l3l4; uint8_t rss_key_be[RTE_DIM(default_rss_key)]; - struct ipv6_hdr ipv6_hdr; + struct rte_ipv6_hdr ipv6_hdr; /* Convert RSS key*/ rte_convert_rss_key((uint32_t *)&default_rss_key, diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 395b3ec47..6887e4dc6 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -154,7 +154,7 @@ To define classification for the IPv6 2-tuple: <protocol, IPv6 source address> o .. code-block:: c - struct struct ipv6_hdr { + struct struct rte_ipv6_hdr { uint32_t vtc_flow; /* IP version, traffic class & flow label. */ uint16_t payload_len; /* IP packet length - includes sizeof(ip_header). */ uint8_t proto; /* Protocol, next header. */ @@ -173,7 +173,7 @@ The following array of field definitions can be used: .size = sizeof (uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof (struct ipv6_hdr, proto), + .offset = offsetof (struct rte_ipv6_hdr, proto), }, { @@ -181,7 +181,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof (struct ipv6_hdr, src_addr[0]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[0]), }, { @@ -189,7 +189,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof (struct ipv6_hdr, src_addr[4]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[4]), }, { @@ -197,7 +197,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof (struct ipv6_hdr, src_addr[8]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[8]), }, { @@ -205,7 +205,7 @@ The following array of field definitions can be used: .size = sizeof (uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof (struct ipv6_hdr, src_addr[12]), + .offset = offsetof (struct rte_ipv6_hdr, src_addr[12]), }, }; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 762c3844e..46703acbf 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -92,7 +92,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -102,7 +102,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -112,7 +112,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -125,7 +125,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -135,7 +135,7 @@ initialisation of the ``Flow Classify`` application.. .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index a4cb4377f..46c920433 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -146,7 +146,7 @@ Firstly, the Ethernet* header is removed from the packet and the IPv4 address is /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); + iphdr = (struct rte_ipv4_hdr *)rte_pktmbuf_adj(m, sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); dest_addr = rte_be_to_cpu_32(iphdr->dst_addr); diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst index 2d759170c..4cb4b18da 100644 --- a/doc/guides/sample_app_ug/l3_forward.rst +++ b/doc/guides/sample_app_ug/l3_forward.rst @@ -245,7 +245,7 @@ The get_ipv4_dst_port() function is shown below: int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct rte_ipv4_hdr, time_to_live); m128i data = _mm_loadu_si128(( m128i*)(ipv4_hdr)); @@ -273,10 +273,10 @@ The key code snippet of simple_ipv4_fwd_4pkts() is shown below: { // ... - data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); - data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct ipv4_hdr, time_to_live))); + data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); + data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -309,7 +309,7 @@ for LPM-based lookups is done by the get_ipv4_dst_port() function below: .. code-block:: c static inline uint16_t - get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) + get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint8_t next_hop; diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst index f7dab9e98..12208f425 100644 --- a/doc/guides/sample_app_ug/server_node_efd.rst +++ b/doc/guides/sample_app_ug/server_node_efd.rst @@ -191,12 +191,12 @@ which tells the node where the packet has to be distributed. efd_value_t data[EFD_BURST_MAX]; const void *key_ptrs[EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; @@ -348,7 +348,7 @@ flow is not handled by the node. static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -356,7 +356,7 @@ flow is not handled by the node. for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 79962b43a..5a3f4d147 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -591,7 +591,7 @@ mode6_debug(const char __attribute__((unused)) *info, struct rte_ether_hdr *eth_h, uint16_t port, uint32_t __attribute__((unused)) *burstnumber) { - struct ipv4_hdr *ipv4_h; + struct rte_ipv4_hdr *ipv4_h; #ifdef RTE_LIBRTE_BOND_DEBUG_ALB struct rte_arp_hdr *arp_h; char dst_ip[16]; @@ -608,7 +608,7 @@ mode6_debug(const char __attribute__((unused)) *info, #endif if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - ipv4_h = (struct ipv4_hdr *)((char *)(eth_h + 1) + offset); + ipv4_h = (struct rte_ipv4_hdr *)((char *)(eth_h + 1) + offset); ipv4_addr_to_dot(ipv4_h->src_addr, src_ip, MaxIPv4String); #ifdef RTE_LIBRTE_BOND_DEBUG_ALB ipv4_addr_to_dot(ipv4_h->dst_addr, dst_ip, MaxIPv4String); @@ -755,13 +755,13 @@ ether_hash(struct rte_ether_hdr *eth_hdr) } static inline uint32_t -ipv4_hash(struct ipv4_hdr *ipv4_hdr) +ipv4_hash(struct rte_ipv4_hdr *ipv4_hdr) { return ipv4_hdr->src_addr ^ ipv4_hdr->dst_addr; } static inline uint32_t -ipv6_hash(struct ipv6_hdr *ipv6_hdr) +ipv6_hash(struct rte_ipv6_hdr *ipv6_hdr) { unaligned_uint32_t *word_src_addr = (unaligned_uint32_t *)&(ipv6_hdr->src_addr[0]); @@ -812,12 +812,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(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv4_hash(ipv4_hdr); } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); } @@ -852,7 +852,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = 0; if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4) == proto) { - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *) + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); size_t ip_hdr_offset; @@ -883,7 +883,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, } } } else if (rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6) == proto) { - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *) + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)(eth_hdr + 1) + vlan_offset); l3hash = ipv6_hash(ipv6_hdr); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 6699b768c..0901ca2d9 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -201,22 +201,22 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); char *l3_hdr = (char *)eth_hdr + mbuf->l2_len; - struct ipv4_hdr *ipv4_hdr = (struct ipv4_hdr *)l3_hdr; - struct ipv6_hdr *ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + struct rte_ipv4_hdr *ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; DPAA_DP_LOG(DEBUG, "Calculating checksum for mbuf: %p", mbuf); if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV4_EXT)) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_ipv4_hdr *)l3_hdr; ipv4_hdr->hdr_checksum = 0; ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } else if (((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6) || ((mbuf->packet_type & RTE_PTYPE_L3_MASK) == RTE_PTYPE_L3_IPV6_EXT)) - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 1da56b229..30231cc38 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -222,7 +222,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, /* setup IPCS* fields */ ctx.lower_setup.ip_fields.ipcss = (uint8_t)l2len; ctx.lower_setup.ip_fields.ipcso = (uint8_t)(l2len + - offsetof(struct ipv4_hdr, hdr_checksum)); + offsetof(struct rte_ipv4_hdr, hdr_checksum)); /* * When doing checksum or TCP segmentation with IPv6 headers, diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 5ed86f0b1..d9f71d2eb 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2137,7 +2137,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint32_t i; struct rte_mbuf *m; struct ena_ring *tx_ring = (struct ena_ring *)(tx_queue); - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint64_t ol_flags; uint16_t frag_field; @@ -2154,7 +2154,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (unlikely(m->l2_len == 0)) m->l2_len = sizeof(struct rte_ether_hdr); - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 53f57b01a..65d0be3b6 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -182,9 +182,9 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_OTHER) { - struct ipv4_hdr ip4_mask, ip4_val; - memset(&ip4_mask, 0, sizeof(struct ipv4_hdr)); - memset(&ip4_val, 0, sizeof(struct ipv4_hdr)); + struct rte_ipv4_hdr ip4_mask, ip4_val; + memset(&ip4_mask, 0, sizeof(struct rte_ipv4_hdr)); + memset(&ip4_val, 0, sizeof(struct rte_ipv4_hdr)); if (input->flow.ip4_flow.tos) { ip4_mask.type_of_service = masks->ipv4_mask.tos; @@ -212,7 +212,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV4, FILTER_GENERIC_1_L3, - &ip4_mask, &ip4_val, sizeof(struct ipv4_hdr)); + &ip4_mask, &ip4_val, sizeof(struct rte_ipv4_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { @@ -271,9 +271,9 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP || input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_OTHER) { - struct ipv6_hdr ipv6_mask, ipv6_val; - memset(&ipv6_mask, 0, sizeof(struct ipv6_hdr)); - memset(&ipv6_val, 0, sizeof(struct ipv6_hdr)); + struct rte_ipv6_hdr ipv6_mask, ipv6_val; + memset(&ipv6_mask, 0, sizeof(struct rte_ipv6_hdr)); + memset(&ipv6_val, 0, sizeof(struct rte_ipv6_hdr)); if (input->flow.ipv6_flow.proto) { ipv6_mask.proto = masks->ipv6_mask.proto; @@ -301,7 +301,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_IPV6, FILTER_GENERIC_1_L3, - &ipv6_mask, &ipv6_val, sizeof(struct ipv6_hdr)); + &ipv6_mask, &ipv6_val, sizeof(struct rte_ipv6_hdr)); } } diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index bdac1f755..d15b00942 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -411,7 +411,7 @@ enic_copy_item_ipv4_v1(struct copy_item_args *arg) const struct rte_flow_item_ipv4 *spec = item->spec; const struct rte_flow_item_ipv4 *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct ipv4_hdr supported_mask = { + struct rte_ipv4_hdr supported_mask = { .src_addr = 0xffffffff, .dst_addr = 0xffffffff, }; @@ -606,9 +606,9 @@ enic_copy_item_inner_ipv4_v2(struct copy_item_args *arg) if (!mask) mask = &rte_flow_item_ipv4_mask; /* Append ipv4 header to L5 and set ether type = ipv4 */ - arg->l3_proto_off = *off + offsetof(struct ipv4_hdr, next_proto_id); + arg->l3_proto_off = *off + offsetof(struct rte_ipv4_hdr, next_proto_id); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ipv4_hdr), + arg->item->spec, mask, sizeof(struct rte_ipv4_hdr), arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4), 2); } @@ -622,9 +622,9 @@ enic_copy_item_inner_ipv6_v2(struct copy_item_args *arg) if (!mask) mask = &rte_flow_item_ipv6_mask; /* Append ipv6 header to L5 and set ether type = ipv6 */ - arg->l3_proto_off = *off + offsetof(struct ipv6_hdr, proto); + arg->l3_proto_off = *off + offsetof(struct rte_ipv6_hdr, proto); return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct ipv6_hdr), + arg->item->spec, mask, sizeof(struct rte_ipv6_hdr), arg->l2_proto_off, rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6), 2); } @@ -773,9 +773,9 @@ enic_copy_item_ipv4_v2(struct copy_item_args *arg) mask = &rte_flow_item_ipv4_mask; memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); return 0; } @@ -802,9 +802,9 @@ enic_copy_item_ipv6_v2(struct copy_item_args *arg) mask = &rte_flow_item_ipv6_mask; memcpy(gp->layer[FILTER_GENERIC_1_L3].mask, &mask->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L3].val, &spec->hdr, - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); return 0; } @@ -884,16 +884,16 @@ enic_copy_item_sctp_v2(struct copy_item_args *arg) * the protocol number in the IP pattern. */ if (gp->val_flags & FILTER_GENERIC_1_IPV4) { - struct ipv4_hdr *ip; - ip = (struct ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; + struct rte_ipv4_hdr *ip; + ip = (struct rte_ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; ip_proto_mask = &ip->next_proto_id; - ip = (struct ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; + ip = (struct rte_ipv4_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; ip_proto = &ip->next_proto_id; } else if (gp->val_flags & FILTER_GENERIC_1_IPV6) { - struct ipv6_hdr *ip; - ip = (struct ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; + struct rte_ipv6_hdr *ip; + ip = (struct rte_ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].mask; ip_proto_mask = &ip->proto; - ip = (struct ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; + ip = (struct rte_ipv6_hdr *)gp->layer[FILTER_GENERIC_1_L3].val; ip_proto = &ip->proto; } else { /* Need IPv4/IPv6 pattern first */ diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 4aaf27f7c..b20f30fb4 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -686,8 +686,8 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; static const uint8_t next_proto[] = { [RTE_ETH_FLOW_FRAG_IPV4] = IPPROTO_IP, [RTE_ETH_FLOW_NONFRAG_IPV4_TCP] = IPPROTO_TCP, @@ -723,7 +723,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: case RTE_ETH_FLOW_FRAG_IPV4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -743,14 +743,14 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, */ ip->src_addr = fdir_input->flow.ip4_flow.dst_ip; ip->dst_addr = fdir_input->flow.ip4_flow.src_ip; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: case RTE_ETH_FLOW_FRAG_IPV6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -776,7 +776,7 @@ i40e_fdir_fill_eth_ip_head(const struct rte_eth_fdir_input *fdir_input, rte_memcpy(&(ip6->dst_addr), &(fdir_input->flow.ipv6_flow.src_ip), IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); break; default: PMD_DRV_LOG(ERR, "unknown flow type %u.", @@ -960,8 +960,8 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, static uint8_t vlan_frame[] = {0x81, 0, 0, 0}; uint16_t *ether_type; uint8_t len = 2 * sizeof(struct rte_ether_addr); - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; uint8_t pctype = fdir_input->pctype; bool is_customized_pctype = fdir_input->flow_ext.customized_pctype; static const uint8_t next_proto[] = { @@ -1007,7 +1007,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, pctype == I40E_FILTER_PCTYPE_NONF_IPV4_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV4 || is_customized_pctype) { - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); ip->version_ihl = I40E_FDIR_IP_DEFAULT_VERSION_IHL; @@ -1034,13 +1034,13 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) ip->next_proto_id = IPPROTO_UDP; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP || pctype == I40E_FILTER_PCTYPE_NONF_IPV6_OTHER || pctype == I40E_FILTER_PCTYPE_FRAG_IPV6) { - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; *ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6); ip6->vtc_flow = @@ -1066,7 +1066,7 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); } else { PMD_DRV_LOG(ERR, "unknown pctype %u.", fdir_input->pctype); @@ -1093,8 +1093,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, struct tcp_hdr *tcp; struct sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; - struct ipv4_hdr *gtp_ipv4; - struct ipv6_hdr *gtp_ipv6; + struct rte_ipv4_hdr *gtp_ipv4; + struct rte_ipv6_hdr *gtp_ipv6; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -1232,7 +1232,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv4 = (struct ipv4_hdr *) + gtp_ipv4 = (struct rte_ipv4_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv4->version_ihl = @@ -1242,11 +1242,11 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, rte_cpu_to_be_16( I40E_FDIR_INNER_IP_DEFAULT_LEN); payload = (unsigned char *)gtp_ipv4 + - sizeof(struct ipv4_hdr); + sizeof(struct rte_ipv4_hdr); } else if (cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6) { gtp->msg_type = I40E_FDIR_GTP_MSG_TYPE_0XFF; - gtp_ipv6 = (struct ipv6_hdr *) + gtp_ipv6 = (struct rte_ipv6_hdr *) ((unsigned char *)gtp + sizeof(struct rte_flow_item_gtp)); gtp_ipv6->vtc_flow = @@ -1260,7 +1260,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, gtp_ipv6->hop_limits = I40E_FDIR_IPv6_DEFAULT_HOP_LIMITS; payload = (unsigned char *)gtp_ipv6 + - sizeof(struct ipv6_hdr); + sizeof(struct rte_ipv6_hdr); } else payload = (unsigned char *)gtp + sizeof(struct rte_flow_item_gtp); diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index f29c617e1..3a0ca114e 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2548,13 +2548,13 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER: - attributes->l3.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = input->flow.ip4_flow.src_ip, .dst_addr = input->flow.ip4_flow.dst_ip, .time_to_live = input->flow.ip4_flow.ttl, .type_of_service = input->flow.ip4_flow.tos, }; - attributes->l3_mask.ipv4.hdr = (struct ipv4_hdr){ + attributes->l3_mask.ipv4.hdr = (struct rte_ipv4_hdr){ .src_addr = mask->ipv4_mask.src_ip, .dst_addr = mask->ipv4_mask.dst_ip, .time_to_live = mask->ipv4_mask.ttl, @@ -2570,7 +2570,7 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER: - attributes->l3.ipv6.hdr = (struct ipv6_hdr){ + attributes->l3.ipv6.hdr = (struct rte_ipv6_hdr){ .hop_limits = input->flow.ipv6_flow.hop_limits, .proto = input->flow.ipv6_flow.proto, }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index b7a56ebdc..3aef9f652 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1213,8 +1213,8 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, { struct rte_ether_hdr *eth = NULL; struct rte_vlan_hdr *vlan = NULL; - struct ipv4_hdr *ipv4 = NULL; - struct ipv6_hdr *ipv6 = NULL; + struct rte_ipv4_hdr *ipv4 = NULL; + struct rte_ipv6_hdr *ipv6 = NULL; struct udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; @@ -1250,7 +1250,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_VLAN); break; case RTE_FLOW_ITEM_TYPE_IPV4: - ipv4 = (struct ipv4_hdr *)&buf[temp_size]; + ipv4 = (struct rte_ipv4_hdr *)&buf[temp_size]; if (!vlan && !eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -1268,7 +1268,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv4->time_to_live = MLX5_ENCAP_IPV4_TTL_DEF; break; case RTE_FLOW_ITEM_TYPE_IPV6: - ipv6 = (struct ipv6_hdr *)&buf[temp_size]; + ipv6 = (struct rte_ipv6_hdr *)&buf[temp_size]; if (!vlan && !eth) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 7b9a15e7e..e021ea5e0 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -732,12 +732,12 @@ flow_tcf_pedit_key_set_dec_ttl(const struct rte_flow_action *actions, if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV4) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP4; p_parser->keys[idx].off = - offsetof(struct ipv4_hdr, time_to_live); + offsetof(struct rte_ipv4_hdr, time_to_live); } if (item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6) { p_parser->keys_ex[idx].htype = TCA_PEDIT_KEY_EX_HDR_TYPE_IP6; p_parser->keys[idx].off = - offsetof(struct ipv6_hdr, hop_limits); + offsetof(struct rte_ipv6_hdr, hop_limits); } if (actions->type == RTE_FLOW_ACTION_TYPE_DEC_TTL) { p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_ADD; @@ -801,8 +801,8 @@ flow_tcf_pedit_key_set_ipv6_addr(const struct rte_flow_action *actions, int keys = NUM_OF_PEDIT_KEYS(IPV6_ADDR_LEN); int off_base = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC ? - offsetof(struct ipv6_hdr, src_addr) : - offsetof(struct ipv6_hdr, dst_addr); + offsetof(struct rte_ipv6_hdr, src_addr) : + offsetof(struct rte_ipv6_hdr, dst_addr); const struct rte_flow_action_set_ipv6 *conf = (const struct rte_flow_action_set_ipv6 *)actions->conf; @@ -836,8 +836,8 @@ flow_tcf_pedit_key_set_ipv4_addr(const struct rte_flow_action *actions, p_parser->keys_ex[idx].cmd = TCA_PEDIT_KEY_EX_CMD_SET; p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC ? - offsetof(struct ipv4_hdr, src_addr) : - offsetof(struct ipv4_hdr, dst_addr); + offsetof(struct rte_ipv4_hdr, src_addr) : + offsetof(struct rte_ipv4_hdr, dst_addr); p_parser->keys[idx].mask = ~UINT32_MAX; p_parser->keys[idx].val = ((const struct rte_flow_action_set_ipv4 *) diff --git a/drivers/net/mvpp2/mrvl_flow.c b/drivers/net/mvpp2/mrvl_flow.c index 738986575..381b54e29 100644 --- a/drivers/net/mvpp2/mrvl_flow.c +++ b/drivers/net/mvpp2/mrvl_flow.c @@ -1170,7 +1170,7 @@ mrvl_parse_ip6(const struct rte_flow_item *item, struct rte_flow_error *error) { const struct rte_flow_item_ipv6 *spec = NULL, *mask = NULL; - struct ipv6_hdr zero; + struct rte_ipv6_hdr zero; uint32_t flow_mask; int ret; diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index c2f39ceb9..2caf314d2 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -457,8 +457,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); uint16_t *ether_type; uint8_t *raw_pkt; - struct ipv4_hdr *ip; - struct ipv6_hdr *ip6; + struct rte_ipv4_hdr *ip; + struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; struct tcp_hdr *tcp; uint16_t len; @@ -474,14 +474,14 @@ 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 RTE_ETHER_TYPE_IPv4: - ip = (struct ipv4_hdr *)raw_pkt; + ip = (struct rte_ipv4_hdr *)raw_pkt; ip->version_ihl = QEDE_FDIR_IP_DEFAULT_VERSION_IHL; - ip->total_length = sizeof(struct ipv4_hdr); + ip->total_length = sizeof(struct rte_ipv4_hdr); ip->next_proto_id = arfs->tuple.ip_proto; ip->time_to_live = QEDE_FDIR_IPV4_DEF_TTL; ip->dst_addr = arfs->tuple.dst_ipv4; ip->src_addr = arfs->tuple.src_ipv4; - len += sizeof(struct ipv4_hdr); + len += sizeof(struct rte_ipv4_hdr); params->ipv4 = true; raw_pkt = (uint8_t *)buff; @@ -507,7 +507,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, } break; case RTE_ETHER_TYPE_IPv6: - ip6 = (struct ipv6_hdr *)raw_pkt; + ip6 = (struct rte_ipv6_hdr *)raw_pkt; ip6->proto = arfs->tuple.ip_proto; ip6->vtc_flow = rte_cpu_to_be_32(QEDE_FDIR_IPV6_DEFAULT_VTC_FLOW); @@ -516,7 +516,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, IPV6_ADDR_LEN); rte_memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, IPV6_ADDR_LEN); - len += sizeof(struct ipv6_hdr); + len += sizeof(struct rte_ipv6_hdr); params->ipv6 = true; raw_pkt = (uint8_t *)buff; diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 235f78ae3..bb5f57df3 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -951,8 +951,8 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) { uint32_t packet_type = RTE_PTYPE_UNKNOWN; struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_vlan_hdr *vlan_hdr; uint16_t ethertype; bool vlan_tagged = 0; @@ -972,14 +972,16 @@ static inline uint32_t qede_rx_cqe_to_pkt_type_outer(struct rte_mbuf *m) if (ethertype == RTE_ETHER_TYPE_IPv4) { packet_type |= RTE_PTYPE_L3_IPV4; - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, len); + ipv4_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_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 == RTE_ETHER_TYPE_IPv6) { packet_type |= RTE_PTYPE_L3_IPV6; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, len); + ipv6_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv6_hdr *, len); if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) @@ -1141,7 +1143,7 @@ static inline uint32_t qede_rx_cqe_to_pkt_type(uint16_t flags) static inline uint8_t qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) { - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; uint16_t pkt_csum; uint16_t calc_csum; uint16_t val; @@ -1152,7 +1154,7 @@ qede_check_notunn_csum_l3(struct rte_mbuf *m, uint16_t flag) if (unlikely(val)) { m->packet_type = qede_rx_cqe_to_pkt_type(flag); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - ip = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ip = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); pkt_csum = ip->hdr_checksum; ip->hdr_checksum = 0; diff --git a/drivers/net/sfc/sfc_tso.h b/drivers/net/sfc/sfc_tso.h index 8ecefdfd2..ef257519a 100644 --- a/drivers/net/sfc/sfc_tso.h +++ b/drivers/net/sfc/sfc_tso.h @@ -29,10 +29,10 @@ extern "C" { static inline uint16_t sfc_tso_ip4_get_ipid(const uint8_t *pkt_hdrp, size_t ip_hdr_off) { - const struct ipv4_hdr *ip_hdrp; + const struct rte_ipv4_hdr *ip_hdrp; uint16_t ipid; - ip_hdrp = (const struct ipv4_hdr *)(pkt_hdrp + ip_hdr_off); + ip_hdrp = (const struct rte_ipv4_hdr *)(pkt_hdrp + ip_hdr_off); rte_memcpy(&ipid, &ip_hdrp->packet_id, sizeof(ipid)); return rte_be_to_cpu_16(ipid); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index 308fd1534..e0e5856a4 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -660,7 +660,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -669,7 +669,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -678,7 +678,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -687,7 +687,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -697,7 +697,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -709,7 +709,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -718,7 +718,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -726,7 +726,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -734,7 +734,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -742,7 +742,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -751,7 +751,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -759,7 +759,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -767,7 +767,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -775,7 +775,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -784,7 +784,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -794,7 +794,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 4a42bbeb1..8abae5a91 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -272,12 +272,12 @@ tap_verify_csum(struct rte_mbuf *mbuf) else if (l2 == RTE_PTYPE_L2_ETHER_QINQ) l2_len += 8; /* Don't verify checksum for packets with discontinuous L2 header */ - if (unlikely(l2_len + sizeof(struct ipv4_hdr) > + if (unlikely(l2_len + sizeof(struct rte_ipv4_hdr) > rte_pktmbuf_data_len(mbuf))) return; l3_hdr = rte_pktmbuf_mtod_offset(mbuf, void *, l2_len); if (l3 == RTE_PTYPE_L3_IPV4 || l3 == RTE_PTYPE_L3_IPV4_EXT) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; /* ihl contains the number of 4-byte words in the header */ l3_len = 4 * (iph->version_ihl & 0xf); @@ -295,9 +295,9 @@ tap_verify_csum(struct rte_mbuf *mbuf) PKT_RX_IP_CKSUM_BAD : PKT_RX_IP_CKSUM_GOOD; } else if (l3 == RTE_PTYPE_L3_IPV6) { - struct ipv6_hdr *iph = l3_hdr; + struct rte_ipv6_hdr *iph = l3_hdr; - l3_len = sizeof(struct ipv6_hdr); + l3_len = sizeof(struct rte_ipv6_hdr); /* check that the total length reported by header is not * greater than the total received size */ @@ -496,7 +496,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, void *l3_hdr = packet + l2_len; if (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4)) { - struct ipv4_hdr *iph = l3_hdr; + struct rte_ipv4_hdr *iph = l3_hdr; uint16_t cksum; iph->hdr_checksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 3805e217a..b4c54c1b1 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -479,13 +479,14 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) /* common case: header is not fragmented */ if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + m->l4_len)) { - struct ipv4_hdr *iph; - struct ipv6_hdr *ip6h; + struct rte_ipv4_hdr *iph; + struct rte_ipv6_hdr *ip6h; struct tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; - iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + iph = rte_pktmbuf_mtod_offset(m, + struct rte_ipv4_hdr *, m->l2_len); th = RTE_PTR_ADD(iph, m->l3_len); if ((iph->version_ihl >> 4) == 4) { iph->hdr_checksum = 0; @@ -494,7 +495,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) - m->l3_len); } else { - ip6h = (struct ipv6_hdr *)iph; + ip6h = (struct rte_ipv6_hdr *)iph; ip_paylen = ip6h->payload_len; } diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index b691141b5..576090239 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -667,8 +667,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, struct rte_mbuf *rxm) { uint32_t hlen, slen; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; char *ptr; @@ -679,20 +679,20 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, hlen = sizeof(struct rte_ether_hdr); if (rcd->v4) { - if (unlikely(slen < hlen + sizeof(struct ipv4_hdr))) - return hw->mtu - sizeof(struct ipv4_hdr) + if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) + return hw->mtu - sizeof(struct rte_ipv4_hdr) - sizeof(struct tcp_hdr); - ipv4_hdr = (struct ipv4_hdr *)(ptr + hlen); + ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { - if (unlikely(slen < hlen + sizeof(struct ipv6_hdr))) - return hw->mtu - sizeof(struct ipv6_hdr) - + if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) + return hw->mtu - sizeof(struct rte_ipv6_hdr) - sizeof(struct tcp_hdr); - ipv6_hdr = (struct ipv6_hdr *)(ptr + hlen); - hlen += sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); + hlen += sizeof(struct rte_ipv6_hdr); if (unlikely(ipv6_hdr->proto != IPPROTO_TCP)) { int frag; diff --git a/examples/bond/main.c b/examples/bond/main.c index 2e81a9e7e..9b9ed56ca 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -341,7 +341,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) struct rte_ether_hdr *eth_hdr; struct rte_arp_hdr *arp_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t ether_type, offset; uint16_t rx_cnt; @@ -409,7 +409,7 @@ static int lcore_main(__attribute__((unused)) void *arg1) global_flag_stru_p->port_packets[2]++; rte_spinlock_unlock(&global_flag_stru_p->lock); } - ipv4_hdr = (struct ipv4_hdr *)((char *)(eth_hdr + 1) + offset); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)(eth_hdr + 1) + offset); if (ipv4_hdr->dst_addr == bond_ip) { rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); rte_eth_macaddr_get(BOND_PORT, ð_hdr->s_addr); diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index dfb7db1c9..c75a410f4 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -99,7 +99,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = PROTO_FIELD_IPV4, .input_index = PROTO_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, next_proto_id), + offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* next input field (IPv4 source address) - 4 consecutive bytes. */ { @@ -109,7 +109,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRC_FIELD_IPV4, .input_index = SRC_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, src_addr), + offsetof(struct rte_ipv4_hdr, src_addr), }, /* next input field (IPv4 destination address) - 4 consecutive bytes. */ { @@ -119,7 +119,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DST_FIELD_IPV4, .input_index = DST_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, dst_addr), + offsetof(struct rte_ipv4_hdr, dst_addr), }, /* * Next 2 fields (src & dst ports) form 4 consecutive bytes. @@ -132,7 +132,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = SRCP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, { @@ -142,7 +142,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .field_index = DSTP_FIELD_IPV4, .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + - sizeof(struct ipv4_hdr) + + sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index d071dae9c..847f9ab60 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -66,8 +66,8 @@ /* * Default payload in bytes for the IPv6 packet. */ -#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct ipv4_hdr)) -#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct ipv6_hdr)) +#define IPV4_DEFAULT_PAYLOAD (IPV4_MTU_DEFAULT - sizeof(struct rte_ipv4_hdr)) +#define IPV6_DEFAULT_PAYLOAD (IPV6_MTU_DEFAULT - sizeof(struct rte_ipv6_hdr)) /* * Max number of fragments per packet expected - defined by config file. @@ -260,10 +260,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, /* if this is an IPv4 packet */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv4_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv4_hdr *); ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); /* Find destination port */ @@ -295,12 +295,12 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf, } } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if this is an IPv6 packet */ - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; ipv6 = 1; /* Read the lookup key (i.e. ip_dst) from the input packet */ - ip_hdr = rte_pktmbuf_mtod(m, struct ipv6_hdr *); + ip_hdr = rte_pktmbuf_mtod(m, struct rte_ipv6_hdr *); /* Find destination port */ if (rte_lpm6_lookup(rxq->lpm6, ip_hdr->dst_addr, diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index 78d590d77..9cc7e32d8 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -636,7 +636,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, next_proto_id), }, /* Source IP address (IPv4) */ @@ -645,7 +645,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv4_hdr, src_addr), + .offset = offsetof(struct rte_ipv4_hdr, src_addr), }, /* Destination IP address (IPv4) */ @@ -654,7 +654,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv4_hdr, dst_addr), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr), }, /* Source Port */ @@ -663,7 +663,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 3, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -673,7 +673,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .size = sizeof(uint16_t), .field_index = 4, .input_index = 3, - .offset = sizeof(struct ipv4_hdr) + + .offset = sizeof(struct rte_ipv4_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; @@ -685,7 +685,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint8_t), .field_index = 0, .input_index = 0, - .offset = offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, proto), }, /* Source IP address (IPv6) */ @@ -694,7 +694,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 1, .input_index = 1, - .offset = offsetof(struct ipv6_hdr, src_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[0]), }, [2] = { @@ -702,7 +702,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 2, .input_index = 2, - .offset = offsetof(struct ipv6_hdr, src_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[4]), }, [3] = { @@ -710,7 +710,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 3, .input_index = 3, - .offset = offsetof(struct ipv6_hdr, src_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[8]), }, [4] = { @@ -718,7 +718,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 4, .input_index = 4, - .offset = offsetof(struct ipv6_hdr, src_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, src_addr[12]), }, /* Destination IP address (IPv6) */ @@ -727,7 +727,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 5, .input_index = 5, - .offset = offsetof(struct ipv6_hdr, dst_addr[0]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[0]), }, [6] = { @@ -735,7 +735,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 6, .input_index = 6, - .offset = offsetof(struct ipv6_hdr, dst_addr[4]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[4]), }, [7] = { @@ -743,7 +743,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 7, .input_index = 7, - .offset = offsetof(struct ipv6_hdr, dst_addr[8]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[8]), }, [8] = { @@ -751,7 +751,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint32_t), .field_index = 8, .input_index = 8, - .offset = offsetof(struct ipv6_hdr, dst_addr[12]), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr[12]), }, /* Source Port */ @@ -760,7 +760,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 9, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, src_port), }, @@ -770,7 +770,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .size = sizeof(uint16_t), .field_index = 10, .input_index = 9, - .offset = sizeof(struct ipv6_hdr) + + .offset = sizeof(struct rte_ipv6_hdr) + offsetof(struct tcp_hdr, dst_port), }, }; diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 7ce52150d..0d5bf0a85 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -324,10 +324,10 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, /* if packet is IPv4 */ if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ip_dst; - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); /* if it is a fragmented packet, then try to reassemble. */ if (rte_ipv4_frag_pkt_is_fragmented(ip_hdr)) { @@ -351,7 +351,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); } } ip_dst = rte_be_to_cpu_32(ip_hdr->dst_addr); @@ -366,9 +366,9 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* if packet is IPv6 */ struct ipv6_extension_fragment *frag_hdr; - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(ip_hdr); @@ -390,7 +390,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue, m = mo; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ip_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); } } diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index d47cdd55c..fd81b6c25 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -341,7 +341,7 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port, /* calculate IPv4 cksum in SW */ if ((pkt->ol_flags & PKT_TX_IP_CKSUM) == 0) - ip->ip_sum = rte_ipv4_cksum((struct ipv4_hdr *)ip); + ip->ip_sum = rte_ipv4_cksum((struct rte_ipv4_hdr *)ip); ethhdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4); } else { diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index c65dbe974..8043ed54a 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -967,7 +967,7 @@ get_spi_proto(uint32_t spi, enum rte_security_ipsec_sa_direction dir) static int fill_ipsec_sa_prm(struct rte_ipsec_sa_prm *prm, const struct ipsec_sa *ss, - const struct ipv4_hdr *v4, struct ipv6_hdr *v6) + const struct rte_ipv4_hdr *v4, struct rte_ipv6_hdr *v6) { int32_t rc; @@ -1038,7 +1038,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) { int rc; struct rte_ipsec_sa_prm prm; - struct ipv4_hdr v4 = { + struct rte_ipv4_hdr v4 = { .version_ihl = IPVERSION << 4 | sizeof(v4) / IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, @@ -1046,7 +1046,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) .src_addr = lsa->src.ip.ip4, .dst_addr = lsa->dst.ip.ip4, }; - struct ipv6_hdr v6 = { + struct rte_ipv6_hdr v6 = { .vtc_flow = htonl(IP6_VERSION << 28), .proto = IPPROTO_ESP, }; diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index adab3217a..a84d28c86 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -297,7 +297,7 @@ static inline void mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) { struct rte_mbuf *mc; - struct ipv4_hdr *iphdr; + struct rte_ipv4_hdr *iphdr; uint32_t dest_addr, port_mask, port_num, use_clone; int32_t hash; uint16_t port; @@ -307,7 +307,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) } dst_eth_addr; /* Remove the Ethernet header from the input packet */ - iphdr = (struct ipv4_hdr *) + iphdr = (struct rte_ipv4_hdr *) rte_pktmbuf_adj(m, (uint16_t)sizeof(struct rte_ether_hdr)); RTE_ASSERT(iphdr != NULL); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 973a371bf..06f5d1db1 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -388,7 +388,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, struct l2fwd_crypto_params *cparams) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; uint32_t ipdata_offset, data_len; uint32_t pad_len = 0; @@ -401,7 +401,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ipdata_offset = sizeof(struct rte_ether_hdr); - ip_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + + ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index f38b3ae6f..16ab0d0fd 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -146,7 +146,7 @@ static struct rte_mempool *pktmbuf_pool[NB_SOCKETS]; /***********************start of ACL part******************************/ #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len); +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len); #endif static inline void send_single_packet(struct rte_mbuf *m, uint16_t port); @@ -174,8 +174,8 @@ send_single_packet(struct rte_mbuf *m, uint16_t port); *d = (unsigned char)(ip & 0xff);\ } while (0) #define OFF_ETHHEAD (sizeof(struct rte_ether_hdr)) -#define OFF_IPV42PROTO (offsetof(struct ipv4_hdr, next_proto_id)) -#define OFF_IPV62PROTO (offsetof(struct ipv6_hdr, proto)) +#define OFF_IPV42PROTO (offsetof(struct rte_ipv4_hdr, next_proto_id)) +#define OFF_IPV62PROTO (offsetof(struct rte_ipv6_hdr, proto)) #define MBUF_IPV4_2PROTO(m) \ rte_pktmbuf_mtod_offset((m), uint8_t *, OFF_ETHHEAD + OFF_IPV42PROTO) #define MBUF_IPV6_2PROTO(m) \ @@ -252,32 +252,32 @@ struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .size = sizeof(uint32_t), .field_index = SRC_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_SRC, - .offset = offsetof(struct ipv4_hdr, src_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, src_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_DST, - .offset = offsetof(struct ipv4_hdr, dst_addr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = offsetof(struct rte_ipv4_hdr, dst_addr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id), + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV4, .input_index = RTE_ACL_IPV4VLAN_PORTS, - .offset = sizeof(struct ipv4_hdr) - - offsetof(struct ipv4_hdr, next_proto_id) + + .offset = sizeof(struct rte_ipv4_hdr) - + offsetof(struct rte_ipv4_hdr, next_proto_id) + sizeof(uint16_t), }, }; @@ -314,80 +314,84 @@ struct rte_acl_field_def ipv6_defs[NUM_FIELDS_IPV6] = { .size = sizeof(uint32_t), .field_index = SRC1_FIELD_IPV6, .input_index = SRC1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC2_FIELD_IPV6, .input_index = SRC2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC3_FIELD_IPV6, .input_index = SRC3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = SRC4_FIELD_IPV6, .input_index = SRC4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, src_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, src_addr) - + offsetof(struct rte_ipv6_hdr, proto) + + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST1_FIELD_IPV6, .input_index = DST1_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) + - offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST2_FIELD_IPV6, .input_index = DST2_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST3_FIELD_IPV6, .input_index = DST3_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 2 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + + 2 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_MASK, .size = sizeof(uint32_t), .field_index = DST4_FIELD_IPV6, .input_index = DST4_FIELD_IPV6, - .offset = offsetof(struct ipv6_hdr, dst_addr) - - offsetof(struct ipv6_hdr, proto) + 3 * sizeof(uint32_t), + .offset = offsetof(struct rte_ipv6_hdr, dst_addr) - + offsetof(struct rte_ipv6_hdr, proto) + + 3 * sizeof(uint32_t), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = SRCP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto), }, { .type = RTE_ACL_FIELD_TYPE_RANGE, .size = sizeof(uint16_t), .field_index = DSTP_FIELD_IPV6, .input_index = SRCP_FIELD_IPV6, - .offset = sizeof(struct ipv6_hdr) - - offsetof(struct ipv6_hdr, proto) + sizeof(uint16_t), + .offset = sizeof(struct rte_ipv6_hdr) - + offsetof(struct rte_ipv6_hdr, proto) + sizeof(uint16_t), }, }; @@ -542,8 +546,8 @@ dump_acl4_rule(struct rte_mbuf *m, uint32_t sig) { uint32_t offset = sig & ~ACL_DENY_SIGNATURE; unsigned char a, b, c, d; - struct ipv4_hdr *ipv4_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + struct rte_ipv4_hdr *ipv4_hdr = + rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); uint32_t_to_char(rte_bswap32(ipv4_hdr->src_addr), &a, &b, &c, &d); @@ -566,8 +570,8 @@ dump_acl6_rule(struct rte_mbuf *m, uint32_t sig) { unsigned i; uint32_t offset = sig & ~ACL_DENY_SIGNATURE; - struct ipv6_hdr *ipv6_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + struct rte_ipv6_hdr *ipv6_hdr = + rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); printf("Packet Src"); @@ -620,11 +624,11 @@ static inline void prepare_one_packet(struct rte_mbuf **pkts_in, struct acl_search_t *acl, int index) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = pkts_in[index]; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Check to make sure the packet is valid (RFC1812) */ @@ -1281,14 +1285,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -1313,7 +1317,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 8a991f5f7..b1da553e9 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -466,14 +466,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -498,7 +498,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -523,7 +523,7 @@ print_ipv6_key(struct ipv6_5tuple key) } static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -538,14 +538,14 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -562,7 +562,7 @@ get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, } static inline uint16_t -get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, +get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; @@ -578,14 +578,14 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + - sizeof(struct ipv6_hdr)); + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -604,7 +604,7 @@ get_ipv6_dst_port(struct ipv6_hdr *ipv6_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint16_t -get_ipv4_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *ipv4_l3fwd_lookup_struct) { uint32_t next_hop; @@ -662,7 +662,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *d_addr_bytes; uint16_t dst_port; @@ -671,7 +671,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ ipv4_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -707,10 +707,10 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH) - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; ipv6_hdr = - rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d9b636806..ebb2378dd 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -314,14 +314,14 @@ send_single_packet(struct rte_mbuf *m, uint16_t port) #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -346,7 +346,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -362,7 +362,7 @@ print_key(struct ipv4_5tuple key) } static inline uint16_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; @@ -377,14 +377,14 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); break; case IPPROTO_UDP: udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); break; @@ -402,7 +402,7 @@ get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, #if (APP_LOOKUP_METHOD == APP_LOOKUP_LPM) static inline uint32_t -get_dst_port(struct ipv4_hdr *ipv4_hdr, uint16_t portid, +get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { uint32_t next_hop; @@ -418,13 +418,13 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; void *tmp; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h index 1893f8c3a..293fb1fa2 100644 --- a/examples/l3fwd/l3fwd.h +++ b/examples/l3fwd/l3fwd.h @@ -130,14 +130,14 @@ send_single_packet(struct lcore_conf *qconf, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -162,7 +162,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index 0c68aa01c..ed9b0b8f2 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -68,14 +68,18 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) *p[2] = te[2]; *p[3] = te[3]; - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), - &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), - &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), - &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), - &dst_port[3], pkt[3]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[0] + 1), + &dst_port[0], pkt[0]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[1] + 1), + &dst_port[1], pkt[1]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[2] + 1), + &dst_port[2], pkt[2]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[3] + 1), + &dst_port[3], pkt[3]->packet_type); } /* @@ -129,7 +133,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = *(vector unsigned int *)eth_hdr; ve = (vector unsigned int)val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); /* dynamically vec_sel te and ve for MASK_ETH (0x3f) */ diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h index 0f4fcb427..7d83ff641 100644 --- a/examples/l3fwd/l3fwd_common.h +++ b/examples/l3fwd/l3fwd_common.h @@ -14,7 +14,7 @@ #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -28,7 +28,7 @@ * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index b56b08646..5cf5f677a 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -252,7 +252,8 @@ em_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv4_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + + offsetof(struct rte_ipv4_hdr, time_to_live); /* * Get 5 tuple: dst port, src port, dst IP address, @@ -273,7 +274,8 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) struct rte_hash *ipv6_l3fwd_lookup_struct = (struct rte_hash *)lookup_struct; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + + offsetof(struct rte_ipv6_hdr, payload_len); void *data0 = ipv6_hdr; void *data1 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t); void *data2 = ((uint8_t *)ipv6_hdr) + sizeof(xmm_t) + sizeof(xmm_t); @@ -566,17 +568,17 @@ em_parse_ptype(struct rte_mbuf *m) uint16_t ether_type; void *l3; int hdr_len; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; 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(RTE_ETHER_TYPE_IPv4)) { - ipv4_hdr = (struct ipv4_hdr *)l3; + ipv4_hdr = (struct rte_ipv4_hdr *)l3; hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * IPV4_IHL_MULTIPLIER; - if (hdr_len == sizeof(struct ipv4_hdr)) { + if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) packet_type |= RTE_PTYPE_L4_TCP; @@ -585,7 +587,7 @@ em_parse_ptype(struct rte_mbuf *m) } else packet_type |= RTE_PTYPE_L3_IPV4_EXT; } else if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv6)) { - ipv6_hdr = (struct ipv6_hdr *)l3; + ipv6_hdr = (struct rte_ipv6_hdr *)l3; if (ipv6_hdr->proto == IPPROTO_TCP) packet_type |= RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_TCP; else if (ipv6_hdr->proto == IPPROTO_UDP) diff --git a/examples/l3fwd/l3fwd_em.h b/examples/l3fwd/l3fwd_em.h index e787691e1..090c1b448 100644 --- a/examples/l3fwd/l3fwd_em.h +++ b/examples/l3fwd/l3fwd_em.h @@ -10,7 +10,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -21,7 +21,7 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -53,9 +53,9 @@ l3fwd_em_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index ec52a011f..ad8b9ce87 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -80,8 +80,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint16_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -91,7 +91,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -106,7 +106,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_em_hlm_neon.h b/examples/l3fwd/l3fwd_em_hlm_neon.h index 3ee2304b5..8aa1c32db 100644 --- a/examples/l3fwd/l3fwd_em_hlm_neon.h +++ b/examples/l3fwd/l3fwd_em_hlm_neon.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, int32x4_t mask0, { int32x4_t tmpdata0 = vld1q_s32(rte_pktmbuf_mtod_offset(m0, int32_t *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = vandq_s32(tmpdata0, mask0); } @@ -26,17 +26,17 @@ get_ipv6_5tuple(struct rte_mbuf *m0, int32x4_t mask0, int32x4_t tmpdata0 = vld1q_s32( rte_pktmbuf_mtod_offset(m0, int *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); int32x4_t tmpdata1 = vld1q_s32( - rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 8)); + rte_pktmbuf_mtod_offset(m0, int *, + sizeof(struct rte_ether_hdr) + + offsetof(struct rte_ipv6_hdr, payload_len) + 8)); int32x4_t tmpdata2 = vld1q_s32( - rte_pktmbuf_mtod_offset(m0, int *, - sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + 16)); + rte_pktmbuf_mtod_offset(m0, int *, + sizeof(struct rte_ether_hdr) + + offsetof(struct rte_ipv6_hdr, payload_len) + 16)); key->xmm[0] = vandq_s32(tmpdata0, mask0); key->xmm[1] = tmpdata1; diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h index 8156bbb90..7964a9277 100644 --- a/examples/l3fwd/l3fwd_em_hlm_sse.h +++ b/examples/l3fwd/l3fwd_em_hlm_sse.h @@ -14,7 +14,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key->xmm = _mm_and_si128(tmpdata0, mask0); } @@ -26,18 +26,18 @@ get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, __m128i tmpdata0 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128( rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + + offsetof(struct rte_ipv6_hdr, payload_len) + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 770660e99..23fe9dec8 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -25,8 +25,8 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { uint8_t next_hop; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint32_t tcp_or_udp; uint32_t l3_ptypes; @@ -36,7 +36,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV4)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv4_dst_port(ipv4_hdr, portid, @@ -51,7 +51,7 @@ em_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (tcp_or_udp && (l3_ptypes == RTE_PTYPE_L3_IPV6)) { /* Handle IPv6 headers.*/ - ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); next_hop = em_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index eaa47aaa3..5fa8c5380 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -86,7 +86,7 @@ lpm_get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm *)lookup_struct; return (uint16_t) ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -98,7 +98,7 @@ lpm_get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, void *lookup_struct) (struct rte_lpm6 *)lookup_struct; return (uint16_t) ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? next_hop : portid); } @@ -106,21 +106,21 @@ static __rte_always_inline uint16_t lpm_get_dst_port(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint16_t portid) { - struct ipv6_hdr *ipv6_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); return lpm_get_ipv4_dst_port(ipv4_hdr, portid, qconf->ipv4_lookup_struct); } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return lpm_get_ipv6_dst_port(ipv6_hdr, portid, qconf->ipv6_lookup_struct); @@ -139,7 +139,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -150,7 +150,7 @@ lpm_get_dst_port_with_ipv4(const struct lcore_conf *qconf, struct rte_mbuf *pkt, } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup(qconf->ipv6_lookup_struct, ipv6_hdr->dst_addr, &next_hop) == 0) diff --git a/examples/l3fwd/l3fwd_lpm.h b/examples/l3fwd/l3fwd_lpm.h index 950cde32a..d730d72a2 100644 --- a/examples/l3fwd/l3fwd_lpm.h +++ b/examples/l3fwd/l3fwd_lpm.h @@ -10,14 +10,14 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, struct lcore_conf *qconf) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -49,9 +49,9 @@ l3fwd_lpm_simple_forward(struct rte_mbuf *m, uint16_t portid, send_single_packet(qconf, m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = lpm_get_ipv6_dst_port(ipv6_hdr, portid, diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index b36e991ac..7c6814252 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -17,30 +17,30 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], vector unsigned int *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; rte_compiler_barrier(); eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index a3e42cfa7..d6c0ba64a 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -18,27 +18,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], int32x4_t *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; int32_t dst[FWDSTEP]; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[0] = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[1] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[2] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst[3] = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index 4603e0749..3f637a23d 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -15,27 +15,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index af2dc47ac..86ac5971d 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -48,14 +48,18 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) vst1q_u32(p[2], ve[2]); vst1q_u32(p[3], ve[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), - &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), - &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), - &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), - &dst_port[3], pkt[3]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[0] + 1), + &dst_port[0], pkt[0]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[1] + 1), + &dst_port[1], pkt[1]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[2] + 1), + &dst_port[2], pkt[2]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[3] + 1), + &dst_port[3], pkt[3]->packet_type); } /* @@ -113,7 +117,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) ve = vreinterpretq_u32_s32(val_eth[dst_port[0]]); - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); ve = vcopyq_laneq_u32(ve, 3, te, 3); diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index 3349f2747..bb565ed54 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -48,14 +48,18 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_storeu_si128(p[2], te[2]); _mm_storeu_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), - &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), - &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), - &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), - &dst_port[3], pkt[3]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[0] + 1), + &dst_port[0], pkt[0]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[1] + 1), + &dst_port[1], pkt[1]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[2] + 1), + &dst_port[2], pkt[2]->packet_type); + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[3] + 1), + &dst_port[3], pkt[3]->packet_type); } /* @@ -109,7 +113,7 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) te = _mm_loadu_si128((__m128i *)eth_hdr); ve = val_eth[dst_port[0]]; - rfc1812_process((struct ipv4_hdr *)(eth_hdr + 1), dst_port, + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), dst_port, pkt->packet_type); te = _mm_blend_epi16(te, ve, MASK_ETH); diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c index f39681d72..f0aad1513 100644 --- a/examples/load_balancer/runtime.c +++ b/examples/load_balancer/runtime.c @@ -495,7 +495,7 @@ app_lcore_worker( for (j = 0; j < bsz_rd; j ++) { struct rte_mbuf *pkt; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst, pos; uint32_t port; @@ -508,7 +508,7 @@ app_lcore_worker( pkt = lp->mbuf_in.array[j]; ipv4_hdr = rte_pktmbuf_mtod_offset( - pkt, struct ipv4_hdr *, + pkt, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 46275e79a..a909f35cd 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -751,14 +751,14 @@ send_packetsx4(uint16_t port, #ifdef DO_RFC_1812_CHECKS static inline int -is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) +is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt, uint32_t link_len) { /* From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2 */ /* * 1. The packet length reported by the Link Layer must be large * enough to hold the minimum length legal IP datagram (20 bytes). */ - if (link_len < sizeof(struct ipv4_hdr)) + if (link_len < sizeof(struct rte_ipv4_hdr)) return -1; /* 2. The IP checksum must be correct. */ @@ -783,7 +783,7 @@ is_valid_ipv4_pkt(struct ipv4_hdr *pkt, uint32_t link_len) * datagram header, whose length is specified in the IP header length * field. */ - if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct ipv4_hdr)) + if (rte_cpu_to_be_16(pkt->total_length) < sizeof(struct rte_ipv4_hdr)) return -5; return 0; @@ -802,7 +802,8 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, int ret = 0; union ipv4_5tuple_host key; - ipv4_hdr = (uint8_t *)ipv4_hdr + offsetof(struct ipv4_hdr, time_to_live); + ipv4_hdr = (uint8_t *)ipv4_hdr + + offsetof(struct rte_ipv4_hdr, time_to_live); __m128i data = _mm_loadu_si128((__m128i *)(ipv4_hdr)); /* Get 5 tuple: dst port, src port, dst IP address, src IP address and protocol */ @@ -819,7 +820,8 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, int ret = 0; union ipv6_5tuple_host key; - ipv6_hdr = (uint8_t *)ipv6_hdr + offsetof(struct ipv6_hdr, payload_len); + ipv6_hdr = (uint8_t *)ipv6_hdr + + offsetof(struct rte_ipv6_hdr, payload_len); __m128i data0 = _mm_loadu_si128((__m128i *)(ipv6_hdr)); __m128i data1 = _mm_loadu_si128((__m128i *)(((uint8_t *)ipv6_hdr) + sizeof(__m128i))); @@ -849,7 +851,7 @@ get_ipv4_dst_port(void *ipv4_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, - rte_be_to_cpu_32(((struct ipv4_hdr *)ipv4_hdr)->dst_addr), + rte_be_to_cpu_32(((struct rte_ipv4_hdr *)ipv4_hdr)->dst_addr), &next_hop) == 0) ? next_hop : portid); } @@ -860,8 +862,8 @@ get_ipv6_dst_port(void *ipv6_hdr, uint16_t portid, uint32_t next_hop; return ((rte_lpm6_lookup(ipv6_l3fwd_lookup_struct, - ((struct ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? - next_hop : portid); + ((struct rte_ipv6_hdr *)ipv6_hdr)->dst_addr, &next_hop) == 0) ? + next_hop : portid); } #endif @@ -885,7 +887,7 @@ static inline void simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) { struct rte_ether_hdr *eth_hdr[8]; - struct ipv4_hdr *ipv4_hdr[8]; + struct rte_ipv4_hdr *ipv4_hdr[8]; uint16_t dst_port[8]; int32_t ret[8]; union ipv4_5tuple_host key[8]; @@ -901,21 +903,21 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv4 headers.*/ - ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv4_hdr *, + ipv4_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv4_hdr *, + ipv4_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv4_hdr *, + ipv4_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv4_hdr *, + ipv4_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv4_hdr *, + ipv4_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv4_hdr *, + ipv4_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv4_hdr *, + ipv4_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); - ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv4_hdr *, + ipv4_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -968,28 +970,28 @@ simple_ipv4_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) data[0] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[0], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[1] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[1], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[2] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[2], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[3] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[3], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[4] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[4], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[5] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[5], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[6] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[6], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); data[7] = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m[7], __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv4_hdr, time_to_live))); + offsetof(struct rte_ipv4_hdr, time_to_live))); key[0].xmm = _mm_and_si128(data[0], mask0); key[1].xmm = _mm_and_si128(data[1], mask0); @@ -1095,14 +1097,15 @@ static inline void get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0, { __m128i tmpdata0 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len))); + offsetof(struct rte_ipv6_hdr, payload_len))); __m128i tmpdata1 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i))); + offsetof(struct rte_ipv6_hdr, payload_len) + + sizeof(__m128i))); __m128i tmpdata2 = _mm_loadu_si128(rte_pktmbuf_mtod_offset(m0, __m128i *, sizeof(struct rte_ether_hdr) + - offsetof(struct ipv6_hdr, payload_len) + sizeof(__m128i) + - sizeof(__m128i))); + offsetof(struct rte_ipv6_hdr, payload_len) + + sizeof(__m128i) + sizeof(__m128i))); key->xmm[0] = _mm_and_si128(tmpdata0, mask0); key->xmm[1] = tmpdata1; key->xmm[2] = _mm_and_si128(tmpdata2, mask1); @@ -1116,7 +1119,7 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) struct rte_ether_hdr *eth_hdr[8]; union ipv6_5tuple_host key[8]; - __attribute__((unused)) struct ipv6_hdr *ipv6_hdr[8]; + __attribute__((unused)) struct rte_ipv6_hdr *ipv6_hdr[8]; eth_hdr[0] = rte_pktmbuf_mtod(m[0], struct rte_ether_hdr *); eth_hdr[1] = rte_pktmbuf_mtod(m[1], struct rte_ether_hdr *); @@ -1128,21 +1131,21 @@ simple_ipv6_fwd_8pkts(struct rte_mbuf *m[8], uint16_t portid) eth_hdr[7] = rte_pktmbuf_mtod(m[7], struct rte_ether_hdr *); /* Handle IPv6 headers.*/ - ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct ipv6_hdr *, + ipv6_hdr[0] = rte_pktmbuf_mtod_offset(m[0], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct ipv6_hdr *, + ipv6_hdr[1] = rte_pktmbuf_mtod_offset(m[1], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct ipv6_hdr *, + ipv6_hdr[2] = rte_pktmbuf_mtod_offset(m[2], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct ipv6_hdr *, + ipv6_hdr[3] = rte_pktmbuf_mtod_offset(m[3], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct ipv6_hdr *, + ipv6_hdr[4] = rte_pktmbuf_mtod_offset(m[4], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct ipv6_hdr *, + ipv6_hdr[5] = rte_pktmbuf_mtod_offset(m[5], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct ipv6_hdr *, + ipv6_hdr[6] = rte_pktmbuf_mtod_offset(m[6], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); - ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct ipv6_hdr *, + ipv6_hdr[7] = rte_pktmbuf_mtod_offset(m[7], struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); get_ipv6_5tuple(m[0], mask1, mask2, &key[0]); @@ -1229,14 +1232,14 @@ static __rte_always_inline void l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t dst_port; eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); #ifdef DO_RFC_1812_CHECKS @@ -1268,9 +1271,9 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) send_single_packet(m, dst_port); } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { /* Handle IPv6 headers.*/ - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, + ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); dst_port = get_ipv6_dst_port(ipv6_hdr, portid, @@ -1302,7 +1305,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) #define IPV4_MAX_VER_IHL_DIFF (IPV4_MAX_VER_IHL - IPV4_MIN_VER_IHL) /* Minimum value of IPV4 total length (20B) in network byte order. */ -#define IPV4_MIN_LEN_BE (sizeof(struct ipv4_hdr) << 8) +#define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: @@ -1316,7 +1319,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint16_t portid) * to BAD_PORT value. */ static __rte_always_inline void -rfc1812_process(struct ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) +rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) { uint8_t ihl; @@ -1347,7 +1350,7 @@ static __rte_always_inline uint16_t get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) { uint32_t next_hop; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct rte_ether_hdr *eth_hdr; if (RTE_ETH_IS_IPV4_HDR(pkt->packet_type)) { @@ -1358,7 +1361,7 @@ get_dst_port(struct rte_mbuf *pkt, uint32_t dst_ipv4, uint16_t portid) } else if (RTE_ETH_IS_IPV6_HDR(pkt->packet_type)) { eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); return (uint16_t) ((rte_lpm6_lookup( RTE_PER_LCORE(lcore_conf)->ipv6_lookup_struct, @@ -1374,13 +1377,13 @@ static inline void process_packet(struct rte_mbuf *pkt, uint16_t *dst_port, uint16_t portid) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t dst_ipv4; uint16_t dp; __m128i te, ve; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); dst_ipv4 = ipv4_hdr->dst_addr; dst_ipv4 = rte_be_to_cpu_32(dst_ipv4); @@ -1404,27 +1407,27 @@ processx4_step1(struct rte_mbuf *pkt[FWDSTEP], __m128i *dip, uint32_t *ipv4_flag) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_ether_hdr *eth_hdr; uint32_t x0, x1, x2, x3; eth_hdr = rte_pktmbuf_mtod(pkt[0], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x0 = ipv4_hdr->dst_addr; ipv4_flag[0] = pkt[0]->packet_type & RTE_PTYPE_L3_IPV4; eth_hdr = rte_pktmbuf_mtod(pkt[1], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x1 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[1]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[2], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x2 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[2]->packet_type; eth_hdr = rte_pktmbuf_mtod(pkt[3], struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); x3 = ipv4_hdr->dst_addr; ipv4_flag[0] &= pkt[3]->packet_type; @@ -1505,13 +1508,17 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) _mm_store_si128(p[2], te[2]); _mm_store_si128(p[3], te[3]); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[0] + 1), + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[0] + 1), &dst_port[0], pkt[0]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[1] + 1), + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[1] + 1), &dst_port[1], pkt[1]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[2] + 1), + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[2] + 1), &dst_port[2], pkt[2]->packet_type); - rfc1812_process((struct ipv4_hdr *)((struct rte_ether_hdr *)p[3] + 1), + rfc1812_process((struct rte_ipv4_hdr *) + ((struct rte_ether_hdr *)p[3] + 1), &dst_port[3], pkt[3]->packet_type); } diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c index 8bec351ec..67a55808b 100644 --- a/examples/server_node_efd/node/node.c +++ b/examples/server_node_efd/node/node.c @@ -266,7 +266,7 @@ transmit_packet(struct rte_mbuf *buf) static inline void handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[PKT_READ_SIZE]; const void *key_ptrs[PKT_READ_SIZE]; unsigned int i; @@ -274,8 +274,8 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) for (i = 0; i < num_packets; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], struct ipv4_hdr *, - sizeof(struct rte_ether_hdr)); + ipv4_hdr = rte_pktmbuf_mtod_offset(bufs[i], + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = &ipv4_dst_ip[i]; } diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c index a086c5a77..7b4657e42 100644 --- a/examples/server_node_efd/server/main.c +++ b/examples/server_node_efd/server/main.c @@ -247,13 +247,13 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[], efd_value_t data[RTE_EFD_BURST_MAX]; const void *key_ptrs[RTE_EFD_BURST_MAX]; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint32_t ipv4_dst_ip[RTE_EFD_BURST_MAX]; for (i = 0; i < rx_count; i++) { /* Handle IPv4 header.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], struct ipv4_hdr *, - sizeof(struct rte_ether_hdr)); + ipv4_hdr = rte_pktmbuf_mtod_offset(pkts[i], + struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ipv4_dst_ip[i] = ipv4_hdr->dst_addr; key_ptrs[i] = (void *)&ipv4_dst_ip[i]; } diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index cc171fbbc..084b06e19 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -31,8 +31,8 @@ static void parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, uint8_t *l4_proto) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; uint16_t ethertype; info->outer_l2_len = sizeof(struct rte_ether_hdr); @@ -47,15 +47,15 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, union tunnel_offload_info *info, switch (ethertype) { case RTE_ETHER_TYPE_IPv4: - ipv4_hdr = (struct ipv4_hdr *) + ipv4_hdr = (struct rte_ipv4_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv4_hdr); + info->outer_l3_len = sizeof(struct rte_ipv4_hdr); *l4_proto = ipv4_hdr->next_proto_id; break; case RTE_ETHER_TYPE_IPv6: - ipv6_hdr = (struct ipv6_hdr *) + ipv6_hdr = (struct rte_ipv6_hdr *) ((char *)eth_hdr + info->outer_l2_len); - info->outer_l3_len = sizeof(struct ipv6_hdr); + info->outer_l3_len = sizeof(struct rte_ipv6_hdr); *l4_proto = ipv6_hdr->proto; break; default: @@ -75,8 +75,8 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, void *l3_hdr = NULL; uint8_t l4_proto; uint16_t ethertype; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; struct sctp_hdr *sctp_hdr; @@ -95,15 +95,15 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, l3_hdr = (char *)eth_hdr + info->l2_len; if (ethertype == RTE_ETHER_TYPE_IPv4) { - ipv4_hdr = (struct ipv4_hdr *)l3_hdr; + ipv4_hdr = (struct rte_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); + info->l3_len = sizeof(struct rte_ipv4_hdr); l4_proto = ipv4_hdr->next_proto_id; } else if (ethertype == RTE_ETHER_TYPE_IPv6) { - ipv6_hdr = (struct ipv6_hdr *)l3_hdr; - info->l3_len = sizeof(struct ipv6_hdr); + ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; + info->l3_len = sizeof(struct rte_ipv6_hdr); l4_proto = ipv6_hdr->proto; ol_flags |= PKT_TX_IPV6; } else @@ -182,10 +182,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*Allocate space for new ethernet, IPv4, UDP and VXLAN headers*/ struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, - sizeof(struct rte_ether_hdr) + sizeof(struct ipv4_hdr) + sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); - struct ipv4_hdr *ip = (struct ipv4_hdr *) &pneth[1]; + struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; @@ -198,7 +198,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /* copy in IP header */ ip = rte_memcpy(ip, &app_ip_hdr[vport_id], - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ip->total_length = rte_cpu_to_be_16(m->pkt_len - sizeof(struct rte_ether_hdr)); @@ -216,7 +216,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) } m->outer_l2_len = sizeof(struct rte_ether_hdr); - m->outer_l3_len = sizeof(struct ipv4_hdr); + m->outer_l3_len = sizeof(struct rte_ipv4_hdr); ol_flags |= PKT_TX_TUNNEL_VXLAN; diff --git a/examples/tep_termination/vxlan.h b/examples/tep_termination/vxlan.h index 780ae73cc..689aea451 100644 --- a/examples/tep_termination/vxlan.h +++ b/examples/tep_termination/vxlan.h @@ -16,7 +16,7 @@ #define VXLAN_HF_VNI 0x08000000 #define DEFAULT_VXLAN_PORT 4789 -extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +extern struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; extern uint8_t tx_checksum; extern uint16_t tso_segsz; diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 2237c7559..ce7c2e5a4 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -48,7 +48,7 @@ /* VXLAN device */ struct vxlan_conf vxdev; -struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; +struct rte_ipv4_hdr app_ip_hdr[VXLAN_N_PORTS]; struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS]; /* local VTEP IP address */ @@ -229,7 +229,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m) int i, ret; struct rte_ether_hdr *pkt_hdr; uint64_t portid = vdev->vid; - struct ipv4_hdr *ip; + struct rte_ipv4_hdr *ip; struct rte_eth_tunnel_filter_conf tunnel_filter_conf; diff --git a/examples/vhost/main.c b/examples/vhost/main.c index d7b34b3d4..c6a6531e5 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -865,7 +865,7 @@ get_psd_sum(void *l3_hdr, uint64_t ol_flags) static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; - struct ipv4_hdr *ipv4_hdr = NULL; + struct rte_ipv4_hdr *ipv4_hdr = NULL; struct tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 5f52359b1..e2b441f24 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -628,7 +628,7 @@ static const struct rte_flow_item_vlan rte_flow_item_vlan_mask = { * Note: IPv4 options are handled by dedicated pattern items. */ struct rte_flow_item_ipv4 { - struct ipv4_hdr hdr; /**< IPv4 header definition. */ + struct rte_ipv4_hdr hdr; /**< IPv4 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV4. */ @@ -650,7 +650,7 @@ static const struct rte_flow_item_ipv4 rte_flow_item_ipv4_mask = { * RTE_FLOW_ITEM_TYPE_IPV6_EXT. */ struct rte_flow_item_ipv6 { - struct ipv6_hdr hdr; /**< IPv6 header definition. */ + struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */ diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c index e01d61b24..94e85470d 100644 --- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c +++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c @@ -611,8 +611,8 @@ rxa_calc_wrr_sequence(struct rte_event_eth_rx_adapter *rx_adapter, } static inline void -rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, - struct ipv6_hdr **ipv6_hdr) +rxa_mtoip(struct rte_mbuf *m, struct rte_ipv4_hdr **ipv4_hdr, + struct rte_ipv6_hdr **ipv6_hdr) { struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); @@ -623,21 +623,21 @@ rxa_mtoip(struct rte_mbuf *m, struct ipv4_hdr **ipv4_hdr, switch (eth_hdr->ether_type) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(eth_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(eth_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_VLAN): vlan_hdr = (struct rte_vlan_hdr *)(eth_hdr + 1); switch (vlan_hdr->eth_proto) { case RTE_BE16(RTE_ETHER_TYPE_IPv4): - *ipv4_hdr = (struct ipv4_hdr *)(vlan_hdr + 1); + *ipv4_hdr = (struct rte_ipv4_hdr *)(vlan_hdr + 1); break; case RTE_BE16(RTE_ETHER_TYPE_IPv6): - *ipv6_hdr = (struct ipv6_hdr *)(vlan_hdr + 1); + *ipv6_hdr = (struct rte_ipv6_hdr *)(vlan_hdr + 1); break; default: break; @@ -657,8 +657,8 @@ rxa_do_softrss(struct rte_mbuf *m, const uint8_t *rss_key_be) void *tuple; struct rte_ipv4_tuple ipv4_tuple; struct rte_ipv6_tuple ipv6_tuple; - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; rxa_mtoip(m, &ipv4_hdr, &ipv6_hdr); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 99c9c7d91..c37b4ef3e 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -180,10 +180,10 @@ insert_new_flow(struct gro_tcp4_tbl *tbl, static inline void update_header(struct gro_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct rte_mbuf *pkt = item->firstseg; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - pkt->l2_len); @@ -195,7 +195,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *eth_hdr; - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; @@ -216,7 +216,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, return -1; eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index ce3471a4d..0a42a1ae8 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -269,11 +269,11 @@ check_seq_option(struct gro_tcp4_item *item, uint8_t is_atomic) { struct rte_mbuf *pkt_orig = item->firstseg; - struct ipv4_hdr *iph_orig; + struct rte_ipv4_hdr *iph_orig; struct tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; - iph_orig = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + + iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 350793b69..8e2a1dd5e 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -263,14 +263,14 @@ merge_two_vxlan_tcp4_packets(struct gro_vxlan_tcp4_item *item, static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; /* Update the outer IPv4 header. */ len = pkt->pkt_len - pkt->outer_l2_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->outer_l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); @@ -281,7 +281,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the inner IPv4 header. */ len -= pkt->l2_len; - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); ipv4_hdr->total_length = rte_cpu_to_be_16(len); } @@ -291,7 +291,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, uint64_t start_time) { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; - struct ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; + struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; @@ -315,7 +315,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, return -1; outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); - outer_ipv4_hdr = (struct ipv4_hdr *)((char *)outer_eth_hdr + + outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); @@ -323,7 +323,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, sizeof(struct udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); - ipv4_hdr = (struct ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); + ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index b6ff1b886..5f2adc833 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -98,9 +98,9 @@ update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, static inline void update_ipv4_header(struct rte_mbuf *pkt, uint16_t l3_offset, uint16_t id) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l3_offset); ipv4_hdr->total_length = rte_cpu_to_be_16(pkt->pkt_len - l3_offset); ipv4_hdr->packet_id = rte_cpu_to_be_16(id); diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index fbd95f8f6..ad0cce6f9 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -9,14 +9,14 @@ static void update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; uint16_t l4_offset = l3_offset + pkt->l3_len; - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -40,13 +40,13 @@ gso_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index d39b46863..f5a19bc43 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -9,7 +9,7 @@ static void update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; struct tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; @@ -23,12 +23,12 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, tcp_offset = inner_ipv4_offset + pkt->l3_len; /* Outer IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + outer_ipv4_offset); outer_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); /* Inner IPv4 header. */ - ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); @@ -60,12 +60,12 @@ gso_tunnel_tcp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *inner_ipv4_hdr; + struct rte_ipv4_hdr *inner_ipv4_hdr; uint16_t pyld_unit_size, hdr_offset, frag_off; int ret = 1; hdr_offset = pkt->outer_l2_len + pkt->outer_l3_len + pkt->l2_len; - inner_ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + inner_ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + hdr_offset); /* * Don't process the packet whose MF bit or offset in the inner diff --git a/lib/librte_gso/gso_udp4.c b/lib/librte_gso/gso_udp4.c index 927dee121..21fea0927 100644 --- a/lib/librte_gso/gso_udp4.c +++ b/lib/librte_gso/gso_udp4.c @@ -11,7 +11,7 @@ static inline void update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, uint16_t nb_segs) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t frag_offset = 0, is_mf; uint16_t l2_hdrlen = pkt->l2_len, l3_hdrlen = pkt->l3_len; uint16_t tail_idx = nb_segs - 1, length, i; @@ -22,8 +22,8 @@ update_ipv4_udp_headers(struct rte_mbuf *pkt, struct rte_mbuf **segs, * length. */ for (i = 0; i < nb_segs; i++) { - ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], struct ipv4_hdr *, - l2_hdrlen); + ipv4_hdr = rte_pktmbuf_mtod_offset(segs[i], + struct rte_ipv4_hdr *, l2_hdrlen); length = segs[i]->pkt_len - l2_hdrlen; ipv4_hdr->total_length = rte_cpu_to_be_16(length); @@ -42,13 +42,13 @@ gso_udp4_segment(struct rte_mbuf *pkt, struct rte_mbuf **pkts_out, uint16_t nb_pkts_out) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; uint16_t pyld_unit_size, hdr_offset; uint16_t frag_off; int ret; /* Don't process the fragmented packet */ - ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, pkt->l2_len); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); if (unlikely(IS_FRAGMENTED(frag_off))) { diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 433f2c8bb..ee879968c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,11 +19,11 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_hash/rte_thash.h b/lib/librte_hash/rte_thash.h index 1b33f4813..b4aaabe3d 100644 --- a/lib/librte_hash/rte_thash.h +++ b/lib/librte_hash/rte_thash.h @@ -139,7 +139,8 @@ rte_convert_rss_key(const uint32_t *orig, uint32_t *targ, int len) * Pointer to rte_ipv6_tuple structure */ static inline void -rte_thash_load_v6_addrs(const struct ipv6_hdr *orig, union rte_thash_tuple *targ) +rte_thash_load_v6_addrs(const struct rte_ipv6_hdr *orig, + union rte_thash_tuple *targ) { #ifdef RTE_ARCH_X86 __m128i ipv6 = _mm_loadu_si128((const __m128i *)orig->src_addr); diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index bc4c100f3..0d9bf94b8 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -219,7 +219,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr); /** @@ -234,7 +234,7 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * present. */ static inline struct ipv6_extension_fragment * -rte_ipv6_frag_get_ipv6_fragment_header(struct ipv6_hdr *hdr) +rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr) { if (hdr->proto == IPPROTO_FRAGMENT) { return (struct ipv6_extension_fragment *) ++hdr; @@ -293,7 +293,7 @@ int32_t rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, */ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, - struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr); + struct rte_mbuf *mb, uint64_t tms, struct rte_ipv4_hdr *ip_hdr); /** * Check if the IPv4 packet is fragmented @@ -304,7 +304,8 @@ struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, * 1 if fragmented, 0 if not fragmented */ static inline int -rte_ipv4_frag_pkt_is_fragmented(const struct ipv4_hdr * hdr) { +rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr *hdr) +{ uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index a96fb03e4..4707119b5 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -21,8 +21,8 @@ #define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) -static inline void __fill_ipv4hdr_frag(struct ipv4_hdr *dst, - const struct ipv4_hdr *src, uint16_t len, uint16_t fofs, +static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, + const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); @@ -70,7 +70,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv4_hdr *in_hdr; + struct rte_ipv4_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, flag_offset, frag_size; @@ -80,10 +80,10 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, * Ensure the IP payload length of all fragments is aligned to a * multiple of 8 bytes as per RFC791 section 2.3. */ - frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct ipv4_hdr)), + frag_size = RTE_ALIGN_FLOOR((mtu_size - sizeof(struct rte_ipv4_hdr)), IPV4_HDR_FO_ALIGN); - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv4_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv4_hdr *); flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset); /* If Don't Fragment flag is set */ @@ -92,11 +92,11 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Check that pkts_out is big enough to hold all fragments */ if (unlikely(frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv4_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof(struct rte_ipv4_hdr)))) return -EINVAL; in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv4_hdr); + in_seg_data_pos = sizeof(struct rte_ipv4_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -104,7 +104,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv4_hdr *out_hdr; + struct rte_ipv4_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -114,8 +114,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv4_hdr); - out_pkt->pkt_len = sizeof(struct ipv4_hdr); + out_pkt->data_len = sizeof(struct rte_ipv4_hdr); + out_pkt->pkt_len = sizeof(struct rte_ipv4_hdr); frag_bytes_remaining = frag_size; out_seg_prev = out_pkt; @@ -164,17 +164,17 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv4_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv4_hdr *); __fill_ipv4hdr_frag(out_hdr, in_hdr, (uint16_t)out_pkt->pkt_len, flag_offset, fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv4_hdr)); + out_pkt->pkt_len - sizeof(struct rte_ipv4_hdr)); out_pkt->ol_flags |= PKT_TX_IP_CKSUM; - out_pkt->l3_len = sizeof(struct ipv4_hdr); + out_pkt->l3_len = sizeof(struct rte_ipv4_hdr); /* Write the fragment to the output list */ pkts_out[out_pkt_pos] = out_pkt; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 1029b7abc..97da607ed 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -14,7 +14,7 @@ struct rte_mbuf * ipv4_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv4_hdr *ip_hdr; + struct rte_ipv4_hdr *ip_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; uint32_t curr_idx = 0; @@ -70,7 +70,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv4 header for the reassembled packet */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, m->l2_len); ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); @@ -100,7 +100,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv4_hdr *ip_hdr) + struct rte_ipv4_hdr *ip_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c index b9437eb11..bfe44d435 100644 --- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c @@ -18,8 +18,8 @@ */ static inline void -__fill_ipv6hdr_frag(struct ipv6_hdr *dst, - const struct ipv6_hdr *src, uint16_t len, uint16_t fofs, +__fill_ipv6hdr_frag(struct rte_ipv6_hdr *dst, + const struct rte_ipv6_hdr *src, uint16_t len, uint16_t fofs, uint32_t mf) { struct ipv6_extension_fragment *fh; @@ -73,7 +73,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, struct rte_mempool *pool_indirect) { struct rte_mbuf *in_seg = NULL; - struct ipv6_hdr *in_hdr; + struct rte_ipv6_hdr *in_hdr; uint32_t out_pkt_pos, in_seg_data_pos; uint32_t more_in_segs; uint16_t fragment_offset, frag_size; @@ -83,18 +83,18 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, * Ensure the IP payload length of all fragments (except the * the last fragment) are a multiple of 8 bytes per RFC2460. */ - frag_size = RTE_ALIGN_FLOOR(mtu_size - sizeof(struct ipv6_hdr), + frag_size = RTE_ALIGN_FLOOR(mtu_size - sizeof(struct rte_ipv6_hdr), RTE_IPV6_EHDR_FO_ALIGN); /* Check that pkts_out is big enough to hold all fragments */ if (unlikely (frag_size * nb_pkts_out < - (uint16_t)(pkt_in->pkt_len - sizeof (struct ipv6_hdr)))) + (uint16_t)(pkt_in->pkt_len - sizeof(struct rte_ipv6_hdr)))) return -EINVAL; - in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv6_hdr *); + in_hdr = rte_pktmbuf_mtod(pkt_in, struct rte_ipv6_hdr *); in_seg = pkt_in; - in_seg_data_pos = sizeof(struct ipv6_hdr); + in_seg_data_pos = sizeof(struct rte_ipv6_hdr); out_pkt_pos = 0; fragment_offset = 0; @@ -102,7 +102,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, while (likely(more_in_segs)) { struct rte_mbuf *out_pkt = NULL, *out_seg_prev = NULL; uint32_t more_out_segs; - struct ipv6_hdr *out_hdr; + struct rte_ipv6_hdr *out_hdr; /* Allocate direct buffer */ out_pkt = rte_pktmbuf_alloc(pool_direct); @@ -112,8 +112,10 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, } /* Reserve space for the IP header that will be built later */ - out_pkt->data_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); - out_pkt->pkt_len = sizeof(struct ipv6_hdr) + sizeof(struct ipv6_extension_fragment); + out_pkt->data_len = sizeof(struct rte_ipv6_hdr) + + sizeof(struct ipv6_extension_fragment); + out_pkt->pkt_len = sizeof(struct rte_ipv6_hdr) + + sizeof(struct ipv6_extension_fragment); frag_bytes_remaining = frag_size; out_seg_prev = out_pkt; @@ -163,14 +165,14 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, /* Build the IP header */ - out_hdr = rte_pktmbuf_mtod(out_pkt, struct ipv6_hdr *); + out_hdr = rte_pktmbuf_mtod(out_pkt, struct rte_ipv6_hdr *); __fill_ipv6hdr_frag(out_hdr, in_hdr, - (uint16_t) out_pkt->pkt_len - sizeof(struct ipv6_hdr), + (uint16_t) out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr), fragment_offset, more_in_segs); fragment_offset = (uint16_t)(fragment_offset + - out_pkt->pkt_len - sizeof(struct ipv6_hdr) + out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr) - sizeof(struct ipv6_extension_fragment)); /* Write the fragment to the output list */ diff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c index 855e3f740..169b01a5d 100644 --- a/lib/librte_ip_frag/rte_ipv6_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c @@ -32,7 +32,7 @@ ip_frag_memmove(char *dst, char *src, int len) struct rte_mbuf * ipv6_frag_reassemble(struct ip_frag_pkt *fp) { - struct ipv6_hdr *ip_hdr; + struct rte_ipv6_hdr *ip_hdr; struct ipv6_extension_fragment *frag_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; @@ -93,7 +93,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) m->ol_flags |= PKT_TX_IP_CKSUM; /* update ipv6 header for the reassembled datagram */ - ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, m->l2_len); + ip_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, m->l2_len); ip_hdr->payload_len = rte_cpu_to_be_16(payload_len); @@ -139,7 +139,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp) struct rte_mbuf * rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, - struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) + struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) { struct ip_frag_pkt *fp; struct ip_frag_key key; diff --git a/lib/librte_ipsec/iph.h b/lib/librte_ipsec/iph.h index 58930cf18..a0ca41d51 100644 --- a/lib/librte_ipsec/iph.h +++ b/lib/librte_ipsec/iph.h @@ -40,8 +40,8 @@ static inline int update_trs_l3hdr(const struct rte_ipsec_sa *sa, void *p, uint32_t plen, uint32_t l2len, uint32_t l3len, uint8_t proto) { - struct ipv4_hdr *v4h; - struct ipv6_hdr *v6h; + struct rte_ipv4_hdr *v4h; + struct rte_ipv6_hdr *v6h; int32_t rc; if ((sa->type & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4) { @@ -67,8 +67,8 @@ static inline void update_tun_l3hdr(const struct rte_ipsec_sa *sa, void *p, uint32_t plen, uint32_t l2len, rte_be16_t pid) { - struct ipv4_hdr *v4h; - struct ipv6_hdr *v6h; + struct rte_ipv4_hdr *v4h; + struct rte_ipv6_hdr *v6h; if (sa->type & RTE_IPSEC_SATP_MODE_TUNLV4) { v4h = p; diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index f9b909090..a1431ee90 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -28,7 +28,7 @@ extern "C" { /** * IPv4 Header */ -struct ipv4_hdr { +struct rte_ipv4_hdr { uint8_t version_ihl; /**< version and header length */ uint8_t type_of_service; /**< type of service */ uint16_t total_length; /**< length of packet */ @@ -249,10 +249,10 @@ rte_raw_cksum_mbuf(const struct rte_mbuf *m, uint32_t off, uint32_t len, * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) +rte_ipv4_cksum(const struct rte_ipv4_hdr *ipv4_hdr) { uint16_t cksum; - cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct ipv4_hdr)); + cksum = rte_raw_cksum(ipv4_hdr, sizeof(struct rte_ipv4_hdr)); return (cksum == 0xffff) ? cksum : (uint16_t)~cksum; } @@ -275,7 +275,7 @@ rte_ipv4_cksum(const struct ipv4_hdr *ipv4_hdr) * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) +rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags) { struct ipv4_psd_header { uint32_t src_addr; /* IP address of source host. */ @@ -294,7 +294,7 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) } else { psd_hdr.len = rte_cpu_to_be_16( (uint16_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr))); + - sizeof(struct rte_ipv4_hdr))); } return rte_raw_cksum(&psd_hdr, sizeof(psd_hdr)); } @@ -314,16 +314,16 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags) * or 0 on error */ static inline uint16_t -rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) +rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l3_len, l4_len; l3_len = rte_be_to_cpu_16(ipv4_hdr->total_length); - if (l3_len < sizeof(struct ipv4_hdr)) + if (l3_len < sizeof(struct rte_ipv4_hdr)) return 0; - l4_len = l3_len - sizeof(struct ipv4_hdr); + l4_len = l3_len - sizeof(struct rte_ipv4_hdr); cksum = rte_raw_cksum(l4_hdr, l4_len); cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0); @@ -339,7 +339,7 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) /** * IPv6 Header */ -struct ipv6_hdr { +struct rte_ipv6_hdr { uint32_t vtc_flow; /**< IP version, traffic class & flow label. */ uint16_t payload_len; /**< IP packet length - includes sizeof(ip_header). */ uint8_t proto; /**< Protocol, next header. */ @@ -371,7 +371,7 @@ struct ipv6_hdr { * The non-complemented checksum to set in the L4 header. */ static inline uint16_t -rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) +rte_ipv6_phdr_cksum(const struct rte_ipv6_hdr *ipv6_hdr, uint64_t ol_flags) { uint32_t sum; struct { @@ -407,7 +407,7 @@ rte_ipv6_phdr_cksum(const struct ipv6_hdr *ipv6_hdr, uint64_t ol_flags) * The complemented checksum to set in the IP packet. */ static inline uint16_t -rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr) +rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr) { uint32_t cksum; uint32_t l4_len; diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index d858ab155..b01cacb9c 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -173,7 +173,7 @@ ptype_tunnel(uint16_t *proto, const struct rte_mbuf *m, /* get the ipv4 header length */ static uint8_t -ip4_hlen(const struct ipv4_hdr *hdr) +ip4_hlen(const struct rte_ipv4_hdr *hdr) { return (hdr->version_ihl & 0xf) * 4; } @@ -300,8 +300,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -323,8 +323,8 @@ 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(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); @@ -432,8 +432,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { - const struct ipv4_hdr *ip4h; - struct ipv4_hdr ip4h_copy; + const struct rte_ipv4_hdr *ip4h; + struct rte_ipv4_hdr ip4h_copy; ip4h = rte_pktmbuf_read(m, off, sizeof(*ip4h), &ip4h_copy); if (unlikely(ip4h == NULL)) @@ -455,8 +455,8 @@ 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(RTE_ETHER_TYPE_IPv6)) { - const struct ipv6_hdr *ip6h; - struct ipv6_hdr ip6h_copy; + const struct rte_ipv6_hdr *ip6h; + struct rte_ipv6_hdr ip6h_copy; int frag = 0; ip6h = rte_pktmbuf_read(m, off, sizeof(*ip6h), &ip6h_copy); diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 16970711b..2173f95a9 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -112,8 +112,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, static inline int rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; struct tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -144,7 +144,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) #endif if (ol_flags & PKT_TX_IPV4) { - ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, inner_l3_offset); if (ol_flags & PKT_TX_IP_CKSUM) @@ -158,8 +158,8 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - inner_l3_offset); + ipv6_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, inner_l3_offset + m->l3_len); @@ -175,8 +175,8 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); } else { - ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, - inner_l3_offset); + ipv6_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, inner_l3_offset + m->l3_len); diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index ea966cb94..1a295a19c 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -491,7 +491,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -499,14 +499,14 @@ struct encap_vxlan_ipv4_data { struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv4_hdr ipv4; + struct rte_ipv4_hdr ipv4; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -514,7 +514,7 @@ struct encap_vxlan_ipv6_data { struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; - struct ipv6_hdr ipv6; + struct rte_ipv6_hdr ipv6; struct udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -1007,7 +1007,7 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -1037,7 +1037,7 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + sizeof(struct udp_hdr) + - sizeof(struct ipv4_hdr)); + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + @@ -1342,7 +1342,7 @@ nat_ipv6_tcp_udp_checksum_update(uint16_t cksum0, } static __rte_always_inline void -pkt_ipv4_work_nat(struct ipv4_hdr *ip, +pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, struct nat_ipv4_data *data, struct rte_table_action_nat_config *cfg) { @@ -1428,7 +1428,7 @@ pkt_ipv4_work_nat(struct ipv4_hdr *ip, } static __rte_always_inline void -pkt_ipv6_work_nat(struct ipv6_hdr *ip, +pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, struct nat_ipv6_data *data, struct rte_table_action_nat_config *cfg) { @@ -1536,7 +1536,7 @@ ttl_apply(void *data, } static __rte_always_inline uint64_t -pkt_ipv4_work_ttl(struct ipv4_hdr *ip, +pkt_ipv4_work_ttl(struct rte_ipv4_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -1557,7 +1557,7 @@ pkt_ipv4_work_ttl(struct ipv4_hdr *ip, } static __rte_always_inline uint64_t -pkt_ipv6_work_ttl(struct ipv6_hdr *ip, +pkt_ipv6_work_ttl(struct rte_ipv6_hdr *ip, struct ttl_data *data) { uint32_t drop; @@ -2893,16 +2893,16 @@ pkt_work(struct rte_mbuf *mbuf, uint16_t total_length; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr = ip; + struct rte_ipv4_hdr *hdr = ip; dscp = hdr->type_of_service >> 2; total_length = rte_ntohs(hdr->total_length); } else { - struct ipv6_hdr *hdr = ip; + struct rte_ipv6_hdr *hdr = ip; dscp = (rte_ntohl(hdr->vtc_flow) & 0x0F600000) >> 18; - total_length = - rte_ntohs(hdr->payload_len) + sizeof(struct ipv6_hdr); + total_length = rte_ntohs(hdr->payload_len) + + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { @@ -3041,10 +3041,10 @@ pkt4_work(struct rte_mbuf **mbufs, uint16_t total_length0, total_length1, total_length2, total_length3; if (cfg->common.ip_version) { - struct ipv4_hdr *hdr0 = ip0; - struct ipv4_hdr *hdr1 = ip1; - struct ipv4_hdr *hdr2 = ip2; - struct ipv4_hdr *hdr3 = ip3; + struct rte_ipv4_hdr *hdr0 = ip0; + struct rte_ipv4_hdr *hdr1 = ip1; + struct rte_ipv4_hdr *hdr2 = ip2; + struct rte_ipv4_hdr *hdr3 = ip3; dscp0 = hdr0->type_of_service >> 2; dscp1 = hdr1->type_of_service >> 2; @@ -3056,24 +3056,24 @@ pkt4_work(struct rte_mbuf **mbufs, total_length2 = rte_ntohs(hdr2->total_length); total_length3 = rte_ntohs(hdr3->total_length); } else { - struct ipv6_hdr *hdr0 = ip0; - struct ipv6_hdr *hdr1 = ip1; - struct ipv6_hdr *hdr2 = ip2; - struct ipv6_hdr *hdr3 = ip3; + struct rte_ipv6_hdr *hdr0 = ip0; + struct rte_ipv6_hdr *hdr1 = ip1; + struct rte_ipv6_hdr *hdr2 = ip2; + struct rte_ipv6_hdr *hdr3 = ip3; dscp0 = (rte_ntohl(hdr0->vtc_flow) & 0x0F600000) >> 18; dscp1 = (rte_ntohl(hdr1->vtc_flow) & 0x0F600000) >> 18; dscp2 = (rte_ntohl(hdr2->vtc_flow) & 0x0F600000) >> 18; dscp3 = (rte_ntohl(hdr3->vtc_flow) & 0x0F600000) >> 18; - total_length0 = - rte_ntohs(hdr0->payload_len) + sizeof(struct ipv6_hdr); - total_length1 = - rte_ntohs(hdr1->payload_len) + sizeof(struct ipv6_hdr); - total_length2 = - rte_ntohs(hdr2->payload_len) + sizeof(struct ipv6_hdr); - total_length3 = - rte_ntohs(hdr3->payload_len) + sizeof(struct ipv6_hdr); + total_length0 = rte_ntohs(hdr0->payload_len) + + sizeof(struct rte_ipv6_hdr); + total_length1 = rte_ntohs(hdr1->payload_len) + + sizeof(struct rte_ipv6_hdr); + total_length2 = rte_ntohs(hdr2->payload_len) + + sizeof(struct rte_ipv6_hdr); + total_length3 = rte_ntohs(hdr3->payload_len) + + sizeof(struct rte_ipv6_hdr); } if (cfg->action_mask & (1LLU << RTE_TABLE_ACTION_LB)) { diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index c8b2e19bf..225802892 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -151,7 +151,8 @@ static void process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv4_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv4_hdr *); + struct rte_ipv4_hdr *pkt_hdr = + rte_pktmbuf_mtod(pkt, struct rte_ipv4_hdr *); /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); @@ -182,7 +183,8 @@ static void process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) { /* Assume there is no ethernet header */ - struct ipv6_hdr *pkt_hdr = rte_pktmbuf_mtod(pkt, struct ipv6_hdr *); + struct rte_ipv6_hdr *pkt_hdr = + rte_pktmbuf_mtod(pkt, struct rte_ipv6_hdr *); struct ipv6_extension_fragment *frag_hdr; uint16_t frag_data = 0; diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 2394178f0..db364debd 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -238,9 +238,9 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) /* IP cksum verification cannot be bypassed, then calculate here */ if (m_buf->ol_flags & PKT_TX_IP_CKSUM) { - struct ipv4_hdr *ipv4_hdr; + struct rte_ipv4_hdr *ipv4_hdr; - ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct ipv4_hdr *, + ipv4_hdr = rte_pktmbuf_mtod_offset(m_buf, struct rte_ipv4_hdr *, m_buf->l2_len); ipv4_hdr->hdr_checksum = rte_ipv4_cksum(ipv4_hdr); } @@ -966,8 +966,8 @@ virtio_net_with_host_offload(struct virtio_net *dev) static void parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) { - struct ipv4_hdr *ipv4_hdr; - struct ipv6_hdr *ipv6_hdr; + struct rte_ipv4_hdr *ipv4_hdr; + struct rte_ipv6_hdr *ipv6_hdr; void *l3_hdr = NULL; struct rte_ether_hdr *eth_hdr; uint16_t ethertype; @@ -998,7 +998,7 @@ parse_ethernet(struct rte_mbuf *m, uint16_t *l4_proto, void **l4_hdr) case RTE_ETHER_TYPE_IPv6: ipv6_hdr = l3_hdr; *l4_proto = ipv6_hdr->proto; - m->l3_len = sizeof(struct ipv6_hdr); + m->l3_len = sizeof(struct rte_ipv6_hdr); *l4_hdr = (char *)l3_hdr + m->l3_len; m->ol_flags |= PKT_TX_IPV6; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 11/15] net: add rte prefix to ip defines 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (9 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 10/15] net: add rte prefix to ip structure Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-29 8:41 ` David Marchand 2019-05-21 16:13 ` [dpdk-dev] [PATCH 12/15] net: add rte prefix to sctp structure Olivier Matz ` (6 subsequent siblings) 17 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'RTE_' prefix to defines: - rename IPv4( as RTE_IPv4(. - rename IPV4_MAX_PKT_LEN as RTE_IPV4_MAX_PKT_LEN. - rename IPV4_HDR_IHL_MASK as RTE_IPV4_HDR_IHL_MASK. - rename IPV4_IHL_MULTIPLIER as RTE_IPV4_IHL_MULTIPLIER. - rename IPV4_HDR_DF_SHIFT as RTE_IPV4_HDR_DF_SHIFT. - rename IPV4_HDR_MF_SHIFT as RTE_IPV4_HDR_MF_SHIFT. - rename IPV4_HDR_FO_SHIFT as RTE_IPV4_HDR_FO_SHIFT. - rename IPV4_HDR_DF_FLAG as RTE_IPV4_HDR_DF_FLAG. - rename IPV4_HDR_MF_FLAG as RTE_IPV4_HDR_MF_FLAG. - rename IPV4_HDR_OFFSET_MASK as RTE_IPV4_HDR_OFFSET_MASK. - rename IPV4_HDR_OFFSET_UNITS as RTE_IPV4_HDR_OFFSET_UNITS. - rename IPV4_ANY as RTE_IPV4_ANY. - rename IPV4_LOOPBACK as RTE_IPV4_LOOPBACK. - rename IPV4_BROADCAST as RTE_IPV4_BROADCAST. - rename IPV4_ALLHOSTS_GROUP as RTE_IPV4_ALLHOSTS_GROUP. - rename IPV4_ALLRTRS_GROUP as RTE_IPV4_ALLRTRS_GROUP. - rename IPV4_MAX_LOCAL_GROUP as RTE_IPV4_MAX_LOCAL_GROUP. - rename IPV4_MIN_MCAST as RTE_IPV4_MIN_MCAST. - rename IPV4_MAX_MCAST as RTE_IPV4_MAX_MCAST. - rename IS_IPV4_MCAST as RTE_IS_IPV4_MCAST. - rename IPV6_HDR_FL_SHIFT as RTE_IPV6_HDR_FL_SHIFT. - rename IPV6_HDR_TC_SHIFT as RTE_IPV6_HDR_TC_SHIFT. - rename IPV6_HDR_FL_MASK as RTE_IPV6_HDR_FL_MASK. - rename IPV6_HDR_TC_MASK as RTE_IPV6_HDR_TC_MASK. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-acl/main.c | 2 +- app/test-pmd/cmdline_flow.c | 4 +- app/test-pmd/flowgen.c | 4 +- app/test-pmd/testpmd.c | 8 +- app/test/test_acl.c | 8 +- app/test/test_acl.h | 122 ++++++++++----------- app/test/test_efd.c | 20 ++-- app/test/test_flow_classify.c | 10 +- app/test/test_hash.c | 20 ++-- app/test/test_ipsec.c | 6 +- app/test/test_link_bonding_mode4.c | 4 +- app/test/test_lpm.c | 76 ++++++------- app/test/test_lpm_perf.c | 10 +- app/test/test_member.c | 20 ++-- app/test/test_sched.c | 2 +- app/test/test_table_acl.c | 8 +- app/test/test_thash.c | 10 +- .../prog_guide/packet_classif_access_ctrl.rst | 6 +- doc/guides/sample_app_ug/ip_frag.rst | 16 +-- doc/guides/sample_app_ug/ip_reassembly.rst | 16 +-- doc/guides/sample_app_ug/ipv4_multicast.rst | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 4 +- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/i40e/i40e_flow.c | 4 +- drivers/net/ixgbe/ixgbe_rxtx.c | 2 +- drivers/net/mlx5/mlx5_flow_tcf.c | 16 +-- drivers/net/mlx5/mlx5_flow_verbs.c | 16 +-- drivers/net/tap/tap_bpf_program.c | 6 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 +- examples/flow_classify/flow_classify.c | 2 +- examples/ip_fragmentation/main.c | 16 +-- examples/ip_reassembly/main.c | 16 +-- examples/ipsec-secgw/sa.c | 4 +- examples/ipv4_multicast/main.c | 32 +++--- examples/l2fwd-crypto/main.c | 4 +- examples/l3fwd-acl/main.c | 2 +- examples/l3fwd-power/main.c | 24 ++-- examples/l3fwd-vf/main.c | 24 ++-- examples/l3fwd/l3fwd_em.c | 20 ++-- examples/l3fwd/l3fwd_lpm.c | 16 +-- examples/performance-thread/l3fwd-thread/main.c | 32 +++--- lib/librte_gro/gro_tcp4.c | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 5 +- lib/librte_gso/gso_common.h | 4 +- lib/librte_ip_frag/rte_ip_frag.h | 4 +- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 16 +-- lib/librte_ip_frag/rte_ipv4_reassembly.c | 8 +- lib/librte_net/rte_ip.h | 53 ++++----- lib/librte_net/rte_net.c | 6 +- lib/librte_port/rte_port_ras.c | 4 +- 50 files changed, 364 insertions(+), 358 deletions(-) diff --git a/app/test-acl/main.c b/app/test-acl/main.c index b80179417..eb6294396 100644 --- a/app/test-acl/main.c +++ b/app/test-acl/main.c @@ -625,7 +625,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 7a1c5aba9..a3bbadd52 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -3532,12 +3532,12 @@ parse_vc_action_vxlan_encap(struct context *ctx, const struct token *token, memcpy(&ipv6_mask_tos, &rte_flow_item_ipv6_mask, sizeof(ipv6_mask_tos)); ipv6_mask_tos.hdr.vtc_flow |= - RTE_BE32(0xfful << IPV6_HDR_TC_SHIFT); + RTE_BE32(0xfful << RTE_IPV6_HDR_TC_SHIFT); ipv6_mask_tos.hdr.hop_limits = 0xff; action_vxlan_encap_data->item_ipv6.hdr.vtc_flow |= rte_cpu_to_be_32 ((uint32_t)vxlan_encap_conf.ip_tos << - IPV6_HDR_TC_SHIFT); + RTE_IPV6_HDR_TC_SHIFT); action_vxlan_encap_data->item_ipv6.hdr.hop_limits = vxlan_encap_conf.ip_ttl; action_vxlan_encap_data->items[2].mask = diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 989d86f89..adfbc520a 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -72,8 +72,8 @@ /* hardcoded configuration (for now) */ static unsigned cfg_n_flows = 1024; -static uint32_t cfg_ip_src = IPv4(10, 254, 0, 0); -static uint32_t cfg_ip_dst = IPv4(10, 253, 0, 0); +static uint32_t cfg_ip_src = RTE_IPv4(10, 254, 0, 0); +static uint32_t cfg_ip_dst = RTE_IPv4(10, 253, 0, 0); static uint16_t cfg_udp_src = 1000; static uint16_t cfg_udp_dst = 1001; static struct rte_ether_addr cfg_ether_src = diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 55e1b9d27..0148b0a77 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -480,8 +480,8 @@ struct vxlan_encap_conf vxlan_encap_conf = { .vni = "\x00\x00\x00", .udp_src = 0, .udp_dst = RTE_BE16(4789), - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" @@ -497,8 +497,8 @@ struct nvgre_encap_conf nvgre_encap_conf = { .select_ipv4 = 1, .select_vlan = 0, .tni = "\x00\x00\x00", - .ipv4_src = IPv4(127, 0, 0, 1), - .ipv4_dst = IPv4(255, 255, 255, 255), + .ipv4_src = RTE_IPv4(127, 0, 0, 1), + .ipv4_dst = RTE_IPv4(255, 255, 255, 255), .ipv6_src = "\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x01", .ipv6_dst = "\x00\x00\x00\x00\x00\x00\x00\x00" diff --git a/app/test/test_acl.c b/app/test/test_acl.c index b1f75d1bc..8663ff031 100644 --- a/app/test/test_acl.c +++ b/app/test/test_acl.c @@ -515,15 +515,15 @@ test_build_ports_range(void) static struct ipv4_7tuple test_data[] = { { .proto = 6, - .ip_src = IPv4(10, 1, 1, 1), - .ip_dst = IPv4(192, 168, 0, 33), + .ip_src = RTE_IPv4(10, 1, 1, 1), + .ip_dst = RTE_IPv4(192, 168, 0, 33), .port_dst = 53, .allow = 1, }, { .proto = 6, - .ip_src = IPv4(127, 84, 33, 1), - .ip_dst = IPv4(1, 2, 3, 4), + .ip_src = RTE_IPv4(127, 84, 33, 1), + .ip_dst = RTE_IPv4(1, 2, 3, 4), .port_dst = 65281, .allow = 1, }, diff --git a/app/test/test_acl.h b/app/test/test_acl.h index bbb0447a8..b071f47c3 100644 --- a/app/test/test_acl.h +++ b/app/test/test_acl.h @@ -82,13 +82,13 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { { .data = {.userdata = 1, .category_mask = 1, .priority = 1}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 24, }, { .data = {.userdata = 2, .category_mask = 1, .priority = 1}, - .dst_addr = IPv4(10,0,0,0), + .dst_addr = RTE_IPv4(10,0,0,0), .dst_mask_len = 24, }, /* test src and dst ports */ @@ -124,8 +124,8 @@ struct rte_acl_ipv4vlan_rule invalid_layout_rules[] = { * results using the wrong data layout. */ struct ipv4_7tuple invalid_layout_data[] = { - {.ip_src = IPv4(10,0,1,0)}, /* should not match */ - {.ip_src = IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ + {.ip_src = RTE_IPv4(10,0,1,0)}, /* should not match */ + {.ip_src = RTE_IPv4(10,0,0,1), .allow = 2}, /* should match 2 */ {.port_src = 100, .allow = 4}, /* should match 4 */ {.port_dst = 0xf, .allow = 6}, /* should match 6 */ }; @@ -142,7 +142,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 1, .category_mask = ACL_ALLOW_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,0,0), + .dst_addr = RTE_IPv4(192,168,0,0), .dst_mask_len = 16, .src_port_low = 0, .src_port_high = 0xffff, @@ -153,7 +153,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 2, .category_mask = ACL_ALLOW_MASK, .priority = 330}, - .dst_addr = IPv4(192,168,1,0), + .dst_addr = RTE_IPv4(192,168,1,0), .dst_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -164,7 +164,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 3, .category_mask = ACL_DENY_MASK, .priority = 230}, - .dst_addr = IPv4(192,168,1,50), + .dst_addr = RTE_IPv4(192,168,1,50), .dst_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -177,7 +177,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 4, .category_mask = ACL_ALLOW_MASK, .priority = 240}, - .src_addr = IPv4(10,0,0,0), + .src_addr = RTE_IPv4(10,0,0,0), .src_mask_len = 8, .src_port_low = 0, .src_port_high = 0xffff, @@ -188,7 +188,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 5, .category_mask = ACL_ALLOW_MASK, .priority = 340}, - .src_addr = IPv4(10,1,1,0), + .src_addr = RTE_IPv4(10,1,1,0), .src_mask_len = 24, .src_port_low = 0, .src_port_high = 0xffff, @@ -199,7 +199,7 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 6, .category_mask = ACL_DENY_MASK, .priority = 240}, - .src_addr = IPv4(10,1,1,1), + .src_addr = RTE_IPv4(10,1,1,1), .src_mask_len = 32, .src_port_low = 0, .src_port_high = 0xffff, @@ -393,9 +393,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { .data = {.userdata = 24, .category_mask = ACL_ALLOW_MASK, .priority = 400}, /** make sure that unmasked bytes don't fail! */ - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 16, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 24, .proto = 0x5, .proto_mask = 0xff, @@ -411,9 +411,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 25, .category_mask = ACL_DENY_MASK, .priority = 400}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 24, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 16, .proto = 0x5, .proto_mask = 0xff, @@ -429,9 +429,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 26, .category_mask = ACL_ALLOW_MASK, .priority = 500}, - .dst_addr = IPv4(1,2,3,4), + .dst_addr = RTE_IPv4(1,2,3,4), .dst_mask_len = 8, - .src_addr = IPv4(5,6,7,8), + .src_addr = RTE_IPv4(5,6,7,8), .src_mask_len = 32, .proto = 0x5, .proto_mask = 0xff, @@ -445,9 +445,9 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { { .data = {.userdata = 27, .category_mask = ACL_DENY_MASK, .priority = 500}, - .dst_addr = IPv4(5,6,7,8), + .dst_addr = RTE_IPv4(5,6,7,8), .dst_mask_len = 32, - .src_addr = IPv4(1,2,3,4), + .src_addr = RTE_IPv4(1,2,3,4), .src_mask_len = 8, .proto = 0x5, .proto_mask = 0xff, @@ -463,20 +463,20 @@ struct rte_acl_ipv4vlan_rule acl_test_rules[] = { /* data for ACL unit test */ struct ipv4_7tuple acl_test_data[] = { /* testing single rule aspects */ - {.ip_src = IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ - {.ip_src = IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ - {.ip_src = IPv4(10,1,1,1), .allow = 5, + {.ip_src = RTE_IPv4(10,0,0,0), .allow = 4}, /* should match 4 */ + {.ip_src = RTE_IPv4(10,1,1,2), .allow = 5}, /* should match 5 */ + {.ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 6}, /* should match 5, 6 */ - {.ip_dst = IPv4(10,0,0,0)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,2)}, /* should not match */ - {.ip_dst = IPv4(10,1,1,1)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,0,0,0)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,2)}, /* should not match */ + {.ip_dst = RTE_IPv4(10,1,1,1)}, /* should not match */ - {.ip_src = IPv4(192,168,2,50)}, /* should not match */ - {.ip_src = IPv4(192,168,1,2)}, /* should not match */ - {.ip_src = IPv4(192,168,1,50)}, /* should not match */ - {.ip_dst = IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ - {.ip_dst = IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ - {.ip_dst = IPv4(192,168,1,50), .allow = 2, + {.ip_src = RTE_IPv4(192,168,2,50)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,2)}, /* should not match */ + {.ip_src = RTE_IPv4(192,168,1,50)}, /* should not match */ + {.ip_dst = RTE_IPv4(192,168,2,50), .allow = 1}, /* should match 1 */ + {.ip_dst = RTE_IPv4(192,168,1,49), .allow = 2}, /* should match 2 */ + {.ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 3}, /* should match 2, 3 */ {.vlan = 0x64, .allow = 7}, /* should match 7 */ @@ -515,20 +515,20 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .allow = 22, .deny = 23}, /* should match 22, 23 */ /* testing matching multiple rules at once */ - {.vlan = 0x5, .ip_src = IPv4(10,1,1,1), + {.vlan = 0x5, .ip_src = RTE_IPv4(10,1,1,1), .allow = 5, .deny = 9}, /* should match 5, 9 */ - {.vlan = 0x5, .ip_src = IPv4(192,168,2,50), + {.vlan = 0x5, .ip_src = RTE_IPv4(192,168,2,50), .allow = 8, .deny = 9}, /* should match 8, 9 */ - {.vlan = 0x55, .ip_src = IPv4(192,168,1,49), + {.vlan = 0x55, .ip_src = RTE_IPv4(192,168,1,49), .allow = 8}, /* should match 8 */ {.port_dst = 80, .port_src = 1024, .allow = 13, .deny = 20}, /* should match 13,20 */ {.port_dst = 79, .port_src = 1024, .allow = 14, .deny = 20}, /* should match 14,20 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,2,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,2,50), .allow = 1, .deny = 23}, /* should match 1, 23 */ - {.proto = 0x5, .ip_dst = IPv4(192,168,1,50), + {.proto = 0x5, .ip_dst = RTE_IPv4(192,168,1,50), .allow = 2, .deny = 23}, /* should match 2, 23 */ {.vlan = 0x64, .domain = 0x5, .allow = 11, .deny = 12}, /* should match 11, 12 */ @@ -537,16 +537,16 @@ struct ipv4_7tuple acl_test_data[] = { {.proto = 0x5, .port_dst = 80, .allow = 13, .deny = 23}, /* should match 13, 23 */ {.proto = 0x51, .port_src = 5000}, /* should not match */ - {.ip_src = IPv4(192,168,1,50), - .ip_dst = IPv4(10,0,0,0), + {.ip_src = RTE_IPv4(192,168,1,50), + .ip_dst = RTE_IPv4(10,0,0,0), .proto = 0x51, .port_src = 5000, .port_dst = 5000}, /* should not match */ /* test full packet rules */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -556,8 +556,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 24 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x5, .vlan = 0x8100, .domain = 0x64, @@ -567,8 +567,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 25 }, /* should match 13, 25 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -577,8 +577,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 23, 26 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -587,8 +587,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 27 }, /* should match 13, 27 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -597,8 +597,8 @@ struct ipv4_7tuple acl_test_data[] = { .deny = 23 }, /* should match 13, 23 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x5, .vlan = 0x64, .port_src = 12345, @@ -610,8 +610,8 @@ struct ipv4_7tuple acl_test_data[] = { /* visual separator! */ { - .ip_dst = IPv4(1,2,100,200), - .ip_src = IPv4(5,6,7,254), + .ip_dst = RTE_IPv4(1,2,100,200), + .ip_src = RTE_IPv4(5,6,7,254), .proto = 0x55, .vlan = 0x8000, .domain = 0x6464, @@ -620,8 +620,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(5,6,7,254), - .ip_src = IPv4(1,2,100,200), + .ip_dst = RTE_IPv4(5,6,7,254), + .ip_src = RTE_IPv4(1,2,100,200), .proto = 0x55, .vlan = 0x8100, .domain = 0x6464, @@ -630,8 +630,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 10 }, /* should match 10 */ { - .ip_dst = IPv4(1,10,20,30), - .ip_src = IPv4(5,6,7,8), + .ip_dst = RTE_IPv4(1,10,20,30), + .ip_src = RTE_IPv4(5,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -639,8 +639,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(5,6,7,8), - .ip_src = IPv4(1,10,20,30), + .ip_dst = RTE_IPv4(5,6,7,8), + .ip_src = RTE_IPv4(1,10,20,30), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -648,8 +648,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(2,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(2,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x55, .vlan = 0x64, .port_src = 12345, @@ -657,8 +657,8 @@ struct ipv4_7tuple acl_test_data[] = { .allow = 7 }, /* should match 7 */ { - .ip_dst = IPv4(1,2,3,4), - .ip_src = IPv4(4,6,7,8), + .ip_dst = RTE_IPv4(1,2,3,4), + .ip_src = RTE_IPv4(4,6,7,8), .proto = 0x50, .vlan = 0x6466, .port_src = 12345, diff --git a/app/test/test_efd.c b/app/test/test_efd.c index 93e8f1cbb..2868712bb 100644 --- a/app/test/test_efd.c +++ b/app/test/test_efd.c @@ -58,36 +58,36 @@ static void print_key_info(const char *msg, const struct flow_key *key, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 96e371691..f2c100a0d 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -95,7 +95,8 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { * dst mask 255.255.255.00 / udp src is 32 dst is 33 / end" */ static struct rte_flow_item_ipv4 ipv4_udp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, IPv4(2, 2, 2, 3), IPv4(2, 2, 2, 7)} + { 0, 0, 0, 0, 0, 0, IPPROTO_UDP, 0, + RTE_IPv4(2, 2, 2, 3), RTE_IPv4(2, 2, 2, 7)} }; static const struct rte_flow_item_ipv4 ipv4_mask_24 = { .hdr = { @@ -131,7 +132,8 @@ static struct rte_flow_item end_item_bad = { -1, 0, 0, 0 }; * dst mask 255.255.255.00 / tcp src is 16 dst is 17 / end" */ static struct rte_flow_item_ipv4 ipv4_tcp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, IPv4(1, 2, 3, 4), IPv4(5, 6, 7, 8)} + { 0, 0, 0, 0, 0, 0, IPPROTO_TCP, 0, + RTE_IPv4(1, 2, 3, 4), RTE_IPv4(5, 6, 7, 8)} }; static struct rte_flow_item_tcp tcp_spec_1 = { @@ -149,8 +151,8 @@ static struct rte_flow_item tcp_item_1 = { RTE_FLOW_ITEM_TYPE_TCP, * dst mask 255.255.255.00 / sctp src is 16 dst is 17/ end" */ static struct rte_flow_item_ipv4 ipv4_sctp_spec_1 = { - { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, IPv4(11, 12, 13, 14), - IPv4(15, 16, 17, 18)} + { 0, 0, 0, 0, 0, 0, IPPROTO_SCTP, 0, RTE_IPv4(11, 12, 13, 14), + RTE_IPv4(15, 16, 17, 18)} }; static struct rte_flow_item_sctp sctp_spec_1 = { diff --git a/app/test/test_hash.c b/app/test/test_hash.c index e16259296..8271ba792 100644 --- a/app/test/test_hash.c +++ b/app/test/test_hash.c @@ -104,32 +104,32 @@ static void print_key_info(const char *msg, const struct flow_key *key, /* Keys used by unit test functions */ static struct flow_key keys[5] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index d8860fba0..606e31919 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -533,11 +533,11 @@ const char null_encrypted_data[] = struct rte_ipv4_hdr ipv4_outer = { .version_ihl = IPVERSION << 4 | - sizeof(ipv4_outer) / IPV4_IHL_MULTIPLIER, + sizeof(ipv4_outer) / RTE_IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, .next_proto_id = IPPROTO_ESP, - .src_addr = IPv4(192, 168, 1, 100), - .dst_addr = IPv4(192, 168, 2, 100), + .src_addr = RTE_IPv4(192, 168, 1, 100), + .dst_addr = RTE_IPv4(192, 168, 2, 100), }; static struct rte_mbuf * diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index e67bfacdd..98f9fe2fa 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -729,8 +729,8 @@ generate_packets(struct rte_ether_addr *src_mac, uint16_t src_port = 10, dst_port = 20; - uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = IPv4(192, 168, 0, 1) }; - uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = IPv4(192, 168, 0, 2) }; + uint32_t ip_src[4] = { [0 ... 2] = 0xDEADBEEF, [3] = RTE_IPv4(192, 168, 0, 1) }; + uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; struct udp_hdr pkt_udp_hdr; diff --git a/app/test/test_lpm.c b/app/test/test_lpm.c index 5d697dd0f..0f24631ac 100644 --- a/app/test/test_lpm.c +++ b/app/test/test_lpm.c @@ -165,7 +165,7 @@ test3(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop = 100; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop = 100; uint8_t depth = 24; int32_t status = 0; @@ -203,7 +203,7 @@ test4(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0); + uint32_t ip = RTE_IPv4(0, 0, 0, 0); uint8_t depth = 24; int32_t status = 0; @@ -242,7 +242,7 @@ test5(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_return = 0; int32_t status = 0; /* rte_lpm_lookup: lpm == NULL */ @@ -276,7 +276,7 @@ test6(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 24; int32_t status = 0; @@ -315,7 +315,7 @@ test7(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip = IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; + uint32_t ip = RTE_IPv4(0, 0, 0, 0), next_hop_add = 100, next_hop_return = 0; uint8_t depth = 32; int32_t status = 0; @@ -366,7 +366,7 @@ test8(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - uint32_t ip1 = IPv4(127, 255, 255, 255), ip2 = IPv4(128, 0, 0, 0); + uint32_t ip1 = RTE_IPv4(127, 255, 255, 255), ip2 = RTE_IPv4(128, 0, 0, 0); uint32_t next_hop_add, next_hop_return; uint8_t depth; int32_t status = 0; @@ -457,7 +457,7 @@ test9(void) int32_t status = 0; /* Add & lookup to hit invalid TBL24 entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -479,7 +479,7 @@ test9(void) rte_lpm_delete_all(lpm); /* Add & lookup to hit valid TBL24 entry not extended */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 23; next_hop_add = 100; @@ -515,7 +515,7 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with invalid TBL8 * entry */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -525,7 +525,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 5); + ip = RTE_IPv4(128, 0, 0, 5); depth = 32; next_hop_add = 101; @@ -541,7 +541,7 @@ test9(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -558,11 +558,11 @@ test9(void) /* Add & lookup to hit valid extended TBL24 entry with valid TBL8 * entry */ - ip_1 = IPv4(128, 0, 0, 0); + ip_1 = RTE_IPv4(128, 0, 0, 0); depth_1 = 25; next_hop_add_1 = 101; - ip_2 = IPv4(128, 0, 0, 5); + ip_2 = RTE_IPv4(128, 0, 0, 5); depth_2 = 32; next_hop_add_2 = 102; @@ -629,7 +629,7 @@ test10(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 16; next_hop_add = 100; @@ -647,7 +647,7 @@ test10(void) rte_lpm_delete_all(lpm); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 25; next_hop_add = 100; @@ -665,14 +665,14 @@ test10(void) /* Add rule that extends a TBL24 valid entry & lookup for both rules * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -682,13 +682,13 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -697,7 +697,7 @@ test10(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -711,7 +711,7 @@ test10(void) /* Add rule that updates the next hop in TBL24 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; @@ -740,7 +740,7 @@ test10(void) /* Add rule that updates the next hop in TBL8 & lookup * (& delete & lookup) */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -768,7 +768,7 @@ test10(void) /* Delete a rule that is not present in the TBL24 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -781,7 +781,7 @@ test10(void) /* Delete a rule that is not present in the TBL8 & lookup */ - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -818,14 +818,14 @@ test11(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add = 100; status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; next_hop_add = 101; @@ -835,13 +835,13 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); next_hop_add = 100; status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT((status == 0) && (next_hop_return == next_hop_add)); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; status = rte_lpm_delete(lpm, ip, depth); @@ -850,7 +850,7 @@ test11(void) status = rte_lpm_lookup(lpm, ip, &next_hop_return); TEST_LPM_ASSERT(status == -ENOENT); - ip = IPv4(128, 0, 0, 10); + ip = RTE_IPv4(128, 0, 0, 10); depth = 32; status = rte_lpm_delete(lpm, ip, depth); @@ -889,7 +889,7 @@ test12(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 32; next_hop_add = 100; @@ -944,7 +944,7 @@ test13(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(128, 0, 0, 0); + ip = RTE_IPv4(128, 0, 0, 0); depth = 24; next_hop_add_1 = 100; @@ -1014,10 +1014,10 @@ test14(void) depth = 32; next_hop_add = 100; - ip = IPv4(0, 0, 0, 0); + ip = RTE_IPv4(0, 0, 0, 0); /* Add 256 rules that require a tbl8 extension */ - for (; ip <= IPv4(0, 0, 255, 0); ip += 256) { + for (; ip <= RTE_IPv4(0, 0, 255, 0); ip += 256) { status = rte_lpm_add(lpm, ip, depth, next_hop_add); TEST_LPM_ASSERT(status == 0); @@ -1028,7 +1028,7 @@ test14(void) /* All tbl8 extensions have been used above. Try to add one more and * we get a fail */ - ip = IPv4(1, 0, 0, 0); + ip = RTE_IPv4(1, 0, 0, 0); depth = 32; status = rte_lpm_add(lpm, ip, depth, next_hop_add); @@ -1125,9 +1125,9 @@ test17(void) config.max_rules = MAX_RULES; config.number_tbl8s = NUMBER_TBL8S; config.flags = 0; - const uint32_t ip_10_32 = IPv4(10, 10, 10, 2); - const uint32_t ip_10_24 = IPv4(10, 10, 10, 0); - const uint32_t ip_20_25 = IPv4(10, 10, 20, 2); + const uint32_t ip_10_32 = RTE_IPv4(10, 10, 10, 2); + const uint32_t ip_10_24 = RTE_IPv4(10, 10, 10, 0); + const uint32_t ip_20_25 = RTE_IPv4(10, 10, 20, 2); const uint8_t d_ip_10_32 = 32, d_ip_10_24 = 24, d_ip_20_25 = 25; @@ -1221,7 +1221,7 @@ test18(void) lpm = rte_lpm_create(__func__, SOCKET_ID_ANY, &config); TEST_LPM_ASSERT(lpm != NULL); - ip = IPv4(192, 168, 100, 100); + ip = RTE_IPv4(192, 168, 100, 100); depth = 28; next_hop = 1; rte_lpm_add(lpm, ip, depth, next_hop); diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index 3b98ce0c8..b54650367 100644 --- a/app/test/test_lpm_perf.c +++ b/app/test/test_lpm_perf.c @@ -285,11 +285,11 @@ static void generate_large_route_rule_table(void) * they are 4 rules with private local IP address and 1 all-zeros prefix * with depth = 8. */ - insert_rule_in_random_pos(IPv4(0, 0, 0, 0), 8); - insert_rule_in_random_pos(IPv4(10, 2, 23, 147), 32); - insert_rule_in_random_pos(IPv4(192, 168, 100, 10), 24); - insert_rule_in_random_pos(IPv4(192, 168, 25, 100), 24); - insert_rule_in_random_pos(IPv4(192, 168, 129, 124), 32); + insert_rule_in_random_pos(RTE_IPv4(0, 0, 0, 0), 8); + insert_rule_in_random_pos(RTE_IPv4(10, 2, 23, 147), 32); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 100, 10), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 25, 100), 24); + insert_rule_in_random_pos(RTE_IPv4(192, 168, 129, 124), 32); } static void diff --git a/app/test/test_member.c b/app/test/test_member.c index e2a3932f2..53287fcaf 100644 --- a/app/test/test_member.c +++ b/app/test/test_member.c @@ -41,36 +41,36 @@ struct flow_key { /* Keys used by unit test functions */ static struct flow_key keys[NUM_SAMPLES] = { { - .ip_src = IPv4(0x03, 0x02, 0x01, 0x00), - .ip_dst = IPv4(0x07, 0x06, 0x05, 0x04), + .ip_src = RTE_IPv4(0x03, 0x02, 0x01, 0x00), + .ip_dst = RTE_IPv4(0x07, 0x06, 0x05, 0x04), .port_src = 0x0908, .port_dst = 0x0b0a, .proto = 0x0c, }, { - .ip_src = IPv4(0x13, 0x12, 0x11, 0x10), - .ip_dst = IPv4(0x17, 0x16, 0x15, 0x14), + .ip_src = RTE_IPv4(0x13, 0x12, 0x11, 0x10), + .ip_dst = RTE_IPv4(0x17, 0x16, 0x15, 0x14), .port_src = 0x1918, .port_dst = 0x1b1a, .proto = 0x1c, }, { - .ip_src = IPv4(0x23, 0x22, 0x21, 0x20), - .ip_dst = IPv4(0x27, 0x26, 0x25, 0x24), + .ip_src = RTE_IPv4(0x23, 0x22, 0x21, 0x20), + .ip_dst = RTE_IPv4(0x27, 0x26, 0x25, 0x24), .port_src = 0x2928, .port_dst = 0x2b2a, .proto = 0x2c, }, { - .ip_src = IPv4(0x33, 0x32, 0x31, 0x30), - .ip_dst = IPv4(0x37, 0x36, 0x35, 0x34), + .ip_src = RTE_IPv4(0x33, 0x32, 0x31, 0x30), + .ip_dst = RTE_IPv4(0x37, 0x36, 0x35, 0x34), .port_src = 0x3938, .port_dst = 0x3b3a, .proto = 0x3c, }, { - .ip_src = IPv4(0x43, 0x42, 0x41, 0x40), - .ip_dst = IPv4(0x47, 0x46, 0x45, 0x44), + .ip_src = RTE_IPv4(0x43, 0x42, 0x41, 0x40), + .ip_dst = RTE_IPv4(0x47, 0x46, 0x45, 0x44), .port_src = 0x4948, .port_dst = 0x4b4a, .proto = 0x4c, diff --git a/app/test/test_sched.c b/app/test/test_sched.c index c6fb7871a..10d54c55a 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -96,7 +96,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(RTE_ETHER_TYPE_IPv4); - ip_hdr->dst_addr = IPv4(0,0,TC,QUEUE); + ip_hdr->dst_addr = RTE_IPv4(0,0,TC,QUEUE); rte_sched_port_pkt_write(port, mbuf, SUBPORT, PIPE, TC, QUEUE, diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c index 22136a396..e01e1f946 100644 --- a/app/test/test_table_acl.c +++ b/app/test/test_table_acl.c @@ -7,7 +7,7 @@ #include "test_table.h" #include "test_table_acl.h" -#define IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -116,7 +116,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; @@ -662,8 +662,8 @@ test_pipeline_single_filter(int expected_count) sizeof(struct ipv4_5tuple)); five_tuple.proto = j; - five_tuple.ip_src = rte_bswap32(IPv4(192, 168, j, 1)); - five_tuple.ip_dst = rte_bswap32(IPv4(10, 4, j, 1)); + five_tuple.ip_src = rte_bswap32(RTE_IPv4(192, 168, j, 1)); + five_tuple.ip_dst = rte_bswap32(RTE_IPv4(10, 4, j, 1)); five_tuple.port_src = rte_bswap16(100 + j); five_tuple.port_dst = rte_bswap16(200 + j); diff --git a/app/test/test_thash.c b/app/test/test_thash.c index bf332c9e9..3724ea5be 100644 --- a/app/test/test_thash.c +++ b/app/test/test_thash.c @@ -59,15 +59,15 @@ struct test_thash_v6 { /*From 82599 Datasheet 7.1.2.8.3 RSS Verification Suite*/ struct test_thash_v4 v4_tbl[] = { -{IPv4(161, 142, 100, 80), IPv4(66, 9, 149, 187), +{RTE_IPv4(161, 142, 100, 80), RTE_IPv4(66, 9, 149, 187), 1766, 2794, 0x323e8fc2, 0x51ccc178}, -{IPv4(65, 69, 140, 83), IPv4(199, 92, 111, 2), +{RTE_IPv4(65, 69, 140, 83), RTE_IPv4(199, 92, 111, 2), 4739, 14230, 0xd718262a, 0xc626b0ea}, -{IPv4(12, 22, 207, 184), IPv4(24, 19, 198, 95), +{RTE_IPv4(12, 22, 207, 184), RTE_IPv4(24, 19, 198, 95), 38024, 12898, 0xd2d0a5de, 0x5c2b394a}, -{IPv4(209, 142, 163, 6), IPv4(38, 27, 205, 30), +{RTE_IPv4(209, 142, 163, 6), RTE_IPv4(38, 27, 205, 30), 2217, 48228, 0x82989176, 0xafc7327f}, -{IPv4(202, 188, 127, 2), IPv4(153, 39, 163, 191), +{RTE_IPv4(202, 188, 127, 2), RTE_IPv4(153, 39, 163, 191), 1303, 44251, 0x5d1809c5, 0x10e828a2}, }; diff --git a/doc/guides/prog_guide/packet_classif_access_ctrl.rst b/doc/guides/prog_guide/packet_classif_access_ctrl.rst index 6887e4dc6..010ec045d 100644 --- a/doc/guides/prog_guide/packet_classif_access_ctrl.rst +++ b/doc/guides/prog_guide/packet_classif_access_ctrl.rst @@ -419,7 +419,7 @@ Classify with Multiple Categories .data = {.userdata = 1, .category_mask = 3, .priority = 1}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,0,0),. mask_range.u32 = 16,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,0,0),. mask_range.u32 = 16,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -433,7 +433,7 @@ Classify with Multiple Categories .data = {.userdata = 2, .category_mask = 1, .priority = 2}, /* destination IPv4 */ - .field[2] = {.value.u32 = IPv4(192,168,1,0),. mask_range.u32 = 24,}, + .field[2] = {.value.u32 = RTE_IPv4(192,168,1,0),. mask_range.u32 = 24,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, @@ -447,7 +447,7 @@ Classify with Multiple Categories .data = {.userdata = 3, .category_mask = 2, .priority = 3}, /* source IPv4 */ - .field[1] = {.value.u32 = IPv4(10,1,1,1),. mask_range.u32 = 32,}, + .field[1] = {.value.u32 = RTE_IPv4(10,1,1,1),. mask_range.u32 = 32,}, /* source port */ .field[3] = {.value.u16 = 0, .mask_range.u16 = 0xffff,}, diff --git a/doc/guides/sample_app_ug/ip_frag.rst b/doc/guides/sample_app_ug/ip_frag.rst index 2583f0c3d..49ba0d8bc 100644 --- a/doc/guides/sample_app_ug/ip_frag.rst +++ b/doc/guides/sample_app_ug/ip_frag.rst @@ -104,14 +104,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ip_reassembly.rst b/doc/guides/sample_app_ug/ip_reassembly.rst index a628b63cb..99dcd9556 100644 --- a/doc/guides/sample_app_ug/ip_reassembly.rst +++ b/doc/guides/sample_app_ug/ip_reassembly.rst @@ -107,14 +107,14 @@ The default l3fwd_ipv4_route_array table is: .. code-block:: c struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100, 10, 0, 0), 16, 0}, - {IPv4(100, 20, 0, 0), 16, 1}, - {IPv4(100, 30, 0, 0), 16, 2}, - {IPv4(100, 40, 0, 0), 16, 3}, - {IPv4(100, 50, 0, 0), 16, 4}, - {IPv4(100, 60, 0, 0), 16, 5}, - {IPv4(100, 70, 0, 0), 16, 6}, - {IPv4(100, 80, 0, 0), 16, 7}, + {RTE_IPv4(100, 10, 0, 0), 16, 0}, + {RTE_IPv4(100, 20, 0, 0), 16, 1}, + {RTE_IPv4(100, 30, 0, 0), 16, 2}, + {RTE_IPv4(100, 40, 0, 0), 16, 3}, + {RTE_IPv4(100, 50, 0, 0), 16, 4}, + {RTE_IPv4(100, 60, 0, 0), 16, 5}, + {RTE_IPv4(100, 70, 0, 0), 16, 6}, + {RTE_IPv4(100, 80, 0, 0), 16, 7}, }; The default l3fwd_ipv6_route_array table is: diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 46c920433..ea7902b2d 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -155,7 +155,7 @@ if the routing table has any ports assigned to the destination address: .. code-block:: c - if (!IS_IPV4_MCAST(dest_addr) || + if (!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 5a3f4d147..40034d003 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -862,8 +862,8 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, if (likely(rte_ipv4_frag_pkt_is_fragmented(ipv4_hdr) == 0)) { ip_hdr_offset = (ipv4_hdr->version_ihl - & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { tcp_hdr = (struct tcp_hdr *) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index d9f71d2eb..47a263a1f 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -2158,7 +2158,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, m->l2_len); frag_field = rte_be_to_cpu_16(ip_hdr->fragment_offset); - if ((frag_field & IPV4_HDR_DF_FLAG) != 0) { + if ((frag_field & RTE_IPV4_HDR_DF_FLAG) != 0) { m->packet_type |= RTE_PTYPE_L4_NONFRAG; /* If IPv4 header has DF flag enabled and TSO support is diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index f7d77f3b6..0658554f8 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2606,8 +2606,8 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, /* Check if it is fragment. */ frag_off = ipv4_spec->hdr.fragment_offset; frag_off = rte_be_to_cpu_16(frag_off); - if (frag_off & IPV4_HDR_OFFSET_MASK || - frag_off & IPV4_HDR_MF_FLAG) + if (frag_off & RTE_IPV4_HDR_OFFSET_MASK || + frag_off & RTE_IPV4_HDR_MF_FLAG) pctype = I40E_FILTER_PCTYPE_FRAG_IPV4; /* Get the filter info */ diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index ebe197852..44b2f85d4 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -4538,7 +4538,7 @@ ixgbe_get_rscctl_maxdesc(struct rte_mempool *pool) /* MAXDESC * SRRCTL.BSIZEPKT must not exceed 64 KB minus one */ uint16_t maxdesc = - IPV4_MAX_PKT_LEN / + RTE_IPV4_MAX_PKT_LEN / (mp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM); if (maxdesc >= 16) diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index e021ea5e0..2270ae304 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -552,7 +552,7 @@ static const struct { }, .ipv6.hdr = { .proto = 0xff, - .vtc_flow = RTE_BE32(0xfful << IPV6_HDR_FL_SHIFT), + .vtc_flow = RTE_BE32(0xfful << RTE_IPV6_HDR_FL_SHIFT), .hop_limits = 0xff, .src_addr = "\xff\xff\xff\xff\xff\xff\xff\xff" @@ -1426,7 +1426,7 @@ flow_tcf_validate_vxlan_encap_ipv6(const struct rte_flow_item *item, " vxlan encapsulation"); } msk6 = (rte_be_to_cpu_32(mask->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; if (msk6 && msk6 != 0xff) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM_MASK, mask, @@ -2551,7 +2551,7 @@ flow_tcf_get_items_size(const struct rte_flow_attr *attr, if (ipv6 && ipv6->hdr.hop_limits) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; if (ipv6 && (rte_be_to_cpu_32(ipv6->hdr.vtc_flow) & - (0xfful << IPV6_HDR_TC_SHIFT))) + (0xfful << RTE_IPV6_HDR_TC_SHIFT))) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; break; } @@ -2639,7 +2639,7 @@ flow_tcf_vxlan_encap_size(const struct rte_flow_action *action) if (ipv6 && ipv6->hdr.hop_limits) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; if (ipv6 && (rte_be_to_cpu_32(ipv6->hdr.vtc_flow) & - (0xfful << IPV6_HDR_TC_SHIFT))) + (0xfful << RTE_IPV6_HDR_TC_SHIFT))) size += SZ_NLATTR_TYPE_OF(uint8_t) * 2; break; } @@ -3037,11 +3037,11 @@ flow_tcf_parse_vxlan_encap_ipv6(const struct rte_flow_item_ipv6 *spec, FLOW_TCF_ENCAP_IPV6_DST; if (mask) { if ((rte_be_to_cpu_32(mask->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff) { + RTE_IPV6_HDR_TC_SHIFT) & 0xff) { encap->mask |= FLOW_TCF_ENCAP_IP_TOS; encap->ip_tos = (rte_be_to_cpu_32 (spec->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; } if (mask->hdr.hop_limits) { encap->mask |= FLOW_TCF_ENCAP_IP_TTL; @@ -3590,11 +3590,11 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, mask.ipv6->hdr.hop_limits); } msk6 = (rte_be_to_cpu_32(mask.ipv6->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; if (msk6) { tos6 = (rte_be_to_cpu_32 (spec.ipv6->hdr.vtc_flow) >> - IPV6_HDR_TC_SHIFT) & 0xff; + RTE_IPV6_HDR_TC_SHIFT) & 0xff; mnl_attr_put_u8 (nlh, tunnel_outer ? TCA_FLOWER_KEY_ENC_IP_TOS : diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 55aa8054f..2f4c80cb0 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -480,17 +480,17 @@ flow_verbs_translate_item_ipv6(struct mlx5_flow *dev_flow, vtc_flow_val = rte_be_to_cpu_32(spec->hdr.vtc_flow); vtc_flow_mask = rte_be_to_cpu_32(mask->hdr.vtc_flow); ipv6.val.flow_label = - rte_cpu_to_be_32((vtc_flow_val & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.val.traffic_class = (vtc_flow_val & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_val & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.val.traffic_class = (vtc_flow_val & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.val.next_hdr = spec->hdr.proto; ipv6.val.hop_limit = spec->hdr.hop_limits; ipv6.mask.flow_label = - rte_cpu_to_be_32((vtc_flow_mask & IPV6_HDR_FL_MASK) >> - IPV6_HDR_FL_SHIFT); - ipv6.mask.traffic_class = (vtc_flow_mask & IPV6_HDR_TC_MASK) >> - IPV6_HDR_TC_SHIFT; + rte_cpu_to_be_32((vtc_flow_mask & RTE_IPV6_HDR_FL_MASK) >> + RTE_IPV6_HDR_FL_SHIFT); + ipv6.mask.traffic_class = (vtc_flow_mask & RTE_IPV6_HDR_TC_MASK) >> + RTE_IPV6_HDR_TC_SHIFT; ipv6.mask.next_hdr = mask->hdr.proto; ipv6.mask.hop_limit = mask->hdr.hop_limits; /* Remove unwanted bits from values. */ diff --git a/drivers/net/tap/tap_bpf_program.c b/drivers/net/tap/tap_bpf_program.c index 2b1dba15b..531569b12 100644 --- a/drivers/net/tap/tap_bpf_program.c +++ b/drivers/net/tap/tap_bpf_program.c @@ -19,7 +19,7 @@ #include "tap_rss.h" /** Create IPv4 address */ -#define IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) @@ -157,11 +157,11 @@ rss_l3_l4(struct __sk_buff *skb) __u8 *src_dst_addr = data + off + offsetof(struct iphdr, saddr); __u8 *src_dst_port = data + off + sizeof(struct iphdr); struct ipv4_l3_l4_tuple v4_tuple = { - .src_addr = IPv4(*(src_dst_addr + 0), + .src_addr = RTE_IPv4(*(src_dst_addr + 0), *(src_dst_addr + 1), *(src_dst_addr + 2), *(src_dst_addr + 3)), - .dst_addr = IPv4(*(src_dst_addr + 4), + .dst_addr = RTE_IPv4(*(src_dst_addr + 4), *(src_dst_addr + 5), *(src_dst_addr + 6), *(src_dst_addr + 7)), diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 576090239..a6a69df22 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -684,8 +684,8 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, - sizeof(struct tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); - hlen += (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index c75a410f4..e68d0f694 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -379,7 +379,7 @@ parse_ipv4_net(char *in, uint32_t *addr, uint32_t *mask_len) if (get_cb_field(&in, &m, 0, sizeof(uint32_t) * CHAR_BIT, 0)) return -EINVAL; - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; } diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 847f9ab60..f8b303346 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -169,14 +169,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 0d5bf0a85..8351270c0 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -190,14 +190,14 @@ struct l3fwd_ipv4_route { }; struct l3fwd_ipv4_route l3fwd_ipv4_route_array[] = { - {IPv4(100,10,0,0), 16, 0}, - {IPv4(100,20,0,0), 16, 1}, - {IPv4(100,30,0,0), 16, 2}, - {IPv4(100,40,0,0), 16, 3}, - {IPv4(100,50,0,0), 16, 4}, - {IPv4(100,60,0,0), 16, 5}, - {IPv4(100,70,0,0), 16, 6}, - {IPv4(100,80,0,0), 16, 7}, + {RTE_IPv4(100,10,0,0), 16, 0}, + {RTE_IPv4(100,20,0,0), 16, 1}, + {RTE_IPv4(100,30,0,0), 16, 2}, + {RTE_IPv4(100,40,0,0), 16, 3}, + {RTE_IPv4(100,50,0,0), 16, 4}, + {RTE_IPv4(100,60,0,0), 16, 5}, + {RTE_IPv4(100,70,0,0), 16, 6}, + {RTE_IPv4(100,80,0,0), 16, 7}, }; /* diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 8043ed54a..8a3d89497 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -951,7 +951,7 @@ get_spi_proto(uint32_t spi, enum rte_security_ipsec_sa_direction dir) if (rc6 >= 0) { RTE_LOG(ERR, IPSEC, "%s: SPI %u used simultaeously by " - "IPv4(%d) and IPv6 (%d) SP rules\n", + "RTE_IPv4(%d) and IPv6 (%d) SP rules\n", __func__, spi, rc4, rc6); return -EINVAL; } else @@ -1040,7 +1040,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) struct rte_ipsec_sa_prm prm; struct rte_ipv4_hdr v4 = { .version_ihl = IPVERSION << 4 | - sizeof(v4) / IPV4_IHL_MULTIPLIER, + sizeof(v4) / RTE_IPV4_IHL_MULTIPLIER, .time_to_live = IPDEFTTL, .next_proto_id = IPPROTO_ESP, .src_addr = lsa->src.ip.ip4, diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index a84d28c86..15f2b4b27 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -138,21 +138,21 @@ struct mcast_group_params { }; static struct mcast_group_params mcast_group_table[] = { - {IPv4(224,0,0,101), 0x1}, - {IPv4(224,0,0,102), 0x2}, - {IPv4(224,0,0,103), 0x3}, - {IPv4(224,0,0,104), 0x4}, - {IPv4(224,0,0,105), 0x5}, - {IPv4(224,0,0,106), 0x6}, - {IPv4(224,0,0,107), 0x7}, - {IPv4(224,0,0,108), 0x8}, - {IPv4(224,0,0,109), 0x9}, - {IPv4(224,0,0,110), 0xA}, - {IPv4(224,0,0,111), 0xB}, - {IPv4(224,0,0,112), 0xC}, - {IPv4(224,0,0,113), 0xD}, - {IPv4(224,0,0,114), 0xE}, - {IPv4(224,0,0,115), 0xF}, + {RTE_IPv4(224,0,0,101), 0x1}, + {RTE_IPv4(224,0,0,102), 0x2}, + {RTE_IPv4(224,0,0,103), 0x3}, + {RTE_IPv4(224,0,0,104), 0x4}, + {RTE_IPv4(224,0,0,105), 0x5}, + {RTE_IPv4(224,0,0,106), 0x6}, + {RTE_IPv4(224,0,0,107), 0x7}, + {RTE_IPv4(224,0,0,108), 0x8}, + {RTE_IPv4(224,0,0,109), 0x9}, + {RTE_IPv4(224,0,0,110), 0xA}, + {RTE_IPv4(224,0,0,111), 0xB}, + {RTE_IPv4(224,0,0,112), 0xC}, + {RTE_IPv4(224,0,0,113), 0xD}, + {RTE_IPv4(224,0,0,114), 0xE}, + {RTE_IPv4(224,0,0,115), 0xF}, }; #define N_MCAST_GROUPS \ @@ -317,7 +317,7 @@ mcast_forward(struct rte_mbuf *m, struct lcore_queue_conf *qconf) * Check that it is a valid multicast address and * we have some active ports assigned to it. */ - if(!IS_IPV4_MCAST(dest_addr) || + if (!RTE_IS_IPV4_MCAST(dest_addr) || (hash = rte_fbk_hash_lookup(mcast_hash, dest_addr)) <= 0 || (port_mask = hash & enabled_port_mask) == 0) { rte_pktmbuf_free(m); diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 06f5d1db1..afc658e5d 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -404,8 +404,8 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, ip_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(m, char *) + ipdata_offset); - ipdata_offset += (ip_hdr->version_ihl & IPV4_HDR_IHL_MASK) - * IPV4_IHL_MULTIPLIER; + ipdata_offset += (ip_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) + * RTE_IPV4_IHL_MULTIPLIER; /* Zero pad data to be crypto'd so it is block aligned */ diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 16ab0d0fd..40ab5a52d 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -901,7 +901,7 @@ parse_ipv4_net(const char *in, uint32_t *addr, uint32_t *mask_len) GET_CB_FIELD(in, d, 0, UINT8_MAX, '/'); GET_CB_FIELD(in, m, 0, sizeof(uint32_t) * CHAR_BIT, 0); - addr[0] = IPv4(a, b, c, d); + addr[0] = RTE_IPv4(a, b, c, d); mask_len[0] = m; return 0; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index b1da553e9..2c6da3ffc 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -258,10 +258,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -300,14 +300,14 @@ struct ipv4_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define IPV4_L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index ebb2378dd..5e3809b8d 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -201,10 +201,10 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {{IPv4(100,10,0,1), IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(100,20,0,2), IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(100,30,0,3), IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, - {{IPv4(100,40,0,4), IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, + {{RTE_IPv4(100,10,0,1), RTE_IPv4(200,10,0,1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(100,20,0,2), RTE_IPv4(200,20,0,2), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(100,30,0,3), RTE_IPv4(200,30,0,3), 103, 13, IPPROTO_TCP}, 2}, + {{RTE_IPv4(100,40,0,4), RTE_IPv4(200,40,0,4), 104, 14, IPPROTO_TCP}, 3}, }; typedef struct rte_hash lookup_struct_t; @@ -234,14 +234,14 @@ struct l3fwd_route { }; static struct l3fwd_route l3fwd_route_array[] = { - {IPv4(1,1,1,0), 24, 0}, - {IPv4(2,1,1,0), 24, 1}, - {IPv4(3,1,1,0), 24, 2}, - {IPv4(4,1,1,0), 24, 3}, - {IPv4(5,1,1,0), 24, 4}, - {IPv4(6,1,1,0), 24, 5}, - {IPv4(7,1,1,0), 24, 6}, - {IPv4(8,1,1,0), 24, 7}, + {RTE_IPv4(1,1,1,0), 24, 0}, + {RTE_IPv4(2,1,1,0), 24, 1}, + {RTE_IPv4(3,1,1,0), 24, 2}, + {RTE_IPv4(4,1,1,0), 24, 3}, + {RTE_IPv4(5,1,1,0), 24, 4}, + {RTE_IPv4(6,1,1,0), 24, 5}, + {RTE_IPv4(7,1,1,0), 24, 6}, + {RTE_IPv4(8,1,1,0), 24, 7}, }; #define L3FWD_NUM_ROUTES \ diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c index 5cf5f677a..2911bbefd 100644 --- a/examples/l3fwd/l3fwd_em.c +++ b/examples/l3fwd/l3fwd_em.c @@ -99,10 +99,10 @@ struct ipv6_l3fwd_em_route { }; static struct ipv4_l3fwd_em_route ipv4_l3fwd_em_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_em_route ipv6_l3fwd_em_route_array[] = { @@ -426,19 +426,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_em_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_em_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_em_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_em_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); @@ -576,8 +576,8 @@ em_parse_ptype(struct rte_mbuf *m) l3 = (uint8_t *)eth_hdr + sizeof(struct rte_ether_hdr); if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_IPv4)) { ipv4_hdr = (struct rte_ipv4_hdr *)l3; - hdr_len = (ipv4_hdr->version_ihl & IPV4_HDR_IHL_MASK) * - IPV4_IHL_MULTIPLIER; + hdr_len = (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * + RTE_IPV4_IHL_MULTIPLIER; if (hdr_len == sizeof(struct rte_ipv4_hdr)) { packet_type |= RTE_PTYPE_L3_IPV4; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index 5fa8c5380..6bfc3be68 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -43,14 +43,14 @@ struct ipv6_l3fwd_lpm_route { /* 192.18.0.0/16 are set aside for RFC2544 benchmarking. */ static struct ipv4_l3fwd_lpm_route ipv4_l3fwd_lpm_route_array[] = { - {IPv4(192, 18, 0, 0), 24, 0}, - {IPv4(192, 18, 1, 0), 24, 1}, - {IPv4(192, 18, 2, 0), 24, 2}, - {IPv4(192, 18, 3, 0), 24, 3}, - {IPv4(192, 18, 4, 0), 24, 4}, - {IPv4(192, 18, 5, 0), 24, 5}, - {IPv4(192, 18, 6, 0), 24, 6}, - {IPv4(192, 18, 7, 0), 24, 7}, + {RTE_IPv4(192, 18, 0, 0), 24, 0}, + {RTE_IPv4(192, 18, 1, 0), 24, 1}, + {RTE_IPv4(192, 18, 2, 0), 24, 2}, + {RTE_IPv4(192, 18, 3, 0), 24, 3}, + {RTE_IPv4(192, 18, 4, 0), 24, 4}, + {RTE_IPv4(192, 18, 5, 0), 24, 5}, + {RTE_IPv4(192, 18, 6, 0), 24, 6}, + {RTE_IPv4(192, 18, 7, 0), 24, 7}, }; /* 2001:0200::/48 is IANA reserved range for IPv6 benchmarking (RFC5180) */ diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index a909f35cd..364057997 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -380,10 +380,10 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {{IPv4(101, 0, 0, 0), IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, - {{IPv4(201, 0, 0, 0), IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, - {{IPv4(111, 0, 0, 0), IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, - {{IPv4(211, 0, 0, 0), IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, + {{RTE_IPv4(101, 0, 0, 0), RTE_IPv4(100, 10, 0, 1), 101, 11, IPPROTO_TCP}, 0}, + {{RTE_IPv4(201, 0, 0, 0), RTE_IPv4(200, 20, 0, 1), 102, 12, IPPROTO_TCP}, 1}, + {{RTE_IPv4(111, 0, 0, 0), RTE_IPv4(100, 30, 0, 1), 101, 11, IPPROTO_TCP}, 2}, + {{RTE_IPv4(211, 0, 0, 0), RTE_IPv4(200, 40, 0, 1), 102, 12, IPPROTO_TCP}, 3}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -503,14 +503,14 @@ struct ipv6_l3fwd_route { }; static struct ipv4_l3fwd_route ipv4_l3fwd_route_array[] = { - {IPv4(1, 1, 1, 0), 24, 0}, - {IPv4(2, 1, 1, 0), 24, 1}, - {IPv4(3, 1, 1, 0), 24, 2}, - {IPv4(4, 1, 1, 0), 24, 3}, - {IPv4(5, 1, 1, 0), 24, 4}, - {IPv4(6, 1, 1, 0), 24, 5}, - {IPv4(7, 1, 1, 0), 24, 6}, - {IPv4(8, 1, 1, 0), 24, 7}, + {RTE_IPv4(1, 1, 1, 0), 24, 0}, + {RTE_IPv4(2, 1, 1, 0), 24, 1}, + {RTE_IPv4(3, 1, 1, 0), 24, 2}, + {RTE_IPv4(4, 1, 1, 0), 24, 3}, + {RTE_IPv4(5, 1, 1, 0), 24, 4}, + {RTE_IPv4(6, 1, 1, 0), 24, 5}, + {RTE_IPv4(7, 1, 1, 0), 24, 6}, + {RTE_IPv4(8, 1, 1, 0), 24, 7}, }; static struct ipv6_l3fwd_route ipv6_l3fwd_route_array[] = { @@ -3145,19 +3145,19 @@ populate_ipv4_many_flow_into_table(const struct rte_hash *h, switch (i & (NUMBER_PORT_USED - 1)) { case 0: entry = ipv4_l3fwd_route_array[0]; - entry.key.ip_dst = IPv4(101, c, b, a); + entry.key.ip_dst = RTE_IPv4(101, c, b, a); break; case 1: entry = ipv4_l3fwd_route_array[1]; - entry.key.ip_dst = IPv4(201, c, b, a); + entry.key.ip_dst = RTE_IPv4(201, c, b, a); break; case 2: entry = ipv4_l3fwd_route_array[2]; - entry.key.ip_dst = IPv4(111, c, b, a); + entry.key.ip_dst = RTE_IPv4(111, c, b, a); break; case 3: entry = ipv4_l3fwd_route_array[3]; - entry.key.ip_dst = IPv4(211, c, b, a); + entry.key.ip_dst = RTE_IPv4(211, c, b, a); break; }; convert_ipv4_5tuple(&entry.key, &newkey); diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index c37b4ef3e..20f2ea7e6 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -239,7 +239,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 8e2a1dd5e..d1becb6f3 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -348,11 +348,12 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, * whose DF bit is 1, IPv4 ID is ignored. */ frag_off = rte_be_to_cpu_16(outer_ipv4_hdr->fragment_offset); - outer_is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + outer_is_atomic = + (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; outer_ip_id = outer_is_atomic ? 0 : rte_be_to_cpu_16(outer_ipv4_hdr->packet_id); frag_off = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); - is_atomic = (frag_off & IPV4_HDR_DF_FLAG) == IPV4_HDR_DF_FLAG; + is_atomic = (frag_off & RTE_IPV4_HDR_DF_FLAG) == RTE_IPV4_HDR_DF_FLAG; ip_id = is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 5f2adc833..13c9aeea8 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -12,8 +12,8 @@ #include <rte_tcp.h> #include <rte_udp.h> -#define IS_FRAGMENTED(frag_off) (((frag_off) & IPV4_HDR_OFFSET_MASK) != 0 \ - || ((frag_off) & IPV4_HDR_MF_FLAG) == IPV4_HDR_MF_FLAG) +#define IS_FRAGMENTED(frag_off) (((frag_off) & RTE_IPV4_HDR_OFFSET_MASK) != 0 \ + || ((frag_off) & RTE_IPV4_HDR_MF_FLAG) == RTE_IPV4_HDR_MF_FLAG) #define TCP_HDR_PSH_MASK ((uint8_t)0x08) #define TCP_HDR_FIN_MASK ((uint8_t)0x01) diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h index 0d9bf94b8..2273f3864 100644 --- a/lib/librte_ip_frag/rte_ip_frag.h +++ b/lib/librte_ip_frag/rte_ip_frag.h @@ -309,8 +309,8 @@ rte_ipv4_frag_pkt_is_fragmented(const struct rte_ipv4_hdr *hdr) uint16_t flag_offset, ip_flag, ip_ofs; flag_offset = rte_be_to_cpu_16(hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); return ip_flag != 0 || ip_ofs != 0; } diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index 4707119b5..221d74e1d 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -12,22 +12,22 @@ #include "ip_frag_common.h" /* Fragment Offset */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_MASK (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_MASK (1 << IPV4_HDR_MF_SHIFT) +#define IPV4_HDR_DF_MASK (1 << RTE_IPV4_HDR_DF_SHIFT) +#define IPV4_HDR_MF_MASK (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_FO_ALIGN (1 << IPV4_HDR_FO_SHIFT) +#define IPV4_HDR_FO_ALIGN (1 << RTE_IPV4_HDR_FO_SHIFT) static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, const struct rte_ipv4_hdr *src, uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) { rte_memcpy(dst, src, sizeof(*dst)); - fofs = (uint16_t)(fofs + (dofs >> IPV4_HDR_FO_SHIFT)); - fofs = (uint16_t)(fofs | mf << IPV4_HDR_MF_SHIFT); + fofs = (uint16_t)(fofs + (dofs >> RTE_IPV4_HDR_FO_SHIFT)); + fofs = (uint16_t)(fofs | mf << RTE_IPV4_HDR_MF_SHIFT); dst->fragment_offset = rte_cpu_to_be_16(fofs); dst->total_length = rte_cpu_to_be_16(len); dst->hdr_checksum = 0; diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 97da607ed..b7b92ed28 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -75,7 +75,7 @@ ipv4_frag_reassemble(struct ip_frag_pkt *fp) ip_hdr->total_length = rte_cpu_to_be_16((uint16_t)(fp->total_size + m->l3_len)); ip_hdr->fragment_offset = (uint16_t)(ip_hdr->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_DF_FLAG)); + rte_cpu_to_be_16(RTE_IPV4_HDR_DF_FLAG)); ip_hdr->hdr_checksum = 0; return m; @@ -109,8 +109,8 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, int32_t ip_len; flag_offset = rte_be_to_cpu_16(ip_hdr->fragment_offset); - ip_ofs = (uint16_t)(flag_offset & IPV4_HDR_OFFSET_MASK); - ip_flag = (uint16_t)(flag_offset & IPV4_HDR_MF_FLAG); + ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); + ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); psd = (unaligned_uint64_t *)&ip_hdr->src_addr; /* use first 8 bytes only */ @@ -118,7 +118,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, key.id = ip_hdr->packet_id; key.key_len = IPV4_KEYLEN; - ip_ofs *= IPV4_HDR_OFFSET_UNITS; + ip_ofs *= RTE_IPV4_HDR_OFFSET_UNITS; ip_len = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len; IP_FRAG_LOG(DEBUG, "%s:%d:\n" diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index a1431ee90..9b1944b0f 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -42,52 +42,55 @@ struct rte_ipv4_hdr { } __attribute__((__packed__)); /** Create IPv4 address */ -#define IPv4(a,b,c,d) ((uint32_t)(((a) & 0xff) << 24) | \ +#define RTE_IPv4(a, b, c, d) ((uint32_t)(((a) & 0xff) << 24) | \ (((b) & 0xff) << 16) | \ (((c) & 0xff) << 8) | \ ((d) & 0xff)) /** Maximal IPv4 packet length (including a header) */ -#define IPV4_MAX_PKT_LEN 65535 +#define RTE_IPV4_MAX_PKT_LEN 65535 /** Internet header length mask for version_ihl field */ -#define IPV4_HDR_IHL_MASK (0x0f) +#define RTE_IPV4_HDR_IHL_MASK (0x0f) /** * Internet header length field multiplier (IHL field specifies overall header * length in number of 4-byte words) */ -#define IPV4_IHL_MULTIPLIER (4) +#define RTE_IPV4_IHL_MULTIPLIER (4) /* Fragment Offset * Flags. */ -#define IPV4_HDR_DF_SHIFT 14 -#define IPV4_HDR_MF_SHIFT 13 -#define IPV4_HDR_FO_SHIFT 3 +#define RTE_IPV4_HDR_DF_SHIFT 14 +#define RTE_IPV4_HDR_MF_SHIFT 13 +#define RTE_IPV4_HDR_FO_SHIFT 3 -#define IPV4_HDR_DF_FLAG (1 << IPV4_HDR_DF_SHIFT) -#define IPV4_HDR_MF_FLAG (1 << IPV4_HDR_MF_SHIFT) +#define RTE_IPV4_HDR_DF_FLAG (1 << RTE_IPV4_HDR_DF_SHIFT) +#define RTE_IPV4_HDR_MF_FLAG (1 << RTE_IPV4_HDR_MF_SHIFT) -#define IPV4_HDR_OFFSET_MASK ((1 << IPV4_HDR_MF_SHIFT) - 1) +#define RTE_IPV4_HDR_OFFSET_MASK ((1 << RTE_IPV4_HDR_MF_SHIFT) - 1) -#define IPV4_HDR_OFFSET_UNITS 8 +#define RTE_IPV4_HDR_OFFSET_UNITS 8 /* * IPv4 address types */ -#define IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ -#define IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ -#define IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ -#define IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ -#define IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ -#define IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ +#define RTE_IPV4_ANY ((uint32_t)0x00000000) /**< 0.0.0.0 */ +#define RTE_IPV4_LOOPBACK ((uint32_t)0x7f000001) /**< 127.0.0.1 */ +#define RTE_IPV4_BROADCAST ((uint32_t)0xe0000000) /**< 224.0.0.0 */ +#define RTE_IPV4_ALLHOSTS_GROUP ((uint32_t)0xe0000001) /**< 224.0.0.1 */ +#define RTE_IPV4_ALLRTRS_GROUP ((uint32_t)0xe0000002) /**< 224.0.0.2 */ +#define RTE_IPV4_MAX_LOCAL_GROUP ((uint32_t)0xe00000ff) /**< 224.0.0.255 */ /* * IPv4 Multicast-related macros */ -#define IPV4_MIN_MCAST IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ -#define IPV4_MAX_MCAST IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ +#define RTE_IPV4_MIN_MCAST \ + RTE_IPv4(224, 0, 0, 0) /**< Minimal IPv4-multicast address */ +#define RTE_IPV4_MAX_MCAST \ + RTE_IPv4(239, 255, 255, 255) /**< Maximum IPv4 multicast address */ -#define IS_IPV4_MCAST(x) \ - ((x) >= IPV4_MIN_MCAST && (x) <= IPV4_MAX_MCAST) /**< check if IPv4 address is multicast */ +#define RTE_IS_IPV4_MCAST(x) \ + ((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST) + /**< check if IPv4 address is multicast */ /** * @internal Calculate a sum of all words in the buffer. @@ -349,10 +352,10 @@ struct rte_ipv6_hdr { } __attribute__((__packed__)); /* IPv6 vtc_flow: IPv / TC / flow_label */ -#define IPV6_HDR_FL_SHIFT 0 -#define IPV6_HDR_TC_SHIFT 20 -#define IPV6_HDR_FL_MASK ((1u << IPV6_HDR_TC_SHIFT) - 1) -#define IPV6_HDR_TC_MASK (0xf << IPV6_HDR_TC_SHIFT) +#define RTE_IPV6_HDR_FL_SHIFT 0 +#define RTE_IPV6_HDR_TC_SHIFT 20 +#define RTE_IPV6_HDR_FL_MASK ((1u << RTE_IPV6_HDR_TC_SHIFT) - 1) +#define RTE_IPV6_HDR_TC_MASK (0xf << RTE_IPV6_HDR_TC_SHIFT) /** * Process the pseudo-header checksum of an IPv6 header. diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index b01cacb9c..712383484 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -315,7 +315,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, return pkt_type; if (ip4h->fragment_offset & rte_cpu_to_be_16( - IPV4_HDR_OFFSET_MASK | IPV4_HDR_MF_FLAG)) { + RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_L4_FRAG; hdr_lens->l4_len = 0; return pkt_type; @@ -446,8 +446,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_INNER_L4_MASK) == 0) return pkt_type; if (ip4h->fragment_offset & - rte_cpu_to_be_16(IPV4_HDR_OFFSET_MASK | - IPV4_HDR_MF_FLAG)) { + rte_cpu_to_be_16(RTE_IPV4_HDR_OFFSET_MASK | + RTE_IPV4_HDR_MF_FLAG)) { pkt_type |= RTE_PTYPE_INNER_L4_FRAG; hdr_lens->inner_l4_len = 0; return pkt_type; diff --git a/lib/librte_port/rte_port_ras.c b/lib/librte_port/rte_port_ras.c index 225802892..403028f8d 100644 --- a/lib/librte_port/rte_port_ras.c +++ b/lib/librte_port/rte_port_ras.c @@ -156,8 +156,8 @@ process_ipv4(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt) /* Get "More fragments" flag and fragment offset */ uint16_t frag_field = rte_be_to_cpu_16(pkt_hdr->fragment_offset); - uint16_t frag_offset = (uint16_t)(frag_field & IPV4_HDR_OFFSET_MASK); - uint16_t frag_flag = (uint16_t)(frag_field & IPV4_HDR_MF_FLAG); + uint16_t frag_offset = (uint16_t)(frag_field & RTE_IPV4_HDR_OFFSET_MASK); + uint16_t frag_flag = (uint16_t)(frag_field & RTE_IPV4_HDR_MF_FLAG); /* If it is a fragmented packet, then try to reassemble */ if ((frag_flag == 0) && (frag_offset == 0)) -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 11/15] net: add rte prefix to ip defines 2019-05-21 16:13 ` [dpdk-dev] [PATCH 11/15] net: add rte prefix to ip defines Olivier Matz @ 2019-05-29 8:41 ` David Marchand 0 siblings, 0 replies; 107+ messages in thread From: David Marchand @ 2019-05-29 8:41 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, Stephen Hemminger, Yigit, Ferruh On Tue, May 21, 2019 at 6:15 PM Olivier Matz <olivier.matz@6wind.com> wrote: > > diff --git a/drivers/net/tap/tap_bpf_program.c > b/drivers/net/tap/tap_bpf_program.c > index 2b1dba15b..531569b12 100644 > --- a/drivers/net/tap/tap_bpf_program.c > +++ b/drivers/net/tap/tap_bpf_program.c > @@ -19,7 +19,7 @@ > #include "tap_rss.h" > > /** Create IPv4 address */ > -#define IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ > +#define RTE_IPv4(a, b, c, d) ((__u32)(((a) & 0xff) << 24) | \ > (((b) & 0xff) << 16) | \ > (((c) & 0xff) << 8) | \ > ((d) & 0xff)) > @@ -157,11 +157,11 @@ rss_l3_l4(struct __sk_buff *skb) > __u8 *src_dst_addr = data + off + offsetof(struct iphdr, > saddr); > __u8 *src_dst_port = data + off + sizeof(struct iphdr); > struct ipv4_l3_l4_tuple v4_tuple = { > - .src_addr = IPv4(*(src_dst_addr + 0), > + .src_addr = RTE_IPv4(*(src_dst_addr + 0), > *(src_dst_addr + 1), > *(src_dst_addr + 2), > *(src_dst_addr + 3)), > - .dst_addr = IPv4(*(src_dst_addr + 4), > + .dst_addr = RTE_IPv4(*(src_dst_addr + 4), > *(src_dst_addr + 5), > *(src_dst_addr + 6), > *(src_dst_addr + 7)), > > Idem patch 3. -- David Marchand ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 12/15] net: add rte prefix to sctp structure 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (10 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 11/15] net: add rte prefix to ip defines Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 13/15] net: add rte prefix to tcp structure Olivier Matz ` (5 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to structures: - rename struct sctp_hdr as struct rte_sctp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 5 +++-- app/test/packet_burst_generator.c | 6 +++--- app/test/packet_burst_generator.h | 2 +- app/test/test_flow_classify.c | 2 +- drivers/net/e1000/igb_rxtx.c | 3 ++- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 4 ++-- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 3 ++- examples/tep_termination/vxlan.c | 5 +++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_sctp.h | 2 +- lib/librte_vhost/virtio_net.c | 4 ++-- 17 files changed, 40 insertions(+), 36 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 9e6630e80..1df83477e 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -368,7 +368,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -435,7 +435,8 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_TCP_SEG; } else if (info->l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *) + ((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; /* sctp payload must be a multiple of 4 to be * offloaded */ diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 02afc5547..ab65c3f07 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -124,7 +124,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, } uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; @@ -402,7 +402,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; @@ -427,7 +427,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_SCTP: copy_buf_to_pkt(proto_hdr, - sizeof(struct sctp_hdr), pkt, + sizeof(struct rte_sctp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index c8bc372db..6a9d4dce8 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -43,7 +43,7 @@ initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_sctp_header(struct sctp_hdr *sctp_hdr, uint16_t src_port, +initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index f2c100a0d..d228ccc10 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -567,7 +567,7 @@ init_ipv4_sctp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct sctp_hdr pkt_sctp_hdr; + struct rte_sctp_hdr pkt_sctp_hdr; uint32_t src_addr = IPV4_ADDR(11, 12, 13, 14); uint32_t dst_addr = IPV4_ADDR(15, 16, 17, 18); uint16_t src_port = 10; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 01f5e735b..e814a0050 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -299,7 +299,8 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) + << E1000_ADVTXD_L4LEN_SHIFT; break; default: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_RSV | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 65d0be3b6..f4d604a46 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -152,7 +152,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -175,7 +175,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, * manually set proto_id=sctp below. */ enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP || @@ -246,7 +246,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { - struct sctp_hdr sctp_mask, sctp_val; + struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); memset(&sctp_val, 0, sizeof(sctp_val)); @@ -264,7 +264,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, 0, FILTER_GENERIC_1_L4, &sctp_mask, - &sctp_val, sizeof(struct sctp_hdr)); + &sctp_val, sizeof(struct rte_sctp_hdr)); } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP || diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index d15b00942..a1582d019 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -910,9 +910,9 @@ enic_copy_item_sctp_v2(struct copy_item_args *arg) mask = &rte_flow_item_sctp_mask; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct sctp_hdr)); + sizeof(struct rte_sctp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index b20f30fb4..14a82426e 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -801,7 +801,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload, *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ int len; @@ -841,8 +841,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -886,8 +886,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP: - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1091,7 +1091,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *ptr; struct udp_hdr *udp; struct tcp_hdr *tcp; - struct sctp_hdr *sctp; + struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; struct rte_ipv6_hdr *gtp_ipv6; @@ -1138,8 +1138,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->dst_port = fdir_input->flow.tcp4_flow.src_port; tcp->data_off = I40E_FDIR_TCP_DEFAULT_DATAOFF; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1175,8 +1175,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, tcp->src_port = fdir_input->flow.udp6_flow.dst_port; tcp->dst_port = fdir_input->flow.udp6_flow.src_port; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) { - sctp = (struct sctp_hdr *)(raw_pkt + len); - payload = (unsigned char *)sctp + sizeof(struct sctp_hdr); + sctp = (struct rte_sctp_hdr *)(raw_pkt + len); + payload = (unsigned char *)sctp + sizeof(struct rte_sctp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index c0ded1d26..fcbae1a33 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -307,7 +307,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 3b83605e8..c0fc0a3e7 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1422,7 +1422,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 40e5db767..69f749a08 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1767,7 +1767,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_SCTP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_SCTP; - *td_offset |= (sizeof(struct sctp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_sctp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; case PKT_TX_UDP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 44b2f85d4..a0bd3b366 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -436,7 +436,8 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_SCTP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct sctp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_sctp_hdr) + << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 084b06e19..1add9904a 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -79,7 +79,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; struct tcp_hdr *tcp_hdr; - struct sctp_hdr *sctp_hdr; + struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; info->l2_len = sizeof(struct rte_ether_hdr); @@ -129,7 +129,8 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, tcp_hdr->cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_SCTP) { - sctp_hdr = (struct sctp_hdr *)((char *)l3_hdr + info->l3_len); + sctp_hdr = (struct rte_sctp_hdr *) + ((char *)l3_hdr + info->l3_len); sctp_hdr->cksum = 0; ol_flags |= PKT_TX_SCTP_CKSUM; } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index e2b441f24..0e4e3a5a5 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -730,7 +730,7 @@ static const struct rte_flow_item_tcp rte_flow_item_tcp_mask = { * Matches a SCTP header. */ struct rte_flow_item_sctp { - struct sctp_hdr hdr; /**< SCTP header definition. */ + struct rte_sctp_hdr hdr; /**< SCTP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_SCTP. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 712383484..4a46df58d 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -370,7 +370,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = (th->data_off & 0xf0) >> 2; return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_SCTP) { - hdr_lens->l4_len = sizeof(struct sctp_hdr); + hdr_lens->l4_len = sizeof(struct rte_sctp_hdr); return pkt_type; } else { uint32_t prev_off = off; @@ -506,7 +506,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = (th->data_off & 0xf0) >> 2; } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_SCTP) { - hdr_lens->inner_l4_len = sizeof(struct sctp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_sctp_hdr); } else { hdr_lens->inner_l4_len = 0; } diff --git a/lib/librte_net/rte_sctp.h b/lib/librte_net/rte_sctp.h index bfb7165a6..b3661b0db 100644 --- a/lib/librte_net/rte_sctp.h +++ b/lib/librte_net/rte_sctp.h @@ -23,7 +23,7 @@ extern "C" { /** * SCTP Header */ -struct sctp_hdr { +struct rte_sctp_hdr { uint16_t src_port; /**< Source port. */ uint16_t dst_port; /**< Destin port. */ uint32_t tag; /**< Validation tag. */ diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index db364debd..1f5555392 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -226,7 +226,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: - net_hdr->csum_offset = (offsetof(struct sctp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_sctp_hdr, cksum)); break; } @@ -1032,7 +1032,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; - case (offsetof(struct sctp_hdr, cksum)): + case (offsetof(struct rte_sctp_hdr, cksum)): if (l4_proto == IPPROTO_SCTP) m->ol_flags |= PKT_TX_SCTP_CKSUM; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 13/15] net: add rte prefix to tcp structure 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (11 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 12/15] net: add rte prefix to sctp structure Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 14/15] net: add rte prefix to udp structure Olivier Matz ` (4 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to structures: - rename struct tcp_hdr as struct rte_tcp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 14 ++++++++------ app/test/packet_burst_generator.c | 10 +++++----- app/test/packet_burst_generator.h | 2 +- app/test/test_flow_classify.c | 6 +++--- doc/guides/sample_app_ug/flow_classify.rst | 4 ++-- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 3 ++- drivers/net/ena/ena_ethdev.c | 2 +- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 8 ++++---- drivers/net/i40e/i40e_fdir.c | 20 ++++++++++---------- drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 3 ++- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/mlx5/mlx5_flow_tcf.c | 4 ++-- drivers/net/qede/qede_filter.c | 12 ++++++------ drivers/net/sfc/sfc_ef10_tx.c | 4 ++-- drivers/net/sfc/sfc_tso.c | 4 ++-- drivers/net/softnic/rte_eth_softnic_pipeline.c | 8 ++++---- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 4 ++-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 15 ++++++++------- examples/flow_classify/flow_classify.c | 4 ++-- examples/ip_pipeline/pipeline.c | 8 ++++---- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 4 ++-- examples/vhost/main.c | 4 ++-- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_tcp4.c | 4 ++-- lib/librte_gro/gro_tcp4.h | 10 +++++----- lib/librte_gro/gro_vxlan_tcp4.c | 6 +++--- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/gso_tcp4.c | 4 ++-- lib/librte_gso/gso_tunnel_tcp4.c | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_net.c | 8 ++++---- lib/librte_net/rte_net.h | 7 ++++--- lib/librte_net/rte_tcp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 8 ++++---- lib/librte_vhost/virtio_net.c | 6 +++--- 45 files changed, 131 insertions(+), 125 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 1df83477e..2133dfc49 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -102,14 +102,15 @@ get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) static void parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = (ipv4_hdr->version_ihl & 0x0f) * 4; info->l4_proto = ipv4_hdr->next_proto_id; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *) + ((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) info->l4_len = sizeof(struct udp_hdr); @@ -121,14 +122,15 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) static void parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; info->l3_len = sizeof(struct rte_ipv6_hdr); info->l4_proto = ipv6_hdr->proto; /* only fill l4_len for TCP, it's useful for TSO */ if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)ipv6_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *) + ((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) info->l4_len = sizeof(struct udp_hdr); @@ -367,7 +369,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; uint32_t max_pkt_len, tso_segsz = 0; @@ -421,7 +423,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, if (info->gso_enable) ol_flags |= PKT_TX_UDP_SEG; } else if (info->l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); tcp_hdr->cksum = 0; if (tso_segsz) ol_flags |= PKT_TX_TCP_SEG; diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index ab65c3f07..0faa9ed16 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -109,14 +109,14 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, } uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct tcp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_tcp_hdr)); - memset(tcp_hdr, 0, sizeof(struct tcp_hdr)); + memset(tcp_hdr, 0, sizeof(struct rte_tcp_hdr)); tcp_hdr->src_port = rte_cpu_to_be_16(src_port); tcp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -396,7 +396,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; @@ -421,7 +421,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, break; case IPPROTO_TCP: copy_buf_to_pkt(proto_hdr, - sizeof(struct tcp_hdr), pkt, + sizeof(struct rte_tcp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 6a9d4dce8..16c21ddd7 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -39,7 +39,7 @@ initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t -initialize_tcp_header(struct tcp_hdr *tcp_hdr, uint16_t src_port, +initialize_tcp_header(struct rte_tcp_hdr *tcp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index d228ccc10..30c0fb029 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -74,7 +74,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -84,7 +84,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -530,7 +530,7 @@ init_ipv4_tcp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct tcp_hdr pkt_tcp_hdr; + struct rte_tcp_hdr pkt_tcp_hdr; uint32_t src_addr = IPV4_ADDR(1, 2, 3, 4); uint32_t dst_addr = IPV4_ADDR(5, 6, 7, 8); uint16_t src_port = 16; diff --git a/doc/guides/sample_app_ug/flow_classify.rst b/doc/guides/sample_app_ug/flow_classify.rst index 46703acbf..96a5c66d0 100644 --- a/doc/guides/sample_app_ug/flow_classify.rst +++ b/doc/guides/sample_app_ug/flow_classify.rst @@ -126,7 +126,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -136,7 +136,7 @@ initialisation of the ``Flow Classify`` application.. .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 40034d003..8766d4ef8 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -840,7 +840,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, int i; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; for (i = 0; i < nb_pkts; i++) { @@ -866,7 +866,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, RTE_IPV4_IHL_MULTIPLIER; if (ipv4_hdr->next_proto_id == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *) + tcp_hdr = (struct rte_tcp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); if ((size_t)tcp_hdr + sizeof(*tcp_hdr) @@ -888,7 +888,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l3hash = ipv6_hash(ipv6_hdr); if (ipv6_hdr->proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)(ipv6_hdr + 1); + tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 0901ca2d9..1cf7ee7f0 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -219,7 +219,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) ipv6_hdr = (struct rte_ipv6_hdr *)l3_hdr; if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - struct tcp_hdr *tcp_hdr = (struct tcp_hdr *)(l3_hdr + + struct rte_tcp_hdr *tcp_hdr = (struct rte_tcp_hdr *)(l3_hdr + mbuf->l3_len); tcp_hdr->cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 30231cc38..ed78880d0 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -249,7 +249,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, break; case PKT_TX_TCP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct tcp_hdr, cksum)); + offsetof(struct rte_tcp_hdr, cksum)); cmd_len |= E1000_TXD_CMD_TCP; cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index e814a0050..98ed6e91d 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -294,7 +294,8 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) + << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP | diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 47a263a1f..b6651fc0f 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -75,7 +75,7 @@ #define TEST_BIT(val, bit_shift) (val & (1UL << bit_shift)) #define GET_L4_HDR_LEN(mbuf) \ - ((rte_pktmbuf_mtod_offset(mbuf, struct tcp_hdr *, \ + ((rte_pktmbuf_mtod_offset(mbuf, struct rte_tcp_hdr *, \ mbuf->l3_len + mbuf->l2_len)->data_off) >> 4) #define ENA_RX_RSS_TABLE_LOG_SIZE 7 diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index f4d604a46..c6fb1a0f0 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -136,7 +136,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -150,7 +150,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); @@ -231,7 +231,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, &udp_mask, &udp_val, sizeof(struct udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { - struct tcp_hdr tcp_mask, tcp_val; + struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); memset(&tcp_val, 0, sizeof(tcp_val)); @@ -244,7 +244,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, tcp_val.dst_port = input->flow.tcp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_TCP, FILTER_GENERIC_1_L4, - &tcp_mask, &tcp_val, sizeof(struct tcp_hdr)); + &tcp_mask, &tcp_val, sizeof(struct rte_tcp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_SCTP) { struct rte_sctp_hdr sctp_mask, sctp_val; memset(&sctp_mask, 0, sizeof(sctp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index a1582d019..f4301395c 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -488,7 +488,7 @@ enic_copy_item_tcp_v1(struct copy_item_args *arg) const struct rte_flow_item_tcp *spec = item->spec; const struct rte_flow_item_tcp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct tcp_hdr supported_mask = { + struct rte_tcp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -654,7 +654,7 @@ enic_copy_item_inner_tcp_v2(struct copy_item_args *arg) mask = &rte_flow_item_tcp_mask; /* Append tcp header to L5 and set ip proto = tcp */ return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct tcp_hdr), + arg->item->spec, mask, sizeof(struct rte_tcp_hdr), arg->l3_proto_off, IPPROTO_TCP, 1); } @@ -860,9 +860,9 @@ enic_copy_item_tcp_v2(struct copy_item_args *arg) return ENOTSUP; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct tcp_hdr)); + sizeof(struct rte_tcp_hdr)); return 0; } diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 14a82426e..46dfa79b7 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -800,7 +800,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload, *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; uint8_t i, pit_idx, set_idx = I40E_FLXPLD_L4_IDX; /* use l4 by default*/ @@ -828,8 +828,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -873,8 +873,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1090,7 +1090,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *payload = NULL; unsigned char *ptr; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; struct rte_ipv4_hdr *gtp_ipv4; @@ -1127,8 +1127,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp4_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1164,8 +1164,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, udp->dst_port = fdir_input->flow.udp6_flow.src_port; udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_IPv6_PAYLOAD_LEN); } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_TCP) { - tcp = (struct tcp_hdr *)(raw_pkt + len); - payload = (unsigned char *)tcp + sizeof(struct tcp_hdr); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); + payload = (unsigned char *)tcp + sizeof(struct rte_tcp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index fcbae1a33..d340fa156 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -302,7 +302,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index c0fc0a3e7..5f51e7086 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1417,7 +1417,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 69f749a08..b69692d3f 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1762,7 +1762,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, switch (ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_TCP; - *td_offset |= (sizeof(struct tcp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_tcp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; case PKT_TX_SCTP_CKSUM: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index a0bd3b366..eefd5b463 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -429,7 +429,8 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct tcp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_tcp_hdr) + << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 3a0ca114e..bd730f188 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2617,11 +2617,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV4_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp4_flow.src_port, .dst_port = input->flow.tcp4_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2647,11 +2647,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_TCP: - attributes->l4.tcp.hdr = (struct tcp_hdr){ + attributes->l4.tcp.hdr = (struct rte_tcp_hdr){ .src_port = input->flow.tcp6_flow.src_port, .dst_port = input->flow.tcp6_flow.dst_port, }; - attributes->l4_mask.tcp.hdr = (struct tcp_hdr){ + attributes->l4_mask.tcp.hdr = (struct rte_tcp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 2270ae304..223ee4fb1 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -776,8 +776,8 @@ flow_tcf_pedit_key_set_tp_port(const struct rte_flow_action *actions, /* offset of src/dst port is same for TCP and UDP */ p_parser->keys[idx].off = actions->type == RTE_FLOW_ACTION_TYPE_SET_TP_SRC ? - offsetof(struct tcp_hdr, src_port) : - offsetof(struct tcp_hdr, dst_port); + offsetof(struct rte_tcp_hdr, src_port) : + offsetof(struct rte_tcp_hdr, dst_port); p_parser->keys[idx].mask = 0xFFFF0000; p_parser->keys[idx].val = (__u32)((const struct rte_flow_action_set_tp *) diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index 2caf314d2..cc048e178 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -460,7 +460,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; struct udp_hdr *udp; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; uint16_t len; raw_pkt = (uint8_t *)buff; @@ -496,13 +496,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, ip->total_length += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct tcp_hdr); + ip->total_length += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; @@ -528,11 +528,11 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, len += sizeof(struct udp_hdr); params->udp = true; } else { /* TCP */ - tcp = (struct tcp_hdr *)(raw_pkt + len); + tcp = (struct rte_tcp_hdr *)(raw_pkt + len); tcp->src_port = arfs->tuple.src_port; tcp->dst_port = arfs->tuple.dst_port; tcp->data_off = QEDE_FDIR_TCP_DEFAULT_DATAOFF; - len += sizeof(struct tcp_hdr); + len += sizeof(struct rte_tcp_hdr); params->tcp = true; } break; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index 055389efe..4e4f35827 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -373,7 +373,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, size_t header_len = tcph_off + m_seg->l4_len; /* Offset of the payload in the last segment that contains the header */ size_t in_off = 0; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; uint16_t packet_id = 0; uint16_t outer_packet_id = 0; uint32_t sent_seq; @@ -489,7 +489,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, outer_packet_id = sfc_tso_ip4_get_ipid(hdr_addr, first_m_seg->outer_l2_len); - th = (const struct tcp_hdr *)(hdr_addr + tcph_off); + th = (const struct rte_tcp_hdr *)(hdr_addr + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index 1374aceaa..2e34fc045 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -95,7 +95,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, unsigned int *pkt_descs, size_t *pkt_len) { uint8_t *tsoh; - const struct tcp_hdr *th; + const struct rte_tcp_hdr *th; efsys_dma_addr_t header_paddr; uint16_t packet_id = 0; uint32_t sent_seq; @@ -150,7 +150,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, packet_id = sfc_tso_ip4_get_ipid(tsoh, nh_off); /* Handle TCP header */ - th = (const struct tcp_hdr *)(tsoh + tcph_off); + th = (const struct rte_tcp_hdr *)(tsoh + tcph_off); rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); diff --git a/drivers/net/softnic/rte_eth_softnic_pipeline.c b/drivers/net/softnic/rte_eth_softnic_pipeline.c index e0e5856a4..337aa32e5 100644 --- a/drivers/net/softnic/rte_eth_softnic_pipeline.c +++ b/drivers/net/softnic/rte_eth_softnic_pipeline.c @@ -688,7 +688,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -698,7 +698,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -785,7 +785,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -795,7 +795,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 8abae5a91..52cbce8b6 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -510,7 +510,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) - *l4_cksum = &((struct tcp_hdr *)l4_hdr)->cksum; + *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else return; **l4_cksum = 0; diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index b4c54c1b1..769e675a3 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -481,7 +481,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) m->l4_len)) { struct rte_ipv4_hdr *iph; struct rte_ipv6_hdr *ip6h; - struct tcp_hdr *th; + struct rte_tcp_hdr *th; uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; uint32_t tmp; @@ -546,7 +546,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, case PKT_TX_TCP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct tcp_hdr, cksum); + hdr->csum_offset = offsetof(struct rte_tcp_hdr, cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index a6a69df22..23c0e9553 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -541,7 +541,8 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, switch (txm->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_TCP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct tcp_hdr, cksum); + gdesc->txd.msscof = gdesc->txd.hlen + + offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); @@ -669,7 +670,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, uint32_t hlen, slen; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; char *ptr; RTE_ASSERT(rcd->tcp); @@ -681,7 +682,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, if (rcd->v4) { if (unlikely(slen < hlen + sizeof(struct rte_ipv4_hdr))) return hw->mtu - sizeof(struct rte_ipv4_hdr) - - sizeof(struct tcp_hdr); + - sizeof(struct rte_tcp_hdr); ipv4_hdr = (struct rte_ipv4_hdr *)(ptr + hlen); hlen += (ipv4_hdr->version_ihl & RTE_IPV4_HDR_IHL_MASK) * @@ -689,7 +690,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } else if (rcd->v6) { if (unlikely(slen < hlen + sizeof(struct rte_ipv6_hdr))) return hw->mtu - sizeof(struct rte_ipv6_hdr) - - sizeof(struct tcp_hdr); + sizeof(struct rte_tcp_hdr); ipv6_hdr = (struct rte_ipv6_hdr *)(ptr + hlen); hlen += sizeof(struct rte_ipv6_hdr); @@ -701,11 +702,11 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, } } - if (unlikely(slen < hlen + sizeof(struct tcp_hdr))) - return hw->mtu - hlen - sizeof(struct tcp_hdr) + + if (unlikely(slen < hlen + sizeof(struct rte_tcp_hdr))) + return hw->mtu - hlen - sizeof(struct rte_tcp_hdr) + sizeof(struct rte_ether_hdr); - tcp_hdr = (struct tcp_hdr *)(ptr + hlen); + tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; if (rxm->udata64 > 1) diff --git a/examples/flow_classify/flow_classify.c b/examples/flow_classify/flow_classify.c index e68d0f694..75a66fd5b 100644 --- a/examples/flow_classify/flow_classify.c +++ b/examples/flow_classify/flow_classify.c @@ -133,7 +133,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, { /* rte_flow uses a bit mask for protocol ports */ @@ -143,7 +143,7 @@ static struct rte_acl_field_def ipv4_defs[NUM_FIELDS_IPV4] = { .input_index = SRCP_DESTP_INPUT_IPV4, .offset = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/ip_pipeline/pipeline.c b/examples/ip_pipeline/pipeline.c index 9cc7e32d8..b627310a0 100644 --- a/examples/ip_pipeline/pipeline.c +++ b/examples/ip_pipeline/pipeline.c @@ -664,7 +664,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 3, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -674,7 +674,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv4[] = { .field_index = 4, .input_index = 3, .offset = sizeof(struct rte_ipv4_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; @@ -761,7 +761,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 9, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, src_port), + offsetof(struct rte_tcp_hdr, src_port), }, /* Destination Port */ @@ -771,7 +771,7 @@ static const struct rte_acl_field_def table_acl_field_format_ipv6[] = { .field_index = 10, .input_index = 9, .offset = sizeof(struct rte_ipv6_hdr) + - offsetof(struct tcp_hdr, dst_port), + offsetof(struct rte_tcp_hdr, dst_port), }, }; diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 2c6da3ffc..2631fdd75 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -527,7 +527,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t * ipv4_l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -537,7 +537,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *)ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); @@ -566,7 +566,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, lookup_struct_t *ipv6_l3fwd_lookup_struct) { struct ipv6_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -577,7 +577,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, switch (ipv6_hdr->proto) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv6_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 5e3809b8d..d57ac262b 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -366,7 +366,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, lookup_struct_t *l3fwd_lookup_struct) { struct ipv4_5tuple key; - struct tcp_hdr *tcp; + struct rte_tcp_hdr *tcp; struct udp_hdr *udp; int ret = 0; @@ -376,7 +376,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, switch (ipv4_hdr->next_proto_id) { case IPPROTO_TCP: - tcp = (struct tcp_hdr *)((unsigned char *) ipv4_hdr + + tcp = (struct rte_tcp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(tcp->dst_port); key.port_src = rte_be_to_cpu_16(tcp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 1add9904a..66e29ea56 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -78,7 +78,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct udp_hdr *udp_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -115,7 +115,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); } else if (l4_proto == IPPROTO_TCP) { - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); /* Put PKT_TX_TCP_SEG bit setting before get_psd_sum(), because * it depends on PKT_TX_TCP_SEG to calculate pseudo-header * checksum. diff --git a/examples/vhost/main.c b/examples/vhost/main.c index c6a6531e5..9427d59e6 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -866,7 +866,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) { void *l3_hdr; struct rte_ipv4_hdr *ipv4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); @@ -878,7 +878,7 @@ static void virtio_tx_offload(struct rte_mbuf *m) m->ol_flags |= PKT_TX_IP_CKSUM; } - tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + m->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + m->l3_len); tcp_hdr->cksum = get_psd_sum(l3_hdr, m->ol_flags); } diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 0e4e3a5a5..1bf748db7 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -711,7 +711,7 @@ static const struct rte_flow_item_udp rte_flow_item_udp_mask = { * Matches a TCP header. */ struct rte_flow_item_tcp { - struct tcp_hdr hdr; /**< TCP header definition. */ + struct rte_tcp_hdr hdr; /**< TCP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_TCP. */ diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 20f2ea7e6..70d8c5d19 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -196,7 +196,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; uint16_t ip_id, hdr_len, frag_off; @@ -217,7 +217,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len; /* diff --git a/lib/librte_gro/gro_tcp4.h b/lib/librte_gro/gro_tcp4.h index 0a42a1ae8..9fe291191 100644 --- a/lib/librte_gro/gro_tcp4.h +++ b/lib/librte_gro/gro_tcp4.h @@ -20,7 +20,7 @@ /* The maximum TCP header length */ #define MAX_TCP_HLEN 60 #define INVALID_TCP_HDRLEN(len) \ - (((len) < sizeof(struct tcp_hdr)) || ((len) > MAX_TCP_HLEN)) + (((len) < sizeof(struct rte_tcp_hdr)) || ((len) > MAX_TCP_HLEN)) /* Header fields representing a TCP/IPv4 flow */ struct tcp4_flow_key { @@ -260,7 +260,7 @@ merge_two_tcp4_packets(struct gro_tcp4_item *item, */ static inline int check_seq_option(struct gro_tcp4_item *item, - struct tcp_hdr *tcph, + struct rte_tcp_hdr *tcph, uint32_t sent_seq, uint16_t ip_id, uint16_t tcp_hl, @@ -270,16 +270,16 @@ check_seq_option(struct gro_tcp4_item *item, { struct rte_mbuf *pkt_orig = item->firstseg; struct rte_ipv4_hdr *iph_orig; - struct tcp_hdr *tcph_orig; + struct rte_tcp_hdr *tcph_orig; uint16_t len, tcp_hl_orig; iph_orig = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt_orig, char *) + l2_offset + pkt_orig->l2_len); - tcph_orig = (struct tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); + tcph_orig = (struct rte_tcp_hdr *)((char *)iph_orig + pkt_orig->l3_len); tcp_hl_orig = pkt_orig->l4_len; /* Check if TCP option fields equal */ - len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct tcp_hdr); + len = RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct rte_tcp_hdr); if ((tcp_hl != tcp_hl_orig) || ((len > 0) && (memcmp(tcph + 1, tcph_orig + 1, len) != 0))) diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index d1becb6f3..3318b3251 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -208,7 +208,7 @@ is_same_vxlan_tcp4_flow(struct vxlan_tcp4_flow_key k1, static inline int check_vxlan_seq_option(struct gro_vxlan_tcp4_item *item, - struct tcp_hdr *tcp_hdr, + struct rte_tcp_hdr *tcp_hdr, uint32_t sent_seq, uint16_t outer_ip_id, uint16_t ip_id, @@ -292,7 +292,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, { struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; @@ -324,7 +324,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); /* * Don't process the packet which has FIN, SYN, RST, PSH, URG, diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 13c9aeea8..3edd2429b 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -71,9 +71,9 @@ static inline void update_tcp_header(struct rte_mbuf *pkt, uint16_t l4_offset, uint32_t sent_seq, uint8_t non_tail) { - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; - tcp_hdr = (struct tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + tcp_hdr = (struct rte_tcp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + l4_offset); tcp_hdr->sent_seq = rte_cpu_to_be_32(sent_seq); if (likely(non_tail)) diff --git a/lib/librte_gso/gso_tcp4.c b/lib/librte_gso/gso_tcp4.c index ad0cce6f9..ade172ac7 100644 --- a/lib/librte_gso/gso_tcp4.c +++ b/lib/librte_gso/gso_tcp4.c @@ -10,7 +10,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t id, tail_idx, i; uint16_t l3_offset = pkt->l2_len; @@ -18,7 +18,7 @@ update_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, ipv4_hdr = (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char*) + l3_offset); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); id = rte_be_to_cpu_16(ipv4_hdr->packet_id); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/gso_tunnel_tcp4.c b/lib/librte_gso/gso_tunnel_tcp4.c index f5a19bc43..e0384c26d 100644 --- a/lib/librte_gso/gso_tunnel_tcp4.c +++ b/lib/librte_gso/gso_tunnel_tcp4.c @@ -10,7 +10,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, struct rte_mbuf **segs, uint16_t nb_segs) { struct rte_ipv4_hdr *ipv4_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; uint16_t outer_id, inner_id, tail_idx, i; uint16_t outer_ipv4_offset, inner_ipv4_offset; @@ -32,7 +32,7 @@ update_tunnel_ipv4_tcp_headers(struct rte_mbuf *pkt, uint8_t ipid_delta, inner_ipv4_offset); inner_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); sent_seq = rte_be_to_cpu_32(tcp_hdr->sent_seq); tail_idx = nb_segs - 1; diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index ee879968c..8f65adf1c 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -19,7 +19,7 @@ extern "C" { /* Minimum GSO segment size for TCP based packets. */ #define RTE_GSO_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct tcp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_tcp_hdr) + 1) /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 4a46df58d..268892cc9 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -360,8 +360,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->l4_len = sizeof(struct udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) @@ -496,8 +496,8 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, hdr_lens->inner_l4_len = sizeof(struct udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { - const struct tcp_hdr *th; - struct tcp_hdr th_copy; + const struct rte_tcp_hdr *th; + struct rte_tcp_hdr th_copy; th = rte_pktmbuf_read(m, off, sizeof(*th), &th_copy); if (unlikely(th == NULL)) diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index 2173f95a9..a9cbc1f2c 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -114,7 +114,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct tcp_hdr *tcp_hdr; + struct rte_tcp_hdr *tcp_hdr; struct udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; @@ -170,7 +170,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) (ol_flags & PKT_TX_TCP_SEG)) { if (ol_flags & PKT_TX_IPV4) { /* non-TSO tcp or TSO */ - tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + + tcp_hdr = (struct rte_tcp_hdr *)((char *)ipv4_hdr + m->l3_len); tcp_hdr->cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -178,7 +178,8 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO tcp or TSO */ - tcp_hdr = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, + tcp_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_tcp_hdr *, inner_l3_offset + m->l3_len); tcp_hdr->cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_tcp.h b/lib/librte_net/rte_tcp.h index 91f58987b..4bcda5565 100644 --- a/lib/librte_net/rte_tcp.h +++ b/lib/librte_net/rte_tcp.h @@ -23,7 +23,7 @@ extern "C" { /** * TCP Header */ -struct tcp_hdr { +struct rte_tcp_hdr { uint16_t src_port; /**< TCP source port. */ uint16_t dst_port; /**< TCP destination port. */ uint32_t sent_seq; /**< TX data sequence number. */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index 1a295a19c..ef9e2fa8c 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -1348,7 +1348,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1387,7 +1387,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t ip_cksum, tcp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1434,7 +1434,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, { if (cfg->source_nat) { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, @@ -1462,7 +1462,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, } } else { if (cfg->proto == 0x6) { - struct tcp_hdr *tcp = (struct tcp_hdr *) &ip[1]; + struct rte_tcp_hdr *tcp = (struct rte_tcp_hdr *) &ip[1]; uint16_t tcp_cksum; tcp_cksum = nat_ipv6_tcp_udp_checksum_update(tcp->cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 1f5555392..81985232d 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -218,7 +218,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) switch (csum_l4) { case PKT_TX_TCP_CKSUM: - net_hdr->csum_offset = (offsetof(struct tcp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_tcp_hdr, cksum)); break; case PKT_TX_UDP_CKSUM: @@ -1015,7 +1015,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) { uint16_t l4_proto = 0; void *l4_hdr = NULL; - struct tcp_hdr *tcp_hdr = NULL; + struct rte_tcp_hdr *tcp_hdr = NULL; if (hdr->flags == 0 && hdr->gso_type == VIRTIO_NET_HDR_GSO_NONE) return; @@ -1024,7 +1024,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (hdr->flags == VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (hdr->csum_start == (m->l2_len + m->l3_len)) { switch (hdr->csum_offset) { - case (offsetof(struct tcp_hdr, cksum)): + case (offsetof(struct rte_tcp_hdr, cksum)): if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 14/15] net: add rte prefix to udp structure 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (12 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 13/15] net: add rte prefix to tcp structure Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 15/15] doc: announce network api change Olivier Matz ` (3 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Add 'rte_' prefix to structures: - rename struct udp_hdr as struct rte_udp_hdr. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- app/test-pmd/csumonly.c | 27 ++++++++++++++------------- app/test-pmd/flowgen.c | 4 ++-- app/test-pmd/txonly.c | 8 ++++---- app/test-pmd/util.c | 6 +++--- app/test/packet_burst_generator.c | 12 ++++++------ app/test/packet_burst_generator.h | 4 ++-- app/test/test_flow_classify.c | 2 +- app/test/test_link_bonding.c | 4 ++-- app/test/test_link_bonding_mode4.c | 2 +- app/test/test_pmd_perf.c | 2 +- drivers/net/bonding/rte_eth_bond_pmd.c | 6 +++--- drivers/net/dpaa/dpaa_rxtx.c | 2 +- drivers/net/e1000/em_rxtx.c | 2 +- drivers/net/e1000/igb_rxtx.c | 3 ++- drivers/net/enic/enic_clsf.c | 8 ++++---- drivers/net/enic/enic_flow.c | 24 ++++++++++++------------ drivers/net/i40e/i40e_fdir.c | 25 +++++++++++++------------ drivers/net/i40e/i40e_rxtx.c | 2 +- drivers/net/iavf/iavf_rxtx.c | 2 +- drivers/net/ice/ice_rxtx.c | 2 +- drivers/net/ixgbe/ixgbe_rxtx.c | 3 ++- drivers/net/mlx5/mlx5_flow.c | 8 ++++---- drivers/net/mlx5/mlx5_flow_dv.c | 4 ++-- drivers/net/qede/qede_filter.c | 14 +++++++------- drivers/net/tap/rte_eth_tap.c | 2 +- drivers/net/virtio/virtio_rxtx.c | 2 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 +++- examples/l3fwd-power/main.c | 8 ++++---- examples/l3fwd-vf/main.c | 4 ++-- examples/tep_termination/vxlan.c | 16 ++++++++-------- lib/librte_ethdev/rte_flow.h | 2 +- lib/librte_gro/gro_vxlan_tcp4.c | 10 +++++----- lib/librte_gso/gso_common.h | 4 ++-- lib/librte_gso/rte_gso.h | 2 +- lib/librte_net/rte_ether.h | 4 ++-- lib/librte_net/rte_net.c | 4 ++-- lib/librte_net/rte_net.h | 7 ++++--- lib/librte_net/rte_udp.h | 2 +- lib/librte_pipeline/rte_table_action.c | 32 ++++++++++++++++---------------- lib/librte_vhost/virtio_net.c | 6 +++--- 40 files changed, 146 insertions(+), 139 deletions(-) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 2133dfc49..105c7f2f8 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -113,7 +113,7 @@ parse_ipv4(struct rte_ipv4_hdr *ipv4_hdr, struct testpmd_offload_info *info) ((char *)ipv4_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) - info->l4_len = sizeof(struct udp_hdr); + info->l4_len = sizeof(struct rte_udp_hdr); else info->l4_len = 0; } @@ -133,7 +133,7 @@ parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) ((char *)ipv6_hdr + info->l3_len); info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2; } else if (info->l4_proto == IPPROTO_UDP) - info->l4_len = sizeof(struct udp_hdr); + info->l4_len = sizeof(struct rte_udp_hdr); else info->l4_len = 0; } @@ -181,7 +181,7 @@ parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) /* Parse a vxlan header */ static void -parse_vxlan(struct udp_hdr *udp_hdr, +parse_vxlan(struct rte_udp_hdr *udp_hdr, struct testpmd_offload_info *info, uint32_t pkt_type) { @@ -201,7 +201,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, info->outer_l4_proto = info->l4_proto; eth_hdr = (struct rte_ether_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); parse_ethernet(eth_hdr, info); @@ -210,7 +210,7 @@ parse_vxlan(struct udp_hdr *udp_hdr, /* Parse a vxlan-gpe header */ static void -parse_vxlan_gpe(struct udp_hdr *udp_hdr, +parse_vxlan_gpe(struct rte_udp_hdr *udp_hdr, struct testpmd_offload_info *info) { struct rte_ether_hdr *eth_hdr; @@ -224,7 +224,7 @@ parse_vxlan_gpe(struct udp_hdr *udp_hdr, return; vxlan_gpe_hdr = (struct rte_vxlan_gpe_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); if (!vxlan_gpe_hdr->proto || vxlan_gpe_hdr->proto == RTE_VXLAN_GPE_TYPE_IPV4) { @@ -368,7 +368,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, uint64_t tx_offloads) { struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -408,7 +408,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, return 0; /* packet type not supported, nothing to do */ if (info->l4_proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info->l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); /* do not recalculate udp cksum if it was 0 */ if (udp_hdr->dgram_cksum != 0) { udp_hdr->dgram_cksum = 0; @@ -461,7 +461,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, { struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint64_t ol_flags = 0; if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPv4)) { @@ -484,7 +484,8 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, return ol_flags; } - udp_hdr = (struct udp_hdr *)((char *)outer_l3_hdr + info->outer_l3_len); + udp_hdr = (struct rte_udp_hdr *) + ((char *)outer_l3_hdr + info->outer_l3_len); /* outer UDP checksum is done in software. In the other side, for * UDP tunneling, like VXLAN or Geneve, outer UDP checksum can be @@ -782,10 +783,10 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* check if it's a supported tunnel */ if (txp->parse_tunnel) { if (info.l4_proto == IPPROTO_UDP) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + - info.l3_len); + udp_hdr = (struct rte_udp_hdr *) + ((char *)l3_hdr + info.l3_len); parse_vxlan_gpe(udp_hdr, &info); if (info.is_tunnel) { tx_ol_flags |= PKT_TX_TUNNEL_VXLAN_GPE; diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index adfbc520a..a970a277e 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -121,7 +121,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) struct rte_mbuf *pkt; struct rte_ether_hdr *eth_hdr; struct rte_ipv4_hdr *ip_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint16_t vlan_tci, vlan_tci_outer; uint64_t ol_flags = 0; uint16_t nb_rx; @@ -193,7 +193,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs) sizeof(*ip_hdr)); /* Initialize UDP header. */ - udp_hdr = (struct udp_hdr *)(ip_hdr + 1); + udp_hdr = (struct rte_udp_hdr *)(ip_hdr + 1); udp_hdr->src_port = rte_cpu_to_be_16(cfg_udp_src); udp_hdr->dst_port = rte_cpu_to_be_16(cfg_udp_dst); udp_hdr->dgram_cksum = 0; /* No UDP checksum. */ diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index c16b6b47e..a37aa5aa7 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -55,7 +55,7 @@ uint32_t tx_ip_dst_addr = (192U << 24) | (18 << 16) | (0 << 8) | 2; static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */ RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */ -static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */ +static struct rte_udp_hdr pkt_udp_hdr; /**< UDP header of tx packets. */ static void copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt, @@ -96,7 +96,7 @@ copy_buf_to_pkt(void* buf, unsigned len, struct rte_mbuf *pkt, unsigned offset) static void setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, - struct udp_hdr *udp_hdr, + struct rte_udp_hdr *udp_hdr, uint16_t pkt_data_len) { uint16_t *ptr16; @@ -106,7 +106,7 @@ setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr, /* * Initialize UDP header. */ - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(tx_udp_src_port); udp_hdr->dst_port = rte_cpu_to_be_16(tx_udp_dst_port); udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt_len); @@ -350,7 +350,7 @@ tx_only_begin(__attribute__((unused)) portid_t pi) pkt_data_len = (uint16_t) (tx_pkt_length - ( sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + - sizeof(struct udp_hdr))); + sizeof(struct rte_udp_hdr))); setup_pkt_udp_ip_headers(&pkt_ip_hdr, &pkt_udp_hdr, pkt_data_len); } diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index b8e5548ca..a1164b705 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -105,7 +105,7 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], if (is_encapsulation) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint8_t l2_len; uint8_t l3_len; uint8_t l4_len; @@ -130,9 +130,9 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], } if (l4_proto == IPPROTO_UDP) { udp_hdr = rte_pktmbuf_mtod_offset(mb, - struct udp_hdr *, + struct rte_udp_hdr *, l2_len + l3_len); - l4_len = sizeof(struct udp_hdr); + l4_len = sizeof(struct rte_udp_hdr); vxlan_hdr = rte_pktmbuf_mtod_offset(mb, struct rte_vxlan_hdr *, l2_len + l3_len + l4_len); diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 0faa9ed16..445c1df9d 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -93,12 +93,12 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, } uint16_t -initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, +initialize_udp_header(struct rte_udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len) { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); udp_hdr->src_port = rte_cpu_to_be_16(src_port); udp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -129,7 +129,7 @@ initialize_sctp_header(struct rte_sctp_hdr *sctp_hdr, uint16_t src_port, { uint16_t pkt_len; - pkt_len = (uint16_t) (pkt_data_len + sizeof(struct udp_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); sctp_hdr->src_port = rte_cpu_to_be_16(src_port); sctp_hdr->dst_port = rte_cpu_to_be_16(dst_port); @@ -260,7 +260,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, - void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, + void *ip_hdr, uint8_t ipv4, struct rte_udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs) { int i, nb_pkt = 0; @@ -390,7 +390,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, - sizeof(struct udp_hdr), pkt, + sizeof(struct rte_udp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv4_hdr)); break; @@ -415,7 +415,7 @@ generate_packet_burst_proto(struct rte_mempool *mp, switch (proto) { case IPPROTO_UDP: copy_buf_to_pkt(proto_hdr, - sizeof(struct udp_hdr), pkt, + sizeof(struct rte_udp_hdr), pkt, eth_hdr_size + sizeof(struct rte_ipv6_hdr)); break; diff --git a/app/test/packet_burst_generator.h b/app/test/packet_burst_generator.h index 16c21ddd7..b99286f50 100644 --- a/app/test/packet_burst_generator.h +++ b/app/test/packet_burst_generator.h @@ -35,7 +35,7 @@ initialize_arp_header(struct rte_arp_hdr *arp_hdr, uint32_t src_ip, uint32_t dst_ip, uint32_t opcode); uint16_t -initialize_udp_header(struct udp_hdr *udp_hdr, uint16_t src_port, +initialize_udp_header(struct rte_udp_hdr *udp_hdr, uint16_t src_port, uint16_t dst_port, uint16_t pkt_data_len); uint16_t @@ -61,7 +61,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr, int generate_packet_burst(struct rte_mempool *mp, struct rte_mbuf **pkts_burst, struct rte_ether_hdr *eth_hdr, uint8_t vlan_enabled, - void *ip_hdr, uint8_t ipv4, struct udp_hdr *udp_hdr, + void *ip_hdr, uint8_t ipv4, struct rte_udp_hdr *udp_hdr, int nb_pkt_per_burst, uint8_t pkt_len, uint8_t nb_pkt_segs); int diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index 30c0fb029..f4d2fdcd2 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -493,7 +493,7 @@ init_ipv4_udp_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; uint32_t src_addr = IPV4_ADDR(2, 2, 2, 3); uint32_t dst_addr = IPV4_ADDR(2, 2, 2, 7); uint16_t src_port = 32; diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index c1c22fb96..a4d52a734 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -80,13 +80,13 @@ struct link_bonding_unittest_params { struct rte_ether_hdr *pkt_eth_hdr; struct rte_ipv4_hdr *pkt_ipv4_hdr; struct rte_ipv6_hdr *pkt_ipv6_hdr; - struct udp_hdr *pkt_udp_hdr; + struct rte_udp_hdr *pkt_udp_hdr; }; static struct rte_ipv4_hdr pkt_ipv4_hdr; static struct rte_ipv6_hdr pkt_ipv6_hdr; -static struct udp_hdr pkt_udp_hdr; +static struct rte_udp_hdr pkt_udp_hdr; static struct link_bonding_unittest_params default_params = { .bonded_port_id = -1, diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 98f9fe2fa..784501a5e 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -733,7 +733,7 @@ generate_packets(struct rte_ether_addr *src_mac, uint32_t ip_dst[4] = { [0 ... 2] = 0xFEEDFACE, [3] = RTE_IPv4(192, 168, 0, 2) }; struct rte_ether_hdr pkt_eth_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; union { struct rte_ipv4_hdr v4; struct rte_ipv6_hdr v6; diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 0d1c1b1ab..5e2dad9ec 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -184,7 +184,7 @@ init_traffic(struct rte_mempool *mp, { struct rte_ether_hdr pkt_eth_hdr; struct rte_ipv4_hdr pkt_ipv4_hdr; - struct udp_hdr pkt_udp_hdr; + struct rte_udp_hdr pkt_udp_hdr; uint32_t pktlen; static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 8766d4ef8..f799e39c0 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -839,7 +839,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, size_t vlan_offset; int i; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; uint32_t hash, l3hash, l4hash; @@ -874,7 +874,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv4_hdr->next_proto_id == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *) + udp_hdr = (struct rte_udp_hdr *) ((char *)ipv4_hdr + ip_hdr_offset); if ((size_t)udp_hdr + sizeof(*udp_hdr) @@ -891,7 +891,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, tcp_hdr = (struct rte_tcp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(tcp_hdr); } else if (ipv6_hdr->proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)(ipv6_hdr + 1); + udp_hdr = (struct rte_udp_hdr *)(ipv6_hdr + 1); l4hash = HASH_L4_PORTS(udp_hdr); } } diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 1cf7ee7f0..828b3b519 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -230,7 +230,7 @@ static inline void dpaa_checksum(struct rte_mbuf *mbuf) tcp_hdr); } else if ((mbuf->packet_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) { - struct udp_hdr *udp_hdr = (struct udp_hdr *)(l3_hdr + + struct rte_udp_hdr *udp_hdr = (struct rte_udp_hdr *)(l3_hdr + mbuf->l3_len); udp_hdr->dgram_cksum = 0; if (eth_hdr->ether_type == htons(RTE_ETHER_TYPE_IPv4)) diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index ed78880d0..482d88459 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -244,7 +244,7 @@ em_set_xmit_ctx(struct em_tx_queue* txq, switch (flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: ctx.upper_setup.tcp_fields.tucso = (uint8_t)(ipcse + - offsetof(struct udp_hdr, dgram_cksum)); + offsetof(struct rte_udp_hdr, dgram_cksum)); cmp_mask |= TX_MACIP_LEN_CMP_MASK; break; case PKT_TX_TCP_CKSUM: diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 98ed6e91d..871b5f3b9 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -289,7 +289,8 @@ igbe_set_xmit_ctx(struct igb_tx_queue* txq, case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP | E1000_ADVTXD_DTYP_CTXT | E1000_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct udp_hdr) << E1000_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_udp_hdr) + << E1000_ADVTXD_L4LEN_SHIFT; break; case PKT_TX_TCP_CKSUM: type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP | diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index c6fb1a0f0..080b642c8 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -120,7 +120,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, memset(gp, 0, sizeof(*gp)); if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_UDP) { - struct udp_hdr udp_mask, udp_val; + struct rte_udp_hdr udp_mask, udp_val; memset(&udp_mask, 0, sizeof(udp_mask)); memset(&udp_val, 0, sizeof(udp_val)); @@ -134,7 +134,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, - &udp_mask, &udp_val, sizeof(struct udp_hdr)); + &udp_mask, &udp_val, sizeof(struct rte_udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV4_TCP) { struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); @@ -216,7 +216,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, } if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_UDP) { - struct udp_hdr udp_mask, udp_val; + struct rte_udp_hdr udp_mask, udp_val; memset(&udp_mask, 0, sizeof(udp_mask)); memset(&udp_val, 0, sizeof(udp_val)); @@ -229,7 +229,7 @@ copy_fltr_v2(struct filter_v2 *fltr, const struct rte_eth_fdir_input *input, udp_val.dst_port = input->flow.udp6_flow.dst_port; } enic_set_layer(gp, FILTER_GENERIC_1_UDP, FILTER_GENERIC_1_L4, - &udp_mask, &udp_val, sizeof(struct udp_hdr)); + &udp_mask, &udp_val, sizeof(struct rte_udp_hdr)); } else if (input->flow_type == RTE_ETH_FLOW_NONFRAG_IPV6_TCP) { struct rte_tcp_hdr tcp_mask, tcp_val; memset(&tcp_mask, 0, sizeof(tcp_mask)); diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index f4301395c..d188e5829 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -449,7 +449,7 @@ enic_copy_item_udp_v1(struct copy_item_args *arg) const struct rte_flow_item_udp *spec = item->spec; const struct rte_flow_item_udp *mask = item->mask; struct filter_ipv4_5tuple *enic_5tup = &enic_filter->u.ipv4; - struct udp_hdr supported_mask = { + struct rte_udp_hdr supported_mask = { .src_port = 0xffff, .dst_port = 0xffff, }; @@ -639,7 +639,7 @@ enic_copy_item_inner_udp_v2(struct copy_item_args *arg) mask = &rte_flow_item_udp_mask; /* Append udp header to L5 and set ip proto = udp */ return copy_inner_common(&arg->filter->u.generic_1, off, - arg->item->spec, mask, sizeof(struct udp_hdr), + arg->item->spec, mask, sizeof(struct rte_udp_hdr), arg->l3_proto_off, IPPROTO_UDP, 1); } @@ -831,9 +831,9 @@ enic_copy_item_udp_v2(struct copy_item_args *arg) mask = &rte_flow_item_udp_mask; memcpy(gp->layer[FILTER_GENERIC_1_L4].mask, &mask->hdr, - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); memcpy(gp->layer[FILTER_GENERIC_1_L4].val, &spec->hdr, - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); return 0; } @@ -925,7 +925,7 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) const struct rte_flow_item_vxlan *spec = item->spec; const struct rte_flow_item_vxlan *mask = item->mask; struct filter_generic_1 *gp = &enic_filter->u.generic_1; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; FLOW_TRACE(); @@ -935,9 +935,9 @@ enic_copy_item_vxlan_v2(struct copy_item_args *arg) */ gp->mask_flags |= FILTER_GENERIC_1_UDP; gp->val_flags |= FILTER_GENERIC_1_UDP; - udp = (struct udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].mask; + udp = (struct rte_udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].mask; udp->dst_port = 0xffff; - udp = (struct udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].val; + udp = (struct rte_udp_hdr *)gp->layer[FILTER_GENERIC_1_L4].val; udp->dst_port = RTE_BE16(4789); /* Match all if no spec */ if (!spec) @@ -983,7 +983,7 @@ enic_copy_item_raw_v2(struct copy_item_args *arg) return EINVAL; /* Need non-null pattern that fits within the NIC's filter pattern */ if (spec->length == 0 || - spec->length + sizeof(struct udp_hdr) > FILTER_GENERIC_1_KEY_LEN || + spec->length + sizeof(struct rte_udp_hdr) > FILTER_GENERIC_1_KEY_LEN || !spec->pattern || !mask->pattern) return EINVAL; /* @@ -996,9 +996,9 @@ enic_copy_item_raw_v2(struct copy_item_args *arg) */ if (mask->length != 0 && mask->length < spec->length) return EINVAL; - memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr), mask->pattern, spec->length); - memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct rte_udp_hdr), spec->pattern, spec->length); return 0; @@ -1052,9 +1052,9 @@ fixup_l5_layer(struct enic *enic, struct filter_generic_1 *gp, return; FLOW_TRACE(); vxlan = sizeof(struct rte_vxlan_hdr); - memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].mask + sizeof(struct rte_udp_hdr), gp->layer[FILTER_GENERIC_1_L5].mask, vxlan); - memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct udp_hdr), + memcpy(gp->layer[FILTER_GENERIC_1_L4].val + sizeof(struct rte_udp_hdr), gp->layer[FILTER_GENERIC_1_L5].val, vxlan); inner = inner_ofst - vxlan; memset(layer, 0, sizeof(layer)); diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 46dfa79b7..3044e9d52 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -799,7 +799,7 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, unsigned char *raw_pkt) { unsigned char *payload, *ptr; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; uint8_t size, dst = 0; @@ -815,8 +815,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, /* fill the L4 head */ switch (fdir_input->flow_type) { case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -860,8 +860,8 @@ i40e_fdir_construct_pkt(struct i40e_pf *pf, break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /* * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1089,7 +1089,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, { unsigned char *payload = NULL; unsigned char *ptr; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; struct rte_sctp_hdr *sctp; struct rte_flow_item_gtp *gtp; @@ -1116,8 +1116,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, /* fill the L4 head */ if (pctype == I40E_FILTER_PCTYPE_NONF_IPV4_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1153,8 +1153,8 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, payload = raw_pkt + len; set_idx = I40E_FLXPLD_L3_IDX; } else if (pctype == I40E_FILTER_PCTYPE_NONF_IPV6_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); - payload = (unsigned char *)udp + sizeof(struct udp_hdr); + udp = (struct rte_udp_hdr *)(raw_pkt + len); + payload = (unsigned char *)udp + sizeof(struct rte_udp_hdr); /** * The source and destination fields in the transmitted packet * need to be presented in a reversed order with respect @@ -1206,12 +1206,13 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV4 || cus_pctype->index == I40E_CUSTOMIZED_GTPU_IPV6 || cus_pctype->index == I40E_CUSTOMIZED_GTPU) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->dgram_len = rte_cpu_to_be_16(I40E_FDIR_UDP_DEFAULT_LEN); gtp = (struct rte_flow_item_gtp *) - ((unsigned char *)udp + sizeof(struct udp_hdr)); + ((unsigned char *)udp + + sizeof(struct rte_udp_hdr)); gtp->msg_len = rte_cpu_to_be_16(I40E_FDIR_GTP_DEFAULT_LEN); gtp->teid = fdir_input->flow.gtp_flow.teid; diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index d340fa156..0d430624c 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -312,7 +312,7 @@ i40e_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= I40E_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << I40E_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; default: diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 5f51e7086..682e8aa08 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -1427,7 +1427,7 @@ iavf_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= IAVF_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << IAVF_TX_DESC_LENGTH_L4_FC_LEN_SHIFT; break; default: diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index b69692d3f..82b0f83bd 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1772,7 +1772,7 @@ ice_txd_enable_checksum(uint64_t ol_flags, break; case PKT_TX_UDP_CKSUM: *td_cmd |= ICE_TX_DESC_CMD_L4T_EOFT_UDP; - *td_offset |= (sizeof(struct udp_hdr) >> 2) << + *td_offset |= (sizeof(struct rte_udp_hdr) >> 2) << ICE_TX_DESC_LEN_L4_LEN_S; break; default: diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index eefd5b463..9e03781e0 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -422,7 +422,8 @@ ixgbe_set_xmit_ctx(struct ixgbe_tx_queue *txq, case PKT_TX_UDP_CKSUM: type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_UDP | IXGBE_ADVTXD_DTYP_CTXT | IXGBE_ADVTXD_DCMD_DEXT; - mss_l4len_idx |= sizeof(struct udp_hdr) << IXGBE_ADVTXD_L4LEN_SHIFT; + mss_l4len_idx |= sizeof(struct rte_udp_hdr) + << IXGBE_ADVTXD_L4LEN_SHIFT; tx_offload_mask.l2_len |= ~0; tx_offload_mask.l3_len |= ~0; break; diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index bd730f188..98870184d 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2602,11 +2602,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, /* Handle L4. */ switch (fdir_filter->input.flow_type) { case RTE_ETH_FLOW_NONFRAG_IPV4_UDP: - attributes->l4.udp.hdr = (struct udp_hdr){ + attributes->l4.udp.hdr = (struct rte_udp_hdr){ .src_port = input->flow.udp4_flow.src_port, .dst_port = input->flow.udp4_flow.dst_port, }; - attributes->l4_mask.udp.hdr = (struct udp_hdr){ + attributes->l4_mask.udp.hdr = (struct rte_udp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; @@ -2632,11 +2632,11 @@ flow_fdir_filter_convert(struct rte_eth_dev *dev, }; break; case RTE_ETH_FLOW_NONFRAG_IPV6_UDP: - attributes->l4.udp.hdr = (struct udp_hdr){ + attributes->l4.udp.hdr = (struct rte_udp_hdr){ .src_port = input->flow.udp6_flow.src_port, .dst_port = input->flow.udp6_flow.dst_port, }; - attributes->l4_mask.udp.hdr = (struct udp_hdr){ + attributes->l4_mask.udp.hdr = (struct rte_udp_hdr){ .src_port = mask->src_port_mask, .dst_port = mask->dst_port_mask, }; diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 3aef9f652..d6d13e84e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1215,7 +1215,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, struct rte_vlan_hdr *vlan = NULL; struct rte_ipv4_hdr *ipv4 = NULL; struct rte_ipv6_hdr *ipv6 = NULL; - struct udp_hdr *udp = NULL; + struct rte_udp_hdr *udp = NULL; struct rte_vxlan_hdr *vxlan = NULL; struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL; struct rte_gre_hdr *gre = NULL; @@ -1286,7 +1286,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf, ipv6->hop_limits = MLX5_ENCAP_IPV6_HOP_LIMIT; break; case RTE_FLOW_ITEM_TYPE_UDP: - udp = (struct udp_hdr *)&buf[temp_size]; + udp = (struct rte_udp_hdr *)&buf[temp_size]; if (!ipv4 && !ipv6) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c index cc048e178..7bdc3023f 100644 --- a/drivers/net/qede/qede_filter.c +++ b/drivers/net/qede/qede_filter.c @@ -459,7 +459,7 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, uint8_t *raw_pkt; struct rte_ipv4_hdr *ip; struct rte_ipv6_hdr *ip6; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; struct rte_tcp_hdr *tcp; uint16_t len; @@ -487,13 +487,13 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; /* UDP */ if (arfs->tuple.ip_proto == IPPROTO_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->dst_port = arfs->tuple.dst_port; udp->src_port = arfs->tuple.src_port; - udp->dgram_len = sizeof(struct udp_hdr); - len += sizeof(struct udp_hdr); + udp->dgram_len = sizeof(struct rte_udp_hdr); + len += sizeof(struct rte_udp_hdr); /* adjust ip total_length */ - ip->total_length += sizeof(struct udp_hdr); + ip->total_length += sizeof(struct rte_udp_hdr); params->udp = true; } else { /* TCP */ tcp = (struct rte_tcp_hdr *)(raw_pkt + len); @@ -522,10 +522,10 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, raw_pkt = (uint8_t *)buff; /* UDP */ if (arfs->tuple.ip_proto == IPPROTO_UDP) { - udp = (struct udp_hdr *)(raw_pkt + len); + udp = (struct rte_udp_hdr *)(raw_pkt + len); udp->src_port = arfs->tuple.src_port; udp->dst_port = arfs->tuple.dst_port; - len += sizeof(struct udp_hdr); + len += sizeof(struct rte_udp_hdr); params->udp = true; } else { /* TCP */ tcp = (struct rte_tcp_hdr *)(raw_pkt + len); diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 52cbce8b6..896aae526 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -508,7 +508,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, l4_hdr = packet + l2_len + l3_len; if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) - *l4_cksum = &((struct udp_hdr *)l4_hdr)->dgram_cksum; + *l4_cksum = &((struct rte_udp_hdr *)l4_hdr)->dgram_cksum; else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 769e675a3..1de28540c 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -539,7 +539,7 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, switch (cookie->ol_flags & PKT_TX_L4_MASK) { case PKT_TX_UDP_CKSUM: hdr->csum_start = cookie->l2_len + cookie->l3_len; - hdr->csum_offset = offsetof(struct udp_hdr, + hdr->csum_offset = offsetof(struct rte_udp_hdr, dgram_cksum); hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; break; diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index 23c0e9553..6644cde44 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -545,7 +545,9 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, offsetof(struct rte_tcp_hdr, cksum); break; case PKT_TX_UDP_CKSUM: - gdesc->txd.msscof = gdesc->txd.hlen + offsetof(struct udp_hdr, dgram_cksum); + gdesc->txd.msscof = gdesc->txd.hlen + + offsetof(struct rte_udp_hdr, + dgram_cksum); break; default: PMD_TX_LOG(WARNING, "requested cksum offload not supported %#llx", diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 2631fdd75..d72a01e58 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -528,7 +528,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, { struct ipv4_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; key.ip_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); @@ -544,7 +544,7 @@ get_ipv4_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *)ipv4_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *)ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); @@ -567,7 +567,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, { struct ipv6_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; memcpy(key.ip_dst, ipv6_hdr->dst_addr, IPV6_ADDR_LEN); @@ -584,7 +584,7 @@ get_ipv6_dst_port(struct rte_ipv6_hdr *ipv6_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *) ipv6_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *) ipv6_hdr + sizeof(struct rte_ipv6_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index d57ac262b..0ef469c29 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -367,7 +367,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, { struct ipv4_5tuple key; struct rte_tcp_hdr *tcp; - struct udp_hdr *udp; + struct rte_udp_hdr *udp; int ret = 0; key.ip_dst = rte_be_to_cpu_32(ipv4_hdr->dst_addr); @@ -383,7 +383,7 @@ get_dst_port(struct rte_ipv4_hdr *ipv4_hdr, uint16_t portid, break; case IPPROTO_UDP: - udp = (struct udp_hdr *)((unsigned char *) ipv4_hdr + + udp = (struct rte_udp_hdr *)((unsigned char *) ipv4_hdr + sizeof(struct rte_ipv4_hdr)); key.port_dst = rte_be_to_cpu_16(udp->dst_port); key.port_src = rte_be_to_cpu_16(udp->src_port); diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c index 66e29ea56..44a39a409 100644 --- a/examples/tep_termination/vxlan.c +++ b/examples/tep_termination/vxlan.c @@ -77,7 +77,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, uint16_t ethertype; struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_tcp_hdr *tcp_hdr; struct rte_sctp_hdr *sctp_hdr; uint64_t ol_flags = 0; @@ -110,7 +110,7 @@ process_inner_cksums(struct rte_ether_hdr *eth_hdr, return 0; /* packet type not supported, nothing to do */ if (l4_proto == IPPROTO_UDP) { - udp_hdr = (struct udp_hdr *)((char *)l3_hdr + info->l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)l3_hdr + info->l3_len); ol_flags |= PKT_TX_UDP_CKSUM; udp_hdr->dgram_cksum = get_psd_sum(l3_hdr, ethertype, ol_flags); @@ -143,7 +143,7 @@ decapsulation(struct rte_mbuf *pkt) { uint8_t l4_proto = 0; uint16_t outer_header_len; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; union tunnel_offload_info info = { .data = 0 }; struct rte_ether_hdr *phdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); @@ -153,7 +153,7 @@ decapsulation(struct rte_mbuf *pkt) if (l4_proto != IPPROTO_UDP) return -1; - udp_hdr = (struct udp_hdr *)((char *)phdr + + udp_hdr = (struct rte_udp_hdr *)((char *)phdr + info.outer_l2_len + info.outer_l3_len); /** check udp destination port, 4789 is the default vxlan port @@ -163,7 +163,7 @@ decapsulation(struct rte_mbuf *pkt) (pkt->packet_type & RTE_PTYPE_TUNNEL_MASK) == 0) return -1; outer_header_len = info.outer_l2_len + info.outer_l3_len - + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr); + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr); rte_pktmbuf_adj(pkt, outer_header_len); @@ -184,10 +184,10 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) struct rte_ether_hdr *pneth = (struct rte_ether_hdr *) rte_pktmbuf_prepend(m, sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) - + sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)); + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); struct rte_ipv4_hdr *ip = (struct rte_ipv4_hdr *) &pneth[1]; - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; struct rte_vxlan_hdr *vxlan = (struct rte_vxlan_hdr *) &udp[1]; /* convert TX queue ID to vport ID */ @@ -231,7 +231,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id) /*UDP HEADER*/ udp->dgram_cksum = 0; udp->dgram_len = rte_cpu_to_be_16(old_len - + sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)); udp->dst_port = rte_cpu_to_be_16(vxdev.dst_port); diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h index 1bf748db7..f3a8fb103 100644 --- a/lib/librte_ethdev/rte_flow.h +++ b/lib/librte_ethdev/rte_flow.h @@ -692,7 +692,7 @@ static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = { * Matches a UDP header. */ struct rte_flow_item_udp { - struct udp_hdr hdr; /**< UDP header definition. */ + struct rte_udp_hdr hdr; /**< UDP header definition. */ }; /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */ diff --git a/lib/librte_gro/gro_vxlan_tcp4.c b/lib/librte_gro/gro_vxlan_tcp4.c index 3318b3251..5fa88071d 100644 --- a/lib/librte_gro/gro_vxlan_tcp4.c +++ b/lib/librte_gro/gro_vxlan_tcp4.c @@ -264,7 +264,7 @@ static inline void update_vxlan_header(struct gro_vxlan_tcp4_item *item) { struct rte_ipv4_hdr *ipv4_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_mbuf *pkt = item->inner_item.firstseg; uint16_t len; @@ -276,7 +276,7 @@ update_vxlan_header(struct gro_vxlan_tcp4_item *item) /* Update the outer UDP header. */ len -= pkt->outer_l3_len; - udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + pkt->outer_l3_len); + udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + pkt->outer_l3_len); udp_hdr->dgram_len = rte_cpu_to_be_16(len); /* Update the inner IPv4 header. */ @@ -293,7 +293,7 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, struct rte_ether_hdr *outer_eth_hdr, *eth_hdr; struct rte_ipv4_hdr *outer_ipv4_hdr, *ipv4_hdr; struct rte_tcp_hdr *tcp_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; struct rte_vxlan_hdr *vxlan_hdr; uint32_t sent_seq; int32_t tcp_dl; @@ -317,10 +317,10 @@ gro_vxlan_tcp4_reassemble(struct rte_mbuf *pkt, outer_eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); outer_ipv4_hdr = (struct rte_ipv4_hdr *)((char *)outer_eth_hdr + pkt->outer_l2_len); - udp_hdr = (struct udp_hdr *)((char *)outer_ipv4_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)outer_ipv4_hdr + pkt->outer_l3_len); vxlan_hdr = (struct rte_vxlan_hdr *)((char *)udp_hdr + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); eth_hdr = (struct rte_ether_hdr *)((char *)vxlan_hdr + sizeof(struct rte_vxlan_hdr)); ipv4_hdr = (struct rte_ipv4_hdr *)((char *)udp_hdr + pkt->l2_len); diff --git a/lib/librte_gso/gso_common.h b/lib/librte_gso/gso_common.h index 3edd2429b..a0b83436d 100644 --- a/lib/librte_gso/gso_common.h +++ b/lib/librte_gso/gso_common.h @@ -46,9 +46,9 @@ static inline void update_udp_header(struct rte_mbuf *pkt, uint16_t udp_offset) { - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; - udp_hdr = (struct udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + + udp_hdr = (struct rte_udp_hdr *)(rte_pktmbuf_mtod(pkt, char *) + udp_offset); udp_hdr->dgram_len = rte_cpu_to_be_16(pkt->pkt_len - udp_offset); } diff --git a/lib/librte_gso/rte_gso.h b/lib/librte_gso/rte_gso.h index 8f65adf1c..3aab297f4 100644 --- a/lib/librte_gso/rte_gso.h +++ b/lib/librte_gso/rte_gso.h @@ -23,7 +23,7 @@ extern "C" { /* Minimum GSO segment size for UDP based packets. */ #define RTE_GSO_UDP_SEG_SIZE_MIN (sizeof(struct rte_ether_hdr) + \ - sizeof(struct rte_ipv4_hdr) + sizeof(struct udp_hdr) + 1) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr) + 1) /* GSO flags for rte_gso_ctx. */ #define RTE_GSO_FLAG_IPID_FIXED (1ULL << 0) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 60a7dbe3a..3404bdd3d 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -316,7 +316,7 @@ struct rte_vxlan_hdr { #define RTE_ETHER_TYPE_MPLSM 0x8848 /**< MPLS multicast ethertype. */ #define RTE_ETHER_VXLAN_HLEN \ - (sizeof(struct udp_hdr) + sizeof(struct rte_vxlan_hdr)) + (sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)) /**< VXLAN tunnel header length. */ /** @@ -340,7 +340,7 @@ struct rte_vxlan_gpe_hdr { #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) + \ +#define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_vxlan_gpe_hdr)) /**< VXLAN-GPE tunnel header length. */ diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index 268892cc9..e1868f7da 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -357,7 +357,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) { - hdr_lens->l4_len = sizeof(struct udp_hdr); + hdr_lens->l4_len = sizeof(struct rte_udp_hdr); return pkt_type; } else if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_TCP) { const struct rte_tcp_hdr *th; @@ -493,7 +493,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, } if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_UDP) { - hdr_lens->inner_l4_len = sizeof(struct udp_hdr); + hdr_lens->inner_l4_len = sizeof(struct rte_udp_hdr); } else if ((pkt_type & RTE_PTYPE_INNER_L4_MASK) == RTE_PTYPE_INNER_L4_TCP) { const struct rte_tcp_hdr *th; diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h index a9cbc1f2c..708858469 100644 --- a/lib/librte_net/rte_net.h +++ b/lib/librte_net/rte_net.h @@ -115,7 +115,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; struct rte_tcp_hdr *tcp_hdr; - struct udp_hdr *udp_hdr; + struct rte_udp_hdr *udp_hdr; uint64_t inner_l3_offset = m->l2_len; #ifdef RTE_LIBRTE_ETHDEV_DEBUG @@ -153,7 +153,7 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) if ((ol_flags & PKT_TX_UDP_CKSUM) == PKT_TX_UDP_CKSUM) { if (ol_flags & PKT_TX_IPV4) { - udp_hdr = (struct udp_hdr *)((char *)ipv4_hdr + + udp_hdr = (struct rte_udp_hdr *)((char *)ipv4_hdr + m->l3_len); udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); @@ -161,7 +161,8 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags) ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, inner_l3_offset); /* non-TSO udp */ - udp_hdr = rte_pktmbuf_mtod_offset(m, struct udp_hdr *, + udp_hdr = rte_pktmbuf_mtod_offset(m, + struct rte_udp_hdr *, inner_l3_offset + m->l3_len); udp_hdr->dgram_cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); diff --git a/lib/librte_net/rte_udp.h b/lib/librte_net/rte_udp.h index ba033955c..1c3437c5f 100644 --- a/lib/librte_net/rte_udp.h +++ b/lib/librte_net/rte_udp.h @@ -23,7 +23,7 @@ extern "C" { /** * UDP Header */ -struct udp_hdr { +struct rte_udp_hdr { uint16_t src_port; /**< UDP source port. */ uint16_t dst_port; /**< UDP destination port. */ uint16_t dgram_len; /**< UDP datagram length */ diff --git a/lib/librte_pipeline/rte_table_action.c b/lib/librte_pipeline/rte_table_action.c index ef9e2fa8c..b3c86032f 100644 --- a/lib/librte_pipeline/rte_table_action.c +++ b/lib/librte_pipeline/rte_table_action.c @@ -492,7 +492,7 @@ struct encap_pppoe_data { struct encap_vxlan_ipv4_data { struct rte_ether_hdr ether; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -500,14 +500,14 @@ struct encap_vxlan_ipv4_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv4_hdr ipv4; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); struct encap_vxlan_ipv6_data { struct rte_ether_hdr ether; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -515,7 +515,7 @@ struct encap_vxlan_ipv6_vlan_data { struct rte_ether_hdr ether; struct rte_vlan_hdr vlan; struct rte_ipv6_hdr ipv6; - struct udp_hdr udp; + struct rte_udp_hdr udp; struct rte_vxlan_hdr vxlan; } __attribute__((__packed__)); @@ -1006,13 +1006,13 @@ pkt_work_encap_vxlan_ipv4(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length); @@ -1036,13 +1036,13 @@ pkt_work_encap_vxlan_ipv4_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv4_total_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr) + + sizeof(struct rte_udp_hdr) + sizeof(struct rte_ipv4_hdr)); ipv4_hdr_cksum = encap_vxlan_ipv4_checksum_update(vxlan_tbl->ipv4.hdr_checksum, rte_htons(ipv4_total_length)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv4.total_length = rte_htons(ipv4_total_length); @@ -1066,10 +1066,10 @@ pkt_work_encap_vxlan_ipv6(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length); @@ -1092,10 +1092,10 @@ pkt_work_encap_vxlan_ipv6_vlan(struct rte_mbuf *mbuf, ether_length = (uint16_t)mbuf->pkt_len; ipv6_payload_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); udp_length = ether_length + (sizeof(struct rte_vxlan_hdr) + - sizeof(struct udp_hdr)); + sizeof(struct rte_udp_hdr)); vxlan_pkt = encap(ether, vxlan_tbl, sizeof(*vxlan_tbl)); vxlan_pkt->ipv6.payload_len = rte_htons(ipv6_payload_length); @@ -1366,7 +1366,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t ip_cksum, udp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1405,7 +1405,7 @@ pkt_ipv4_work_nat(struct rte_ipv4_hdr *ip, tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t ip_cksum, udp_cksum; ip_cksum = nat_ipv4_checksum_update(ip->hdr_checksum, @@ -1447,7 +1447,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t udp_cksum; udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum, @@ -1475,7 +1475,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { - struct udp_hdr *udp = (struct udp_hdr *) &ip[1]; + struct rte_udp_hdr *udp = (struct rte_udp_hdr *) &ip[1]; uint16_t udp_cksum; udp_cksum = nat_ipv6_tcp_udp_checksum_update(udp->dgram_cksum, diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 81985232d..fe99116c7 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -222,7 +222,7 @@ virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) cksum)); break; case PKT_TX_UDP_CKSUM: - net_hdr->csum_offset = (offsetof(struct udp_hdr, + net_hdr->csum_offset = (offsetof(struct rte_udp_hdr, dgram_cksum)); break; case PKT_TX_SCTP_CKSUM: @@ -1028,7 +1028,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) if (l4_proto == IPPROTO_TCP) m->ol_flags |= PKT_TX_TCP_CKSUM; break; - case (offsetof(struct udp_hdr, dgram_cksum)): + case (offsetof(struct rte_udp_hdr, dgram_cksum)): if (l4_proto == IPPROTO_UDP) m->ol_flags |= PKT_TX_UDP_CKSUM; break; @@ -1054,7 +1054,7 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m) case VIRTIO_NET_HDR_GSO_UDP: m->ol_flags |= PKT_TX_UDP_SEG; m->tso_segsz = hdr->gso_size; - m->l4_len = sizeof(struct udp_hdr); + m->l4_len = sizeof(struct rte_udp_hdr); break; default: RTE_LOG(WARNING, VHOST_DATA, -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* [dpdk-dev] [PATCH 15/15] doc: announce network api change 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (13 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 14/15] net: add rte prefix to udp structure Olivier Matz @ 2019-05-21 16:13 ` Olivier Matz 2019-05-21 16:23 ` [dpdk-dev] [PATCH 00/15] prefix network structures Stephen Hemminger ` (2 subsequent siblings) 17 siblings, 0 replies; 107+ messages in thread From: Olivier Matz @ 2019-05-21 16:13 UTC (permalink / raw) To: dev; +Cc: stephen, ferruh.yigit Signed-off-by: Olivier Matz <olivier.matz@6wind.com> --- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_19_08.rst | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 098d24381..7e2dcb769 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -17,10 +17,6 @@ Deprecation Notices can be got using the ``pip``, or ``pip3``, tool for downloading python packages. -* network includes: Network structures, definitions and functions will - be prefixed by ``rte_`` to resolve conflicts with libc headers. - This change will break many DPDK APIs. - * kvargs: The function ``rte_kvargs_process`` will get a new parameter for returning key match count. It will ease handling of no-match case. diff --git a/doc/guides/rel_notes/release_19_08.rst b/doc/guides/rel_notes/release_19_08.rst index b9510f93a..5ebb564b1 100644 --- a/doc/guides/rel_notes/release_19_08.rst +++ b/doc/guides/rel_notes/release_19_08.rst @@ -83,6 +83,9 @@ API Changes Also, make sure to start the actual text at the margin. ========================================================= +* The network structures, definitions and functions have + been prefixed by ``rte_`` to resolve conflicts with libc headers. + ABI Changes ----------- -- 2.11.0 ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] prefix network structures 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (14 preceding siblings ...) 2019-05-21 16:13 ` [dpdk-dev] [PATCH 15/15] doc: announce network api change Olivier Matz @ 2019-05-21 16:23 ` Stephen Hemminger 2019-05-23 11:41 ` Maxime Coquelin 2019-05-24 11:38 ` Ferruh Yigit 17 siblings, 0 replies; 107+ messages in thread From: Stephen Hemminger @ 2019-05-21 16:23 UTC (permalink / raw) To: Olivier Matz; +Cc: dev, ferruh.yigit On Tue, 21 May 2019 18:13:00 +0200 Olivier Matz <olivier.matz@6wind.com> wrote: > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > > This patchset adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > This was discussed in [1], and requested by the techboard [2]. > > patch-v1: > * rease on top of v19.05 > * remove uneeded renames in drivers/net/bonding/rte_eth_bond_pmd.c > and app/test-pmd/icmpecho.c (arp-related variables) > * do not modify base drivers, except cxgbe, thunderx, enetc, qede: > only files that already contain dpdk definitions are modified. > * fix checkpatch issues when it does not impact the code style too > much. Big warnings remain about the RTE_IPv4() macros because > arguments are separated by ',' instead of ', '. > * add a release note patch > * tested compilation on x86_64-linux and x86_64-freebsd. > > rfc-v2: > * rebase on top of v19.05-rc1 > > > [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html > [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html > > > Olivier Matz (15): > net: add rte prefix to arp structures > net: add rte prefix to arp defines > net: add rte prefix to ether structures > net: add rte prefix to ether functions > net: add rte prefix to ether defines > net: add rte prefix to esp structure > net: add rte prefix to gre structure > net: add rte prefix to icmp structure > net: add rte prefix to icmp defines > net: add rte prefix to ip structure > net: add rte prefix to ip defines > net: add rte prefix to sctp structure > net: add rte prefix to tcp structure > net: add rte prefix to udp structure > doc: announce network api change > > app/pdump/main.c | 2 +- > app/test-acl/main.c | 2 +- > app/test-eventdev/test_perf_common.c | 2 +- > app/test-eventdev/test_pipeline_common.c | 2 +- > app/test-pipeline/pipeline_acl.c | 19 +- > app/test-pipeline/pipeline_hash.c | 12 +- > app/test-pmd/cmdline.c | 90 +++--- > app/test-pmd/cmdline_flow.c | 86 +++--- > app/test-pmd/config.c | 35 ++- > app/test-pmd/csumonly.c | 169 +++++----- > app/test-pmd/flowgen.c | 30 +- > app/test-pmd/icmpecho.c | 117 +++---- > app/test-pmd/ieee1588fwd.c | 18 +- > app/test-pmd/macfwd.c | 12 +- > app/test-pmd/macswap.h | 12 +- > app/test-pmd/macswap_common.h | 4 +- > app/test-pmd/macswap_neon.h | 12 +- > app/test-pmd/macswap_sse.h | 12 +- > app/test-pmd/parameters.c | 6 +- > app/test-pmd/testpmd.c | 23 +- > app/test-pmd/testpmd.h | 30 +- > app/test-pmd/txonly.c | 45 +-- > app/test-pmd/util.c | 34 +- > app/test/packet_burst_generator.c | 150 ++++----- > app/test/packet_burst_generator.h | 33 +- > app/test/test_acl.c | 8 +- > app/test/test_acl.h | 122 ++++---- > app/test/test_cmdline_etheraddr.c | 16 +- > app/test/test_efd.c | 20 +- > app/test/test_event_eth_rx_adapter.c | 2 +- > app/test/test_event_eth_tx_adapter.c | 2 +- > app/test/test_flow_classify.c | 70 +++-- > app/test/test_hash.c | 20 +- > app/test/test_ipsec.c | 13 +- > app/test/test_link_bonding.c | 342 ++++++++++++--------- > app/test/test_link_bonding_mode4.c | 124 ++++---- > app/test/test_link_bonding_rssconf.c | 6 +- > app/test/test_lpm.c | 76 ++--- > app/test/test_lpm_perf.c | 10 +- > app/test/test_member.c | 20 +- > app/test/test_pmd_perf.c | 20 +- > app/test/test_sched.c | 24 +- > app/test/test_table_acl.c | 8 +- > app/test/test_thash.c | 12 +- > app/test/virtual_pmd.c | 6 +- > app/test/virtual_pmd.h | 2 +- > doc/guides/nics/kni.rst | 2 +- > doc/guides/prog_guide/bbdev.rst | 6 +- > .../prog_guide/packet_classif_access_ctrl.rst | 18 +- > doc/guides/prog_guide/rte_flow.rst | 4 +- > doc/guides/rel_notes/deprecation.rst | 4 - > doc/guides/rel_notes/release_19_08.rst | 3 + > doc/guides/sample_app_ug/flow_classify.rst | 28 +- > doc/guides/sample_app_ug/flow_filtering.rst | 6 +- > doc/guides/sample_app_ug/ip_frag.rst | 16 +- > doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- > doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- > doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- > .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- > doc/guides/sample_app_ug/l3_forward.rst | 12 +- > doc/guides/sample_app_ug/link_status_intr.rst | 6 +- > doc/guides/sample_app_ug/ptpclient.rst | 6 +- > doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- > doc/guides/sample_app_ug/server_node_efd.rst | 12 +- > doc/guides/sample_app_ug/skeleton.rst | 4 +- > doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- > drivers/bus/dpaa/include/compat.h | 2 + > drivers/bus/dpaa/include/fman.h | 2 +- > drivers/bus/dpaa/include/netcfg.h | 4 +- > drivers/net/af_packet/rte_eth_af_packet.c | 2 +- > drivers/net/af_xdp/rte_eth_af_xdp.c | 8 +- > drivers/net/ark/ark_ethdev.c | 19 +- > drivers/net/ark/ark_ext.h | 4 +- > drivers/net/ark/ark_global.h | 5 +- > drivers/net/atlantic/atl_ethdev.c | 27 +- > drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- > drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- > drivers/net/avp/avp_ethdev.c | 21 +- > drivers/net/avp/rte_avp_common.h | 2 +- > drivers/net/axgbe/axgbe_dev.c | 4 +- > drivers/net/axgbe/axgbe_ethdev.c | 10 +- > drivers/net/axgbe/axgbe_ethdev.h | 4 +- > drivers/net/axgbe/axgbe_rxtx.c | 2 +- > drivers/net/bnx2x/bnx2x.c | 16 +- > drivers/net/bnx2x/bnx2x_ethdev.c | 5 +- > drivers/net/bnx2x/bnx2x_ethdev.h | 3 +- > drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- > drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- > drivers/net/bnx2x/ecore_sp.h | 2 +- > drivers/net/bnxt/bnxt.h | 4 +- > drivers/net/bnxt/bnxt_ethdev.c | 80 ++--- > drivers/net/bnxt/bnxt_filter.c | 4 +- > drivers/net/bnxt/bnxt_filter.h | 8 +- > drivers/net/bnxt/bnxt_flow.c | 27 +- > drivers/net/bnxt/bnxt_hwrm.c | 41 +-- > drivers/net/bnxt/bnxt_hwrm.h | 2 +- > drivers/net/bnxt/bnxt_ring.c | 8 +- > drivers/net/bnxt/bnxt_rxq.c | 2 +- > drivers/net/bnxt/bnxt_rxr.c | 4 +- > drivers/net/bnxt/bnxt_vnic.c | 2 +- > drivers/net/bnxt/rte_pmd_bnxt.c | 14 +- > drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- > drivers/net/bonding/rte_eth_bond.h | 2 +- > drivers/net/bonding/rte_eth_bond_8023ad.c | 30 +- > drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- > drivers/net/bonding/rte_eth_bond_8023ad_private.h | 2 +- > drivers/net/bonding/rte_eth_bond_alb.c | 98 +++--- > drivers/net/bonding/rte_eth_bond_alb.h | 10 +- > drivers/net/bonding/rte_eth_bond_api.c | 2 +- > drivers/net/bonding/rte_eth_bond_args.c | 2 +- > drivers/net/bonding/rte_eth_bond_pmd.c | 203 ++++++------ > drivers/net/bonding/rte_eth_bond_private.h | 8 +- > drivers/net/cxgbe/base/adapter.h | 2 +- > drivers/net/cxgbe/cxgbe.h | 5 +- > drivers/net/cxgbe/cxgbe_compat.h | 1 + > drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- > drivers/net/cxgbe/cxgbe_filter.h | 2 +- > drivers/net/cxgbe/cxgbe_flow.c | 10 +- > drivers/net/cxgbe/cxgbe_main.c | 4 +- > drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- > 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 | 9 +- > drivers/net/dpaa/dpaa_ethdev.c | 20 +- > drivers/net/dpaa/dpaa_rxtx.c | 23 +- > drivers/net/dpaa2/dpaa2_ethdev.c | 37 +-- > drivers/net/dpaa2/dpaa2_flow.c | 18 +- > drivers/net/e1000/e1000_ethdev.h | 5 +- > drivers/net/e1000/em_ethdev.c | 39 +-- > drivers/net/e1000/em_rxtx.c | 24 +- > drivers/net/e1000/igb_ethdev.c | 76 ++--- > drivers/net/e1000/igb_flow.c | 12 +- > drivers/net/e1000/igb_pf.c | 17 +- > drivers/net/e1000/igb_rxtx.c | 23 +- > drivers/net/ena/ena_ethdev.c | 17 +- > drivers/net/ena/ena_ethdev.h | 2 +- > drivers/net/enetc/base/enetc_hw.h | 4 +- > drivers/net/enetc/enetc_ethdev.c | 21 +- > drivers/net/enic/enic.h | 4 +- > drivers/net/enic/enic_clsf.c | 40 +-- > drivers/net/enic/enic_ethdev.c | 29 +- > drivers/net/enic/enic_flow.c | 114 +++---- > drivers/net/enic/enic_main.c | 4 +- > drivers/net/enic/enic_res.c | 5 +- > drivers/net/failsafe/failsafe.c | 8 +- > drivers/net/failsafe/failsafe_args.c | 4 +- > drivers/net/failsafe/failsafe_ether.c | 7 +- > drivers/net/failsafe/failsafe_ops.c | 6 +- > drivers/net/failsafe/failsafe_private.h | 4 +- > drivers/net/fm10k/fm10k.h | 2 +- > drivers/net/fm10k/fm10k_ethdev.c | 18 +- > drivers/net/i40e/i40e_ethdev.c | 143 +++++---- > drivers/net/i40e/i40e_ethdev.h | 23 +- > drivers/net/i40e/i40e_ethdev_vf.c | 68 ++-- > drivers/net/i40e/i40e_fdir.c | 127 ++++---- > drivers/net/i40e/i40e_flow.c | 58 ++-- > drivers/net/i40e/i40e_pf.c | 18 +- > drivers/net/i40e/i40e_rxtx.c | 28 +- > drivers/net/i40e/i40e_vf_representor.c | 2 +- > drivers/net/i40e/rte_pmd_i40e.c | 31 +- > drivers/net/i40e/rte_pmd_i40e.h | 8 +- > drivers/net/iavf/iavf.h | 4 +- > drivers/net/iavf/iavf_ethdev.c | 53 ++-- > drivers/net/iavf/iavf_rxtx.c | 14 +- > drivers/net/iavf/iavf_vchnl.c | 8 +- > drivers/net/ice/ice_ethdev.c | 64 ++-- > drivers/net/ice/ice_ethdev.h | 6 +- > drivers/net/ice/ice_rxtx.c | 28 +- > drivers/net/ipn3ke/ipn3ke_ethdev.h | 6 +- > drivers/net/ipn3ke/ipn3ke_flow.c | 4 +- > drivers/net/ipn3ke/ipn3ke_representor.c | 21 +- > drivers/net/ixgbe/ixgbe_ethdev.c | 107 ++++--- > drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- > drivers/net/ixgbe/ixgbe_flow.c | 22 +- > drivers/net/ixgbe/ixgbe_pf.c | 16 +- > drivers/net/ixgbe/ixgbe_rxtx.c | 18 +- > drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- > drivers/net/ixgbe/rte_pmd_ixgbe.c | 11 +- > drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- > drivers/net/kni/rte_eth_kni.c | 6 +- > drivers/net/liquidio/lio_ethdev.c | 23 +- > drivers/net/mlx4/mlx4.c | 4 +- > drivers/net/mlx4/mlx4.h | 10 +- > drivers/net/mlx4/mlx4_ethdev.c | 12 +- > drivers/net/mlx4/mlx4_flow.c | 16 +- > drivers/net/mlx4/mlx4_rxtx.c | 2 +- > drivers/net/mlx5/mlx5.c | 4 +- > drivers/net/mlx5/mlx5.h | 15 +- > drivers/net/mlx5/mlx5_flow.c | 22 +- > drivers/net/mlx5/mlx5_flow_dv.c | 44 +-- > drivers/net/mlx5/mlx5_flow_tcf.c | 66 ++-- > drivers/net/mlx5/mlx5_flow_verbs.c | 30 +- > drivers/net/mlx5/mlx5_mac.c | 18 +- > drivers/net/mlx5/mlx5_nl.c | 28 +- > drivers/net/mlx5/mlx5_rxtx.c | 6 +- > drivers/net/mlx5/mlx5_rxtx.h | 2 +- > drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- > drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- > drivers/net/mlx5/mlx5_trigger.c | 6 +- > drivers/net/mvneta/mvneta_ethdev.c | 22 +- > drivers/net/mvneta/mvneta_ethdev.h | 6 +- > drivers/net/mvpp2/mrvl_ethdev.c | 22 +- > drivers/net/mvpp2/mrvl_ethdev.h | 6 +- > drivers/net/mvpp2/mrvl_flow.c | 4 +- > drivers/net/netvsc/hn_ethdev.c | 4 +- > drivers/net/netvsc/hn_nvs.c | 2 +- > drivers/net/netvsc/hn_rndis.c | 2 +- > drivers/net/netvsc/hn_rxtx.c | 12 +- > drivers/net/netvsc/hn_var.h | 4 +- > drivers/net/netvsc/hn_vf.c | 8 +- > drivers/net/nfb/nfb_ethdev.c | 16 +- > drivers/net/nfp/nfp_net.c | 22 +- > drivers/net/nfp/nfp_net_pmd.h | 2 +- > drivers/net/null/rte_eth_null.c | 6 +- > drivers/net/octeontx/octeontx_ethdev.c | 9 +- > drivers/net/octeontx/octeontx_ethdev.h | 2 +- > drivers/net/pcap/rte_eth_pcap.c | 22 +- > drivers/net/qede/base/bcm_osal.h | 4 +- > drivers/net/qede/qede_ethdev.c | 71 +++-- > drivers/net/qede/qede_ethdev.h | 6 +- > drivers/net/qede/qede_filter.c | 68 ++-- > drivers/net/qede/qede_if.h | 4 +- > drivers/net/qede/qede_main.c | 6 +- > drivers/net/qede/qede_rxtx.c | 34 +- > drivers/net/qede/qede_rxtx.h | 2 +- > drivers/net/ring/rte_eth_ring.c | 4 +- > drivers/net/sfc/sfc.h | 2 +- > drivers/net/sfc/sfc_ef10_tx.c | 4 +- > drivers/net/sfc/sfc_ethdev.c | 24 +- > drivers/net/sfc/sfc_flow.c | 12 +- > drivers/net/sfc/sfc_port.c | 8 +- > drivers/net/sfc/sfc_tso.c | 4 +- > drivers/net/sfc/sfc_tso.h | 4 +- > drivers/net/softnic/parser.c | 18 +- > drivers/net/softnic/parser.h | 2 +- > drivers/net/softnic/rte_eth_softnic.c | 2 +- > drivers/net/softnic/rte_eth_softnic_flow.c | 4 +- > drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- > drivers/net/szedata2/rte_eth_szedata2.c | 8 +- > drivers/net/tap/rte_eth_tap.c | 68 ++-- > drivers/net/tap/rte_eth_tap.h | 4 +- > drivers/net/tap/tap_bpf_program.c | 14 +- > drivers/net/tap/tap_flow.c | 16 +- > drivers/net/thunderx/base/nicvf_plat.h | 5 +- > drivers/net/thunderx/nicvf_ethdev.c | 19 +- > drivers/net/thunderx/nicvf_struct.h | 2 +- > drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- > drivers/net/vhost/rte_eth_vhost.c | 12 +- > drivers/net/virtio/virtio_ethdev.c | 78 ++--- > drivers/net/virtio/virtio_pci.h | 4 +- > drivers/net/virtio/virtio_rxtx.c | 33 +- > 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 | 12 +- > drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- > drivers/net/vmxnet3/vmxnet3_rxtx.c | 47 +-- > examples/bbdev_app/main.c | 41 +-- > examples/bond/main.c | 83 ++--- > examples/distributor/main.c | 4 +- > examples/ethtool/ethtool-app/ethapp.c | 8 +- > examples/ethtool/ethtool-app/main.c | 10 +- > examples/ethtool/lib/rte_ethtool.c | 8 +- > examples/ethtool/lib/rte_ethtool.h | 7 +- > examples/eventdev_pipeline/main.c | 4 +- > examples/eventdev_pipeline/pipeline_common.h | 10 +- > examples/flow_classify/flow_classify.c | 30 +- > examples/flow_filtering/main.c | 10 +- > examples/ip_fragmentation/main.c | 69 +++-- > examples/ip_pipeline/cli.c | 4 +- > examples/ip_pipeline/kni.c | 2 +- > examples/ip_pipeline/parser.c | 18 +- > examples/ip_pipeline/parser.h | 2 +- > examples/ip_pipeline/pipeline.c | 40 +-- > examples/ip_reassembly/main.c | 51 +-- > examples/ipsec-secgw/esp.c | 47 +-- > examples/ipsec-secgw/ipsec-secgw.c | 43 +-- > examples/ipsec-secgw/ipsec.h | 2 +- > examples/ipsec-secgw/parser.c | 4 +- > examples/ipsec-secgw/sa.c | 16 +- > examples/ipv4_multicast/main.c | 60 ++-- > examples/kni/main.c | 14 +- > examples/l2fwd-cat/l2fwd-cat.c | 4 +- > examples/l2fwd-crypto/main.c | 26 +- > examples/l2fwd-jobstats/main.c | 8 +- > examples/l2fwd-keepalive/main.c | 8 +- > examples/l2fwd/main.c | 8 +- > examples/l3fwd-acl/main.c | 106 ++++--- > examples/l3fwd-power/main.c | 102 +++--- > examples/l3fwd-vf/main.c | 68 ++-- > examples/l3fwd/l3fwd.h | 8 +- > examples/l3fwd/l3fwd_altivec.h | 26 +- > examples/l3fwd/l3fwd_common.h | 4 +- > examples/l3fwd/l3fwd_em.c | 46 +-- > examples/l3fwd/l3fwd_em.h | 22 +- > examples/l3fwd/l3fwd_em_hlm.h | 19 +- > examples/l3fwd/l3fwd_em_hlm_neon.h | 20 +- > examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- > examples/l3fwd/l3fwd_em_sequential.h | 19 +- > examples/l3fwd/l3fwd_lpm.c | 50 +-- > examples/l3fwd/l3fwd_lpm.h | 22 +- > examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- > examples/l3fwd/l3fwd_lpm_neon.h | 30 +- > examples/l3fwd/l3fwd_lpm_sse.h | 20 +- > examples/l3fwd/l3fwd_neon.h | 26 +- > examples/l3fwd/l3fwd_sse.h | 26 +- > examples/l3fwd/main.c | 20 +- > examples/link_status_interrupt/main.c | 8 +- > examples/load_balancer/runtime.c | 8 +- > .../client_server_mp/mp_server/main.c | 2 +- > examples/packet_ordering/main.c | 2 +- > examples/performance-thread/l3fwd-thread/main.c | 337 ++++++++++---------- > examples/ptpclient/ptpclient.c | 32 +- > examples/qos_meter/main.c | 5 +- > examples/qos_sched/init.c | 2 +- > examples/quota_watermark/qw/main.c | 8 +- > examples/rxtx_callbacks/main.c | 4 +- > examples/server_node_efd/node/node.c | 6 +- > examples/server_node_efd/server/main.c | 8 +- > examples/skeleton/basicfwd.c | 4 +- > examples/tep_termination/main.c | 2 +- > examples/tep_termination/main.h | 2 +- > examples/tep_termination/vxlan.c | 115 +++---- > examples/tep_termination/vxlan.h | 8 +- > examples/tep_termination/vxlan_setup.c | 32 +- > examples/tep_termination/vxlan_setup.h | 2 +- > examples/vhost/main.c | 42 +-- > examples/vhost/main.h | 2 +- > examples/vm_power_manager/channel_monitor.c | 12 +- > .../guest_cli/vm_power_cli_guest.c | 2 +- > examples/vm_power_manager/main.c | 6 +- > examples/vmdq/main.c | 12 +- > examples/vmdq_dcb/main.c | 12 +- > lib/librte_ethdev/rte_class_eth.c | 4 +- > lib/librte_ethdev/rte_eth_ctrl.h | 12 +- > lib/librte_ethdev/rte_ethdev.c | 59 ++-- > lib/librte_ethdev/rte_ethdev.h | 15 +- > lib/librte_ethdev/rte_ethdev_core.h | 12 +- > lib/librte_ethdev/rte_flow.h | 34 +- > lib/librte_eventdev/rte_event_eth_rx_adapter.c | 33 +- > lib/librte_gro/gro_tcp4.c | 26 +- > lib/librte_gro/gro_tcp4.h | 22 +- > lib/librte_gro/gro_vxlan_tcp4.c | 66 ++-- > lib/librte_gro/gro_vxlan_tcp4.h | 6 +- > lib/librte_gso/gso_common.h | 16 +- > lib/librte_gso/gso_tcp4.c | 12 +- > lib/librte_gso/gso_tunnel_tcp4.c | 14 +- > lib/librte_gso/gso_udp4.c | 10 +- > lib/librte_gso/rte_gso.h | 8 +- > lib/librte_hash/rte_thash.h | 3 +- > lib/librte_ip_frag/rte_ip_frag.h | 13 +- > lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- > lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- > lib/librte_ip_frag/rte_ipv6_fragmentation.c | 28 +- > lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- > lib/librte_ipsec/crypto.h | 2 +- > lib/librte_ipsec/esp_inb.c | 10 +- > lib/librte_ipsec/esp_outb.c | 8 +- > lib/librte_ipsec/iph.h | 8 +- > lib/librte_ipsec/sa.c | 10 +- > lib/librte_kni/rte_kni.c | 4 +- > lib/librte_kni/rte_kni.h | 2 +- > lib/librte_net/rte_arp.c | 33 +- > lib/librte_net/rte_arp.h | 36 +-- > lib/librte_net/rte_esp.h | 2 +- > lib/librte_net/rte_ether.h | 189 ++++++------ > lib/librte_net/rte_gre.h | 2 +- > lib/librte_net/rte_icmp.h | 6 +- > lib/librte_net/rte_ip.h | 75 ++--- > lib/librte_net/rte_net.c | 94 +++--- > lib/librte_net/rte_net.h | 28 +- > lib/librte_net/rte_sctp.h | 2 +- > lib/librte_net/rte_tcp.h | 2 +- > lib/librte_net/rte_udp.h | 2 +- > lib/librte_pipeline/rte_table_action.c | 242 ++++++++------- > lib/librte_pipeline/rte_table_action.h | 4 +- > lib/librte_port/rte_port_ras.c | 10 +- > lib/librte_port/rte_port_source_sink.c | 6 +- > lib/librte_vhost/vhost.h | 2 +- > lib/librte_vhost/virtio_net.c | 43 +-- > 385 files changed, 4563 insertions(+), 4234 deletions(-) > Looks good Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] prefix network structures 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (15 preceding siblings ...) 2019-05-21 16:23 ` [dpdk-dev] [PATCH 00/15] prefix network structures Stephen Hemminger @ 2019-05-23 11:41 ` Maxime Coquelin 2019-05-24 11:38 ` Ferruh Yigit 17 siblings, 0 replies; 107+ messages in thread From: Maxime Coquelin @ 2019-05-23 11:41 UTC (permalink / raw) To: Olivier Matz, dev; +Cc: stephen, ferruh.yigit On 5/21/19 6:13 PM, Olivier Matz wrote: > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > > This patchset adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > This was discussed in [1], and requested by the techboard [2]. > > patch-v1: > * rease on top of v19.05 > * remove uneeded renames in drivers/net/bonding/rte_eth_bond_pmd.c > and app/test-pmd/icmpecho.c (arp-related variables) > * do not modify base drivers, except cxgbe, thunderx, enetc, qede: > only files that already contain dpdk definitions are modified. > * fix checkpatch issues when it does not impact the code style too > much. Big warnings remain about the RTE_IPv4() macros because > arguments are separated by ',' instead of ', '. > * add a release note patch > * tested compilation on x86_64-linux and x86_64-freebsd. > > rfc-v2: > * rebase on top of v19.05-rc1 > > > [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html > [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html > > > Olivier Matz (15): > net: add rte prefix to arp structures > net: add rte prefix to arp defines > net: add rte prefix to ether structures > net: add rte prefix to ether functions > net: add rte prefix to ether defines > net: add rte prefix to esp structure > net: add rte prefix to gre structure > net: add rte prefix to icmp structure > net: add rte prefix to icmp defines > net: add rte prefix to ip structure > net: add rte prefix to ip defines > net: add rte prefix to sctp structure > net: add rte prefix to tcp structure > net: add rte prefix to udp structure > doc: announce network api change > > app/pdump/main.c | 2 +- > app/test-acl/main.c | 2 +- > app/test-eventdev/test_perf_common.c | 2 +- > app/test-eventdev/test_pipeline_common.c | 2 +- > app/test-pipeline/pipeline_acl.c | 19 +- > app/test-pipeline/pipeline_hash.c | 12 +- > app/test-pmd/cmdline.c | 90 +++--- > app/test-pmd/cmdline_flow.c | 86 +++--- > app/test-pmd/config.c | 35 ++- > app/test-pmd/csumonly.c | 169 +++++----- > app/test-pmd/flowgen.c | 30 +- > app/test-pmd/icmpecho.c | 117 +++---- > app/test-pmd/ieee1588fwd.c | 18 +- > app/test-pmd/macfwd.c | 12 +- > app/test-pmd/macswap.h | 12 +- > app/test-pmd/macswap_common.h | 4 +- > app/test-pmd/macswap_neon.h | 12 +- > app/test-pmd/macswap_sse.h | 12 +- > app/test-pmd/parameters.c | 6 +- > app/test-pmd/testpmd.c | 23 +- > app/test-pmd/testpmd.h | 30 +- > app/test-pmd/txonly.c | 45 +-- > app/test-pmd/util.c | 34 +- > app/test/packet_burst_generator.c | 150 ++++----- > app/test/packet_burst_generator.h | 33 +- > app/test/test_acl.c | 8 +- > app/test/test_acl.h | 122 ++++---- > app/test/test_cmdline_etheraddr.c | 16 +- > app/test/test_efd.c | 20 +- > app/test/test_event_eth_rx_adapter.c | 2 +- > app/test/test_event_eth_tx_adapter.c | 2 +- > app/test/test_flow_classify.c | 70 +++-- > app/test/test_hash.c | 20 +- > app/test/test_ipsec.c | 13 +- > app/test/test_link_bonding.c | 342 ++++++++++++--------- > app/test/test_link_bonding_mode4.c | 124 ++++---- > app/test/test_link_bonding_rssconf.c | 6 +- > app/test/test_lpm.c | 76 ++--- > app/test/test_lpm_perf.c | 10 +- > app/test/test_member.c | 20 +- > app/test/test_pmd_perf.c | 20 +- > app/test/test_sched.c | 24 +- > app/test/test_table_acl.c | 8 +- > app/test/test_thash.c | 12 +- > app/test/virtual_pmd.c | 6 +- > app/test/virtual_pmd.h | 2 +- > doc/guides/nics/kni.rst | 2 +- > doc/guides/prog_guide/bbdev.rst | 6 +- > .../prog_guide/packet_classif_access_ctrl.rst | 18 +- > doc/guides/prog_guide/rte_flow.rst | 4 +- > doc/guides/rel_notes/deprecation.rst | 4 - > doc/guides/rel_notes/release_19_08.rst | 3 + > doc/guides/sample_app_ug/flow_classify.rst | 28 +- > doc/guides/sample_app_ug/flow_filtering.rst | 6 +- > doc/guides/sample_app_ug/ip_frag.rst | 16 +- > doc/guides/sample_app_ug/ip_reassembly.rst | 16 +- > doc/guides/sample_app_ug/ipv4_multicast.rst | 16 +- > doc/guides/sample_app_ug/l2_forward_job_stats.rst | 6 +- > .../sample_app_ug/l2_forward_real_virtual.rst | 6 +- > doc/guides/sample_app_ug/l3_forward.rst | 12 +- > doc/guides/sample_app_ug/link_status_intr.rst | 6 +- > doc/guides/sample_app_ug/ptpclient.rst | 6 +- > doc/guides/sample_app_ug/rxtx_callbacks.rst | 2 +- > doc/guides/sample_app_ug/server_node_efd.rst | 12 +- > doc/guides/sample_app_ug/skeleton.rst | 4 +- > doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst | 4 +- > drivers/bus/dpaa/include/compat.h | 2 + > drivers/bus/dpaa/include/fman.h | 2 +- > drivers/bus/dpaa/include/netcfg.h | 4 +- > drivers/net/af_packet/rte_eth_af_packet.c | 2 +- > drivers/net/af_xdp/rte_eth_af_xdp.c | 8 +- > drivers/net/ark/ark_ethdev.c | 19 +- > drivers/net/ark/ark_ext.h | 4 +- > drivers/net/ark/ark_global.h | 5 +- > drivers/net/atlantic/atl_ethdev.c | 27 +- > drivers/net/atlantic/hw_atl/hw_atl_utils.c | 8 +- > drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 4 +- > drivers/net/avp/avp_ethdev.c | 21 +- > drivers/net/avp/rte_avp_common.h | 2 +- > drivers/net/axgbe/axgbe_dev.c | 4 +- > drivers/net/axgbe/axgbe_ethdev.c | 10 +- > drivers/net/axgbe/axgbe_ethdev.h | 4 +- > drivers/net/axgbe/axgbe_rxtx.c | 2 +- > drivers/net/bnx2x/bnx2x.c | 16 +- > drivers/net/bnx2x/bnx2x_ethdev.c | 5 +- > drivers/net/bnx2x/bnx2x_ethdev.h | 3 +- > drivers/net/bnx2x/bnx2x_vfpf.c | 8 +- > drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- > drivers/net/bnx2x/ecore_sp.h | 2 +- > drivers/net/bnxt/bnxt.h | 4 +- > drivers/net/bnxt/bnxt_ethdev.c | 80 ++--- > drivers/net/bnxt/bnxt_filter.c | 4 +- > drivers/net/bnxt/bnxt_filter.h | 8 +- > drivers/net/bnxt/bnxt_flow.c | 27 +- > drivers/net/bnxt/bnxt_hwrm.c | 41 +-- > drivers/net/bnxt/bnxt_hwrm.h | 2 +- > drivers/net/bnxt/bnxt_ring.c | 8 +- > drivers/net/bnxt/bnxt_rxq.c | 2 +- > drivers/net/bnxt/bnxt_rxr.c | 4 +- > drivers/net/bnxt/bnxt_vnic.c | 2 +- > drivers/net/bnxt/rte_pmd_bnxt.c | 14 +- > drivers/net/bnxt/rte_pmd_bnxt.h | 4 +- > drivers/net/bonding/rte_eth_bond.h | 2 +- > drivers/net/bonding/rte_eth_bond_8023ad.c | 30 +- > drivers/net/bonding/rte_eth_bond_8023ad.h | 10 +- > drivers/net/bonding/rte_eth_bond_8023ad_private.h | 2 +- > drivers/net/bonding/rte_eth_bond_alb.c | 98 +++--- > drivers/net/bonding/rte_eth_bond_alb.h | 10 +- > drivers/net/bonding/rte_eth_bond_api.c | 2 +- > drivers/net/bonding/rte_eth_bond_args.c | 2 +- > drivers/net/bonding/rte_eth_bond_pmd.c | 203 ++++++------ > drivers/net/bonding/rte_eth_bond_private.h | 8 +- > drivers/net/cxgbe/base/adapter.h | 2 +- > drivers/net/cxgbe/cxgbe.h | 5 +- > drivers/net/cxgbe/cxgbe_compat.h | 1 + > drivers/net/cxgbe/cxgbe_ethdev.c | 14 +- > drivers/net/cxgbe/cxgbe_filter.h | 2 +- > drivers/net/cxgbe/cxgbe_flow.c | 10 +- > drivers/net/cxgbe/cxgbe_main.c | 4 +- > drivers/net/cxgbe/cxgbe_pfvf.h | 2 +- > 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 | 9 +- > drivers/net/dpaa/dpaa_ethdev.c | 20 +- > drivers/net/dpaa/dpaa_rxtx.c | 23 +- > drivers/net/dpaa2/dpaa2_ethdev.c | 37 +-- > drivers/net/dpaa2/dpaa2_flow.c | 18 +- > drivers/net/e1000/e1000_ethdev.h | 5 +- > drivers/net/e1000/em_ethdev.c | 39 +-- > drivers/net/e1000/em_rxtx.c | 24 +- > drivers/net/e1000/igb_ethdev.c | 76 ++--- > drivers/net/e1000/igb_flow.c | 12 +- > drivers/net/e1000/igb_pf.c | 17 +- > drivers/net/e1000/igb_rxtx.c | 23 +- > drivers/net/ena/ena_ethdev.c | 17 +- > drivers/net/ena/ena_ethdev.h | 2 +- > drivers/net/enetc/base/enetc_hw.h | 4 +- > drivers/net/enetc/enetc_ethdev.c | 21 +- > drivers/net/enic/enic.h | 4 +- > drivers/net/enic/enic_clsf.c | 40 +-- > drivers/net/enic/enic_ethdev.c | 29 +- > drivers/net/enic/enic_flow.c | 114 +++---- > drivers/net/enic/enic_main.c | 4 +- > drivers/net/enic/enic_res.c | 5 +- > drivers/net/failsafe/failsafe.c | 8 +- > drivers/net/failsafe/failsafe_args.c | 4 +- > drivers/net/failsafe/failsafe_ether.c | 7 +- > drivers/net/failsafe/failsafe_ops.c | 6 +- > drivers/net/failsafe/failsafe_private.h | 4 +- > drivers/net/fm10k/fm10k.h | 2 +- > drivers/net/fm10k/fm10k_ethdev.c | 18 +- > drivers/net/i40e/i40e_ethdev.c | 143 +++++---- > drivers/net/i40e/i40e_ethdev.h | 23 +- > drivers/net/i40e/i40e_ethdev_vf.c | 68 ++-- > drivers/net/i40e/i40e_fdir.c | 127 ++++---- > drivers/net/i40e/i40e_flow.c | 58 ++-- > drivers/net/i40e/i40e_pf.c | 18 +- > drivers/net/i40e/i40e_rxtx.c | 28 +- > drivers/net/i40e/i40e_vf_representor.c | 2 +- > drivers/net/i40e/rte_pmd_i40e.c | 31 +- > drivers/net/i40e/rte_pmd_i40e.h | 8 +- > drivers/net/iavf/iavf.h | 4 +- > drivers/net/iavf/iavf_ethdev.c | 53 ++-- > drivers/net/iavf/iavf_rxtx.c | 14 +- > drivers/net/iavf/iavf_vchnl.c | 8 +- > drivers/net/ice/ice_ethdev.c | 64 ++-- > drivers/net/ice/ice_ethdev.h | 6 +- > drivers/net/ice/ice_rxtx.c | 28 +- > drivers/net/ipn3ke/ipn3ke_ethdev.h | 6 +- > drivers/net/ipn3ke/ipn3ke_flow.c | 4 +- > drivers/net/ipn3ke/ipn3ke_representor.c | 21 +- > drivers/net/ixgbe/ixgbe_ethdev.c | 107 ++++--- > drivers/net/ixgbe/ixgbe_ethdev.h | 4 +- > drivers/net/ixgbe/ixgbe_flow.c | 22 +- > drivers/net/ixgbe/ixgbe_pf.c | 16 +- > drivers/net/ixgbe/ixgbe_rxtx.c | 18 +- > drivers/net/ixgbe/ixgbe_vf_representor.c | 4 +- > drivers/net/ixgbe/rte_pmd_ixgbe.c | 11 +- > drivers/net/ixgbe/rte_pmd_ixgbe.h | 2 +- > drivers/net/kni/rte_eth_kni.c | 6 +- > drivers/net/liquidio/lio_ethdev.c | 23 +- > drivers/net/mlx4/mlx4.c | 4 +- > drivers/net/mlx4/mlx4.h | 10 +- > drivers/net/mlx4/mlx4_ethdev.c | 12 +- > drivers/net/mlx4/mlx4_flow.c | 16 +- > drivers/net/mlx4/mlx4_rxtx.c | 2 +- > drivers/net/mlx5/mlx5.c | 4 +- > drivers/net/mlx5/mlx5.h | 15 +- > drivers/net/mlx5/mlx5_flow.c | 22 +- > drivers/net/mlx5/mlx5_flow_dv.c | 44 +-- > drivers/net/mlx5/mlx5_flow_tcf.c | 66 ++-- > drivers/net/mlx5/mlx5_flow_verbs.c | 30 +- > drivers/net/mlx5/mlx5_mac.c | 18 +- > drivers/net/mlx5/mlx5_nl.c | 28 +- > drivers/net/mlx5/mlx5_rxtx.c | 6 +- > drivers/net/mlx5/mlx5_rxtx.h | 2 +- > drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 8 +- > drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 10 +- > drivers/net/mlx5/mlx5_trigger.c | 6 +- > drivers/net/mvneta/mvneta_ethdev.c | 22 +- > drivers/net/mvneta/mvneta_ethdev.h | 6 +- > drivers/net/mvpp2/mrvl_ethdev.c | 22 +- > drivers/net/mvpp2/mrvl_ethdev.h | 6 +- > drivers/net/mvpp2/mrvl_flow.c | 4 +- > drivers/net/netvsc/hn_ethdev.c | 4 +- > drivers/net/netvsc/hn_nvs.c | 2 +- > drivers/net/netvsc/hn_rndis.c | 2 +- > drivers/net/netvsc/hn_rxtx.c | 12 +- > drivers/net/netvsc/hn_var.h | 4 +- > drivers/net/netvsc/hn_vf.c | 8 +- > drivers/net/nfb/nfb_ethdev.c | 16 +- > drivers/net/nfp/nfp_net.c | 22 +- > drivers/net/nfp/nfp_net_pmd.h | 2 +- > drivers/net/null/rte_eth_null.c | 6 +- > drivers/net/octeontx/octeontx_ethdev.c | 9 +- > drivers/net/octeontx/octeontx_ethdev.h | 2 +- > drivers/net/pcap/rte_eth_pcap.c | 22 +- > drivers/net/qede/base/bcm_osal.h | 4 +- > drivers/net/qede/qede_ethdev.c | 71 +++-- > drivers/net/qede/qede_ethdev.h | 6 +- > drivers/net/qede/qede_filter.c | 68 ++-- > drivers/net/qede/qede_if.h | 4 +- > drivers/net/qede/qede_main.c | 6 +- > drivers/net/qede/qede_rxtx.c | 34 +- > drivers/net/qede/qede_rxtx.h | 2 +- > drivers/net/ring/rte_eth_ring.c | 4 +- > drivers/net/sfc/sfc.h | 2 +- > drivers/net/sfc/sfc_ef10_tx.c | 4 +- > drivers/net/sfc/sfc_ethdev.c | 24 +- > drivers/net/sfc/sfc_flow.c | 12 +- > drivers/net/sfc/sfc_port.c | 8 +- > drivers/net/sfc/sfc_tso.c | 4 +- > drivers/net/sfc/sfc_tso.h | 4 +- > drivers/net/softnic/parser.c | 18 +- > drivers/net/softnic/parser.h | 2 +- > drivers/net/softnic/rte_eth_softnic.c | 2 +- > drivers/net/softnic/rte_eth_softnic_flow.c | 4 +- > drivers/net/softnic/rte_eth_softnic_pipeline.c | 40 +-- > drivers/net/szedata2/rte_eth_szedata2.c | 8 +- > drivers/net/tap/rte_eth_tap.c | 68 ++-- > drivers/net/tap/rte_eth_tap.h | 4 +- > drivers/net/tap/tap_bpf_program.c | 14 +- > drivers/net/tap/tap_flow.c | 16 +- > drivers/net/thunderx/base/nicvf_plat.h | 5 +- > drivers/net/thunderx/nicvf_ethdev.c | 19 +- > drivers/net/thunderx/nicvf_struct.h | 2 +- > drivers/net/vdev_netvsc/vdev_netvsc.c | 16 +- > drivers/net/vhost/rte_eth_vhost.c | 12 +- > drivers/net/virtio/virtio_ethdev.c | 78 ++--- > drivers/net/virtio/virtio_pci.h | 4 +- > drivers/net/virtio/virtio_rxtx.c | 33 +- > 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 | 12 +- > drivers/net/vmxnet3/vmxnet3_ethdev.h | 2 +- > drivers/net/vmxnet3/vmxnet3_rxtx.c | 47 +-- > examples/bbdev_app/main.c | 41 +-- > examples/bond/main.c | 83 ++--- > examples/distributor/main.c | 4 +- > examples/ethtool/ethtool-app/ethapp.c | 8 +- > examples/ethtool/ethtool-app/main.c | 10 +- > examples/ethtool/lib/rte_ethtool.c | 8 +- > examples/ethtool/lib/rte_ethtool.h | 7 +- > examples/eventdev_pipeline/main.c | 4 +- > examples/eventdev_pipeline/pipeline_common.h | 10 +- > examples/flow_classify/flow_classify.c | 30 +- > examples/flow_filtering/main.c | 10 +- > examples/ip_fragmentation/main.c | 69 +++-- > examples/ip_pipeline/cli.c | 4 +- > examples/ip_pipeline/kni.c | 2 +- > examples/ip_pipeline/parser.c | 18 +- > examples/ip_pipeline/parser.h | 2 +- > examples/ip_pipeline/pipeline.c | 40 +-- > examples/ip_reassembly/main.c | 51 +-- > examples/ipsec-secgw/esp.c | 47 +-- > examples/ipsec-secgw/ipsec-secgw.c | 43 +-- > examples/ipsec-secgw/ipsec.h | 2 +- > examples/ipsec-secgw/parser.c | 4 +- > examples/ipsec-secgw/sa.c | 16 +- > examples/ipv4_multicast/main.c | 60 ++-- > examples/kni/main.c | 14 +- > examples/l2fwd-cat/l2fwd-cat.c | 4 +- > examples/l2fwd-crypto/main.c | 26 +- > examples/l2fwd-jobstats/main.c | 8 +- > examples/l2fwd-keepalive/main.c | 8 +- > examples/l2fwd/main.c | 8 +- > examples/l3fwd-acl/main.c | 106 ++++--- > examples/l3fwd-power/main.c | 102 +++--- > examples/l3fwd-vf/main.c | 68 ++-- > examples/l3fwd/l3fwd.h | 8 +- > examples/l3fwd/l3fwd_altivec.h | 26 +- > examples/l3fwd/l3fwd_common.h | 4 +- > examples/l3fwd/l3fwd_em.c | 46 +-- > examples/l3fwd/l3fwd_em.h | 22 +- > examples/l3fwd/l3fwd_em_hlm.h | 19 +- > examples/l3fwd/l3fwd_em_hlm_neon.h | 20 +- > examples/l3fwd/l3fwd_em_hlm_sse.h | 16 +- > examples/l3fwd/l3fwd_em_sequential.h | 19 +- > examples/l3fwd/l3fwd_lpm.c | 50 +-- > examples/l3fwd/l3fwd_lpm.h | 22 +- > examples/l3fwd/l3fwd_lpm_altivec.h | 20 +- > examples/l3fwd/l3fwd_lpm_neon.h | 30 +- > examples/l3fwd/l3fwd_lpm_sse.h | 20 +- > examples/l3fwd/l3fwd_neon.h | 26 +- > examples/l3fwd/l3fwd_sse.h | 26 +- > examples/l3fwd/main.c | 20 +- > examples/link_status_interrupt/main.c | 8 +- > examples/load_balancer/runtime.c | 8 +- > .../client_server_mp/mp_server/main.c | 2 +- > examples/packet_ordering/main.c | 2 +- > examples/performance-thread/l3fwd-thread/main.c | 337 ++++++++++---------- > examples/ptpclient/ptpclient.c | 32 +- > examples/qos_meter/main.c | 5 +- > examples/qos_sched/init.c | 2 +- > examples/quota_watermark/qw/main.c | 8 +- > examples/rxtx_callbacks/main.c | 4 +- > examples/server_node_efd/node/node.c | 6 +- > examples/server_node_efd/server/main.c | 8 +- > examples/skeleton/basicfwd.c | 4 +- > examples/tep_termination/main.c | 2 +- > examples/tep_termination/main.h | 2 +- > examples/tep_termination/vxlan.c | 115 +++---- > examples/tep_termination/vxlan.h | 8 +- > examples/tep_termination/vxlan_setup.c | 32 +- > examples/tep_termination/vxlan_setup.h | 2 +- > examples/vhost/main.c | 42 +-- > examples/vhost/main.h | 2 +- > examples/vm_power_manager/channel_monitor.c | 12 +- > .../guest_cli/vm_power_cli_guest.c | 2 +- > examples/vm_power_manager/main.c | 6 +- > examples/vmdq/main.c | 12 +- > examples/vmdq_dcb/main.c | 12 +- > lib/librte_ethdev/rte_class_eth.c | 4 +- > lib/librte_ethdev/rte_eth_ctrl.h | 12 +- > lib/librte_ethdev/rte_ethdev.c | 59 ++-- > lib/librte_ethdev/rte_ethdev.h | 15 +- > lib/librte_ethdev/rte_ethdev_core.h | 12 +- > lib/librte_ethdev/rte_flow.h | 34 +- > lib/librte_eventdev/rte_event_eth_rx_adapter.c | 33 +- > lib/librte_gro/gro_tcp4.c | 26 +- > lib/librte_gro/gro_tcp4.h | 22 +- > lib/librte_gro/gro_vxlan_tcp4.c | 66 ++-- > lib/librte_gro/gro_vxlan_tcp4.h | 6 +- > lib/librte_gso/gso_common.h | 16 +- > lib/librte_gso/gso_tcp4.c | 12 +- > lib/librte_gso/gso_tunnel_tcp4.c | 14 +- > lib/librte_gso/gso_udp4.c | 10 +- > lib/librte_gso/rte_gso.h | 8 +- > lib/librte_hash/rte_thash.h | 3 +- > lib/librte_ip_frag/rte_ip_frag.h | 13 +- > lib/librte_ip_frag/rte_ipv4_fragmentation.c | 42 +-- > lib/librte_ip_frag/rte_ipv4_reassembly.c | 14 +- > lib/librte_ip_frag/rte_ipv6_fragmentation.c | 28 +- > lib/librte_ip_frag/rte_ipv6_reassembly.c | 6 +- > lib/librte_ipsec/crypto.h | 2 +- > lib/librte_ipsec/esp_inb.c | 10 +- > lib/librte_ipsec/esp_outb.c | 8 +- > lib/librte_ipsec/iph.h | 8 +- > lib/librte_ipsec/sa.c | 10 +- > lib/librte_kni/rte_kni.c | 4 +- > lib/librte_kni/rte_kni.h | 2 +- > lib/librte_net/rte_arp.c | 33 +- > lib/librte_net/rte_arp.h | 36 +-- > lib/librte_net/rte_esp.h | 2 +- > lib/librte_net/rte_ether.h | 189 ++++++------ > lib/librte_net/rte_gre.h | 2 +- > lib/librte_net/rte_icmp.h | 6 +- > lib/librte_net/rte_ip.h | 75 ++--- > lib/librte_net/rte_net.c | 94 +++--- > lib/librte_net/rte_net.h | 28 +- > lib/librte_net/rte_sctp.h | 2 +- > lib/librte_net/rte_tcp.h | 2 +- > lib/librte_net/rte_udp.h | 2 +- > lib/librte_pipeline/rte_table_action.c | 242 ++++++++------- > lib/librte_pipeline/rte_table_action.h | 4 +- > lib/librte_port/rte_port_ras.c | 10 +- > lib/librte_port/rte_port_source_sink.c | 6 +- > lib/librte_vhost/vhost.h | 2 +- > lib/librte_vhost/virtio_net.c | 43 +-- > 385 files changed, 4563 insertions(+), 4234 deletions(-) > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Thanks, Maxime ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] prefix network structures 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz ` (16 preceding siblings ...) 2019-05-23 11:41 ` Maxime Coquelin @ 2019-05-24 11:38 ` Ferruh Yigit 2019-05-29 7:59 ` David Marchand 17 siblings, 1 reply; 107+ messages in thread From: Ferruh Yigit @ 2019-05-24 11:38 UTC (permalink / raw) To: Olivier Matz, dev; +Cc: stephen, Maxime Coquelin, Thomas Monjalon On 5/21/2019 5:13 PM, Olivier Matz wrote: > The rte_net headers conflict with the libc headers, because > some definitions are duplicated, sometimes with few differences. > > This patchset adds the rte_ (or RTE_) prefix to all structures, functions > and defines in rte_net library. This is a big changeset, that will > break the API of many functions, but not the ABI. > > This was discussed in [1], and requested by the techboard [2]. > > patch-v1: > * rease on top of v19.05 > * remove uneeded renames in drivers/net/bonding/rte_eth_bond_pmd.c > and app/test-pmd/icmpecho.c (arp-related variables) > * do not modify base drivers, except cxgbe, thunderx, enetc, qede: > only files that already contain dpdk definitions are modified. > * fix checkpatch issues when it does not impact the code style too > much. Big warnings remain about the RTE_IPv4() macros because > arguments are separated by ',' instead of ', '. > * add a release note patch > * tested compilation on x86_64-linux and x86_64-freebsd. > > rfc-v2: > * rebase on top of v19.05-rc1 > > > [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html > [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html > > > Olivier Matz (15): > net: add rte prefix to arp structures > net: add rte prefix to arp defines > net: add rte prefix to ether structures > net: add rte prefix to ether functions > net: add rte prefix to ether defines > net: add rte prefix to esp structure > net: add rte prefix to gre structure > net: add rte prefix to icmp structure > net: add rte prefix to icmp defines > net: add rte prefix to ip structure > net: add rte prefix to ip defines > net: add rte prefix to sctp structure > net: add rte prefix to tcp structure > net: add rte prefix to udp structure > doc: announce network api change Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> For series, Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> Series applied to dpdk-next-net/master, thanks. ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] prefix network structures 2019-05-24 11:38 ` Ferruh Yigit @ 2019-05-29 7:59 ` David Marchand 2019-05-29 14:46 ` Olivier Matz 0 siblings, 1 reply; 107+ messages in thread From: David Marchand @ 2019-05-29 7:59 UTC (permalink / raw) To: Ferruh Yigit Cc: Olivier Matz, dev, Stephen Hemminger, Maxime Coquelin, Thomas Monjalon On Fri, May 24, 2019 at 1:38 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote: > On 5/21/2019 5:13 PM, Olivier Matz wrote: > > The rte_net headers conflict with the libc headers, because > > some definitions are duplicated, sometimes with few differences. > > > > This patchset adds the rte_ (or RTE_) prefix to all structures, functions > > and defines in rte_net library. This is a big changeset, that will > > break the API of many functions, but not the ABI. > > > > This was discussed in [1], and requested by the techboard [2]. > > > > patch-v1: > > * rease on top of v19.05 > > * remove uneeded renames in drivers/net/bonding/rte_eth_bond_pmd.c > > and app/test-pmd/icmpecho.c (arp-related variables) > > * do not modify base drivers, except cxgbe, thunderx, enetc, qede: > > only files that already contain dpdk definitions are modified. > > * fix checkpatch issues when it does not impact the code style too > > much. Big warnings remain about the RTE_IPv4() macros because > > arguments are separated by ',' instead of ', '. > > * add a release note patch > > * tested compilation on x86_64-linux and x86_64-freebsd. > > > > rfc-v2: > > * rebase on top of v19.05-rc1 > > > > > > [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html > > [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html > > > > > > Olivier Matz (15): > > net: add rte prefix to arp structures > > net: add rte prefix to arp defines > > net: add rte prefix to ether structures > > net: add rte prefix to ether functions > > net: add rte prefix to ether defines > > net: add rte prefix to esp structure > > net: add rte prefix to gre structure > > net: add rte prefix to icmp structure > > net: add rte prefix to icmp defines > > net: add rte prefix to ip structure > > net: add rte prefix to ip defines > > net: add rte prefix to sctp structure > > net: add rte prefix to tcp structure > > net: add rte prefix to udp structure > > doc: announce network api change > > Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> > > For series, > Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> > > Series applied to dpdk-next-net/master, thanks. > Sorry, late to the party... Since we change those defines, we might as well avoid these warnings: CHECK:CAMELCASE: Avoid CamelCase: <RTE_ETHER_TYPE_IPv4> CHECK:CAMELCASE: Avoid CamelCase: <RTE_ETHER_TYPE_IPv6> I can send a patch. -- David Marchand ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] prefix network structures 2019-05-29 7:59 ` David Marchand @ 2019-05-29 14:46 ` Olivier Matz 2019-05-29 17:29 ` David Marchand 0 siblings, 1 reply; 107+ messages in thread From: Olivier Matz @ 2019-05-29 14:46 UTC (permalink / raw) To: David Marchand Cc: Ferruh Yigit, dev, Stephen Hemminger, Maxime Coquelin, Thomas Monjalon On Wed, May 29, 2019 at 09:59:11AM +0200, David Marchand wrote: > On Fri, May 24, 2019 at 1:38 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote: > > > On 5/21/2019 5:13 PM, Olivier Matz wrote: > > > The rte_net headers conflict with the libc headers, because > > > some definitions are duplicated, sometimes with few differences. > > > > > > This patchset adds the rte_ (or RTE_) prefix to all structures, functions > > > and defines in rte_net library. This is a big changeset, that will > > > break the API of many functions, but not the ABI. > > > > > > This was discussed in [1], and requested by the techboard [2]. > > > > > > patch-v1: > > > * rease on top of v19.05 > > > * remove uneeded renames in drivers/net/bonding/rte_eth_bond_pmd.c > > > and app/test-pmd/icmpecho.c (arp-related variables) > > > * do not modify base drivers, except cxgbe, thunderx, enetc, qede: > > > only files that already contain dpdk definitions are modified. > > > * fix checkpatch issues when it does not impact the code style too > > > much. Big warnings remain about the RTE_IPv4() macros because > > > arguments are separated by ',' instead of ', '. > > > * add a release note patch > > > * tested compilation on x86_64-linux and x86_64-freebsd. > > > > > > rfc-v2: > > > * rebase on top of v19.05-rc1 > > > > > > > > > [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html > > > [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html > > > > > > > > > Olivier Matz (15): > > > net: add rte prefix to arp structures > > > net: add rte prefix to arp defines > > > net: add rte prefix to ether structures > > > net: add rte prefix to ether functions > > > net: add rte prefix to ether defines > > > net: add rte prefix to esp structure > > > net: add rte prefix to gre structure > > > net: add rte prefix to icmp structure > > > net: add rte prefix to icmp defines > > > net: add rte prefix to ip structure > > > net: add rte prefix to ip defines > > > net: add rte prefix to sctp structure > > > net: add rte prefix to tcp structure > > > net: add rte prefix to udp structure > > > doc: announce network api change > > > > Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> > > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> > > > > For series, > > Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> > > > > Series applied to dpdk-next-net/master, thanks. > > > > Sorry, late to the party... > > Since we change those defines, we might as well avoid these warnings: > CHECK:CAMELCASE: Avoid CamelCase: <RTE_ETHER_TYPE_IPv4> > CHECK:CAMELCASE: Avoid CamelCase: <RTE_ETHER_TYPE_IPv6> > > I can send a patch. Thanks. By the way, here is below a script that can be used to ease the porting of an application. It includes modifications proposed by David [1]. It is probably not 100% reliable, but it will do most of the job. Olivier [1] https://mails.dpdk.org/archives/dev/2019-May/133060.html ----------------------- #!/bin/bash # Prefix network structure/defines/functions with "rte_". set -e if [ $# = 0 ]; then echo 'usage: $0 <files>' exit 1 fi files="$@" # $1: pattern # $2: replacement replace() { local pattern="$1" local replace="$2" sed -i -e "s,${pattern},${replace},g" ${files} } # $*: function names replace_function() { for i in $*; do replace "\<$i\>(" "rte_$i(" done } # $*: define names replace_define() { for i in $*; do local pattern case "$i" in *'(') pattern="\<${i%(}\>(" ;; *) pattern="\<${i}\>" ;; esac replace "$pattern" "RTE_${i^^}" done } # $*: struct names replace_struct() { for i in $*; do replace "struct\([ ][ ]*\)\<$i\>" "struct\1rte_$i" done } replace arp_hrd arp_hardware replace arp_pro arp_protocol replace arp_hln arp_hlen replace arp_pln arp_plen replace arp_op arp_opcode replace_struct arp_hdr arp_ipv4 replace_define ARP_HRD_ETHER ARP_OP_REQUEST ARP_OP_REPLY ARP_OP_REVREQUEST \ ARP_OP_REVREPLY ARP_OP_INVREQUEST ARP_OP_INVREPLY replace_struct ether_addr ether_hdr vlan_hdr vxlan_hdr vxlan_gpe_hdr replace_function is_same_ether_addr is_zero_ether_addr is_unicast_ether_addr \ is_multicast_ether_addr is_broadcast_ether_addr \ is_universal_ether_addr is_local_admin_ether_addr \ is_valid_assigned_ether_addr eth_random_addr ether_addr_copy \ ether_format_addr replace_define ETHER_ADDR_LEN ETHER_TYPE_LEN ETHER_CRC_LEN ETHER_HDR_LEN \ ETHER_MIN_LEN ETHER_MAX_LEN ETHER_MTU ETHER_MAX_VLAN_FRAME_LEN \ ETHER_MAX_VLAN_ID ETHER_MAX_JUMBO_FRAME_LEN ETHER_MIN_MTU \ ETHER_LOCAL_ADMIN_ADDR ETHER_GROUP_ADDR ETHER_TYPE_IPv4 \ ETHER_TYPE_IPv6 ETHER_TYPE_ARP ETHER_TYPE_VLAN ETHER_TYPE_RARP \ ETHER_TYPE_QINQ ETHER_TYPE_ETAG ETHER_TYPE_1588 ETHER_TYPE_SLOW \ ETHER_TYPE_TEB ETHER_TYPE_LLDP ETHER_TYPE_MPLS ETHER_TYPE_MPLSM \ ETHER_VXLAN_HLEN ETHER_ADDR_FMT_SIZE VXLAN_GPE_TYPE_IPV4 \ VXLAN_GPE_TYPE_IPV6 VXLAN_GPE_TYPE_ETH VXLAN_GPE_TYPE_NSH \ VXLAN_GPE_TYPE_MPLS VXLAN_GPE_TYPE_GBP VXLAN_GPE_TYPE_VBNG \ ETHER_VXLAN_GPE_HLEN replace_struct esp_hdr replace_struct gre_hdr replace_struct icmp_hdr replace_define IP_ICMP_ECHO_REPLY IP_ICMP_ECHO_REQUEST replace_struct ipv4_hdr ipv6_hdr replace_define "IPv4(" IPV4_MAX_PKT_LEN IPV4_HDR_IHL_MASK IPV4_IHL_MULTIPLIER \ IPV4_HDR_DF_SHIFT IPV4_HDR_MF_SHIFT IPV4_HDR_FO_SHIFT \ IPV4_HDR_DF_FLAG IPV4_HDR_MF_FLAG IPV4_HDR_OFFSET_MASK \ IPV4_HDR_OFFSET_UNITS IPV4_ANY IPV4_LOOPBACK IPV4_BROADCAST \ IPV4_ALLHOSTS_GROUP IPV4_ALLRTRS_GROUP IPV4_MAX_LOCAL_GROUP \ IPV4_MIN_MCAST IPV4_MAX_MCAST IS_IPV4_MCAST IPV6_HDR_FL_SHIFT \ IPV6_HDR_TC_SHIFT IPV6_HDR_FL_MASK IPV6_HDR_TC_MASK replace_struct sctp_hdr replace_struct tcp_hdr replace_struct udp_hdr ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] prefix network structures 2019-05-29 14:46 ` Olivier Matz @ 2019-05-29 17:29 ` David Marchand 2019-05-29 21:15 ` Thomas Monjalon 0 siblings, 1 reply; 107+ messages in thread From: David Marchand @ 2019-05-29 17:29 UTC (permalink / raw) To: Olivier Matz Cc: Ferruh Yigit, dev, Stephen Hemminger, Maxime Coquelin, Thomas Monjalon, Ian Stokes, Ilya Maximets On Wed, May 29, 2019 at 6:50 PM Olivier Matz <olivier.matz@6wind.com> wrote: > On Wed, May 29, 2019 at 09:59:11AM +0200, David Marchand wrote: > > On Fri, May 24, 2019 at 1:38 PM Ferruh Yigit <ferruh.yigit@intel.com> > wrote: > > > > > On 5/21/2019 5:13 PM, Olivier Matz wrote: > > > > The rte_net headers conflict with the libc headers, because > > > > some definitions are duplicated, sometimes with few differences. > > > > > > > > This patchset adds the rte_ (or RTE_) prefix to all structures, > functions > > > > and defines in rte_net library. This is a big changeset, that will > > > > break the API of many functions, but not the ABI. > > > > > > > > This was discussed in [1], and requested by the techboard [2]. > > > > > > > > patch-v1: > > > > * rease on top of v19.05 > > > > * remove uneeded renames in drivers/net/bonding/rte_eth_bond_pmd.c > > > > and app/test-pmd/icmpecho.c (arp-related variables) > > > > * do not modify base drivers, except cxgbe, thunderx, enetc, qede: > > > > only files that already contain dpdk definitions are modified. > > > > * fix checkpatch issues when it does not impact the code style too > > > > much. Big warnings remain about the RTE_IPv4() macros because > > > > arguments are separated by ',' instead of ', '. > > > > * add a release note patch > > > > * tested compilation on x86_64-linux and x86_64-freebsd. > > > > > > > > rfc-v2: > > > > * rebase on top of v19.05-rc1 > > > > > > > > > > > > [1] http://mails.dpdk.org/archives/dev/2018-January/087384.html > > > > [2] http://mails.dpdk.org/archives/dev/2019-February/125033.html > > > > > > > > > > > > Olivier Matz (15): > > > > net: add rte prefix to arp structures > > > > net: add rte prefix to arp defines > > > > net: add rte prefix to ether structures > > > > net: add rte prefix to ether functions > > > > net: add rte prefix to ether defines > > > > net: add rte prefix to esp structure > > > > net: add rte prefix to gre structure > > > > net: add rte prefix to icmp structure > > > > net: add rte prefix to icmp defines > > > > net: add rte prefix to ip structure > > > > net: add rte prefix to ip defines > > > > net: add rte prefix to sctp structure > > > > net: add rte prefix to tcp structure > > > > net: add rte prefix to udp structure > > > > doc: announce network api change > > > > > > Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> > > > Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> > > > > > > For series, > > > Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> > > > > > > Series applied to dpdk-next-net/master, thanks. > > > > > > > Sorry, late to the party... > > > > Since we change those defines, we might as well avoid these warnings: > > CHECK:CAMELCASE: Avoid CamelCase: <RTE_ETHER_TYPE_IPv4> > > CHECK:CAMELCASE: Avoid CamelCase: <RTE_ETHER_TYPE_IPv6> > > > > I can send a patch. > > Thanks. > > By the way, here is below a script that can be used to ease the > porting of an application. It includes modifications proposed by > David [1]. > > It is probably not 100% reliable, but it will do most of the job. > > > Olivier > > [1] https://mails.dpdk.org/archives/dev/2019-May/133060.html > > ----------------------- > #!/bin/bash > > # Prefix network structure/defines/functions with "rte_". > > set -e > > if [ $# = 0 ]; then > echo 'usage: $0 <files>' > exit 1 > fi > > files="$@" > > # $1: pattern > # $2: replacement > replace() > { > local pattern="$1" > local replace="$2" > > sed -i -e "s,${pattern},${replace},g" ${files} > } > > # $*: function names > replace_function() > { > for i in $*; do > replace "\<$i\>(" "rte_$i(" > done > } > > # $*: define names > replace_define() > { > for i in $*; do > local pattern > case "$i" in > *'(') > pattern="\<${i%(}\>(" > ;; > *) > pattern="\<${i}\>" > ;; > esac > replace "$pattern" "RTE_${i^^}" > done > } > > # $*: struct names > replace_struct() > { > for i in $*; do > replace "struct\([ ][ ]*\)\<$i\>" > "struct\1rte_$i" > done > } > > replace arp_hrd arp_hardware > replace arp_pro arp_protocol > replace arp_hln arp_hlen > replace arp_pln arp_plen > replace arp_op arp_opcode > replace_struct arp_hdr arp_ipv4 > replace_define ARP_HRD_ETHER ARP_OP_REQUEST ARP_OP_REPLY ARP_OP_REVREQUEST > \ > ARP_OP_REVREPLY ARP_OP_INVREQUEST ARP_OP_INVREPLY > replace_struct ether_addr ether_hdr vlan_hdr vxlan_hdr vxlan_gpe_hdr > replace_function is_same_ether_addr is_zero_ether_addr > is_unicast_ether_addr \ > is_multicast_ether_addr is_broadcast_ether_addr \ > is_universal_ether_addr is_local_admin_ether_addr \ > is_valid_assigned_ether_addr eth_random_addr > ether_addr_copy \ > ether_format_addr > replace_define ETHER_ADDR_LEN ETHER_TYPE_LEN ETHER_CRC_LEN ETHER_HDR_LEN \ > ETHER_MIN_LEN ETHER_MAX_LEN ETHER_MTU > ETHER_MAX_VLAN_FRAME_LEN \ > ETHER_MAX_VLAN_ID ETHER_MAX_JUMBO_FRAME_LEN ETHER_MIN_MTU \ > ETHER_LOCAL_ADMIN_ADDR ETHER_GROUP_ADDR ETHER_TYPE_IPv4 \ > ETHER_TYPE_IPv6 ETHER_TYPE_ARP ETHER_TYPE_VLAN > ETHER_TYPE_RARP \ > ETHER_TYPE_QINQ ETHER_TYPE_ETAG ETHER_TYPE_1588 > ETHER_TYPE_SLOW \ > ETHER_TYPE_TEB ETHER_TYPE_LLDP ETHER_TYPE_MPLS > ETHER_TYPE_MPLSM \ > ETHER_VXLAN_HLEN ETHER_ADDR_FMT_SIZE VXLAN_GPE_TYPE_IPV4 \ > VXLAN_GPE_TYPE_IPV6 VXLAN_GPE_TYPE_ETH VXLAN_GPE_TYPE_NSH \ > VXLAN_GPE_TYPE_MPLS VXLAN_GPE_TYPE_GBP VXLAN_GPE_TYPE_VBNG \ > ETHER_VXLAN_GPE_HLEN > replace_struct esp_hdr > replace_struct gre_hdr > replace_struct icmp_hdr > replace_define IP_ICMP_ECHO_REPLY IP_ICMP_ECHO_REQUEST > replace_struct ipv4_hdr ipv6_hdr > replace_define "IPv4(" IPV4_MAX_PKT_LEN IPV4_HDR_IHL_MASK > IPV4_IHL_MULTIPLIER \ > IPV4_HDR_DF_SHIFT IPV4_HDR_MF_SHIFT IPV4_HDR_FO_SHIFT \ > IPV4_HDR_DF_FLAG IPV4_HDR_MF_FLAG IPV4_HDR_OFFSET_MASK \ > IPV4_HDR_OFFSET_UNITS IPV4_ANY IPV4_LOOPBACK IPV4_BROADCAST > \ > IPV4_ALLHOSTS_GROUP IPV4_ALLRTRS_GROUP IPV4_MAX_LOCAL_GROUP > \ > IPV4_MIN_MCAST IPV4_MAX_MCAST IS_IPV4_MCAST > IPV6_HDR_FL_SHIFT \ > IPV6_HDR_TC_SHIFT IPV6_HDR_FL_MASK IPV6_HDR_TC_MASK > replace_struct sctp_hdr > replace_struct tcp_hdr > replace_struct udp_hdr > Thanks Olivier. I tested this script against OVS dpdk-latest branch and did not catch any false positive, so I will submit the changes to OVS ml once my latest changes are in. -- David Marchand ^ permalink raw reply [flat|nested] 107+ messages in thread
* Re: [dpdk-dev] [PATCH 00/15] prefix network structures 2019-05-29 17:29 ` David Marchand @ 2019-05-29 21:15 ` Thomas Monjalon 0 siblings, 0 replies; 107+ messages in thread From: Thomas Monjalon @ 2019-05-29 21:15 UTC (permalink / raw) To: David Marchand, Olivier Matz Cc: Ferruh Yigit, dev, Stephen Hemminger, Maxime Coquelin, Ian Stokes, Ilya Maximets 29/05/2019 19:29, David Marchand: > On Wed, May 29, 2019 at 6:50 PM Olivier Matz <olivier.matz@6wind.com> wrote: > > By the way, here is below a script that can be used to ease the > > porting of an application. It includes modifications proposed by > > David [1]. > > > > It is probably not 100% reliable, but it will do most of the job. > > Thanks Olivier. > > I tested this script against OVS dpdk-latest branch and did not catch any > false positive, so I will submit the changes to OVS ml once my latest > changes are in. Should we get this script in DPDK? ^ permalink raw reply [flat|nested] 107+ messages in thread
end of thread, other threads:[~2019-05-29 21:16 UTC | newest] Thread overview: 107+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-10-24 8:18 [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 01/14] net: add rte prefix to arp structures Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 02/14] net: add rte prefix to arp defines Olivier Matz 2018-10-24 14:53 ` Wiles, Keith 2018-10-26 7:25 ` Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 03/14] net: add rte prefix to ether structures Olivier Matz 2018-12-20 22:04 ` Ferruh Yigit 2018-10-24 8:18 ` [dpdk-dev] [RFC 04/14] net: add rte prefix to ether functions Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 05/14] net: add rte prefix to ether defines Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 06/14] net: add rte prefix to esp structure Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 07/14] net: add rte prefix to gre structure Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 08/14] net: add rte prefix to icmp structure Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 09/14] net: add rte prefix to icmp defines Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 10/14] net: add rte prefix to ip structure Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 11/14] net: add rte prefix to ip defines Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 12/14] net: add rte prefix to sctp structure Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 13/14] net: add rte prefix to tcp structure Olivier Matz 2018-10-24 8:18 ` [dpdk-dev] [RFC 14/14] net: add rte prefix to udp structure Olivier Matz 2018-10-24 8:32 ` [dpdk-dev] [RFC 00/14] prefix network structures Olivier Matz 2018-10-24 14:56 ` Wiles, Keith 2018-10-26 7:22 ` Olivier Matz 2018-10-24 16:09 ` Stephen Hemminger 2018-10-24 16:39 ` Bruce Richardson 2018-10-26 7:20 ` Olivier Matz 2018-10-26 10:15 ` Bruce Richardson 2018-10-26 11:28 ` Olivier Matz 2018-10-24 18:38 ` Stephen Hemminger 2018-10-26 7:56 ` Olivier Matz 2018-12-20 21:59 ` Ferruh Yigit 2018-12-20 23:48 ` Stephen Hemminger 2018-12-21 14:38 ` Wiles, Keith 2018-12-21 15:14 ` Ferruh Yigit 2018-12-27 9:35 ` Olivier Matz 2019-02-13 11:48 ` Yigit, Ferruh 2019-02-18 12:37 ` Ferruh Yigit 2019-02-18 16:58 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 " Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 01/14] net: add rte prefix to arp structures Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-22 16:00 ` Stephen Hemminger 2019-04-22 16:00 ` Stephen Hemminger 2019-05-13 11:59 ` Olivier Matz 2019-05-13 11:59 ` Olivier Matz 2019-04-22 16:03 ` Stephen Hemminger 2019-04-22 16:03 ` Stephen Hemminger 2019-05-13 12:04 ` Olivier Matz 2019-05-13 12:04 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 02/14] net: add rte prefix to arp defines Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 03/14] net: add rte prefix to ether structures Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 04/14] net: add rte prefix to ether functions Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 05/14] net: add rte prefix to ether defines Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 06/14] net: add rte prefix to esp structure Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 07/14] net: add rte prefix to gre structure Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 08/14] net: add rte prefix to icmp structure Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 09/14] net: add rte prefix to icmp defines Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 10/14] net: add rte prefix to ip structure Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 11/14] net: add rte prefix to ip defines Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-22 16:05 ` Stephen Hemminger 2019-04-22 16:05 ` Stephen Hemminger 2019-05-13 12:02 ` Olivier Matz 2019-05-13 12:02 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 12/14] net: add rte prefix to sctp structure Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 13/14] net: add rte prefix to tcp structure Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-04-10 8:32 ` [dpdk-dev] [RFC v2 14/14] net: add rte prefix to udp structure Olivier Matz 2019-04-10 8:32 ` Olivier Matz 2019-05-20 17:11 ` [dpdk-dev] [RFC v2 00/14] prefix network structures Ferruh Yigit 2019-05-21 16:15 ` Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 00/15] " Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 01/15] net: add rte prefix to arp structures Olivier Matz 2019-05-24 11:37 ` Ferruh Yigit 2019-05-21 16:13 ` [dpdk-dev] [PATCH 02/15] net: add rte prefix to arp defines Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 03/15] net: add rte prefix to ether structures Olivier Matz 2019-05-29 8:39 ` David Marchand 2019-05-21 16:13 ` [dpdk-dev] [PATCH 04/15] net: add rte prefix to ether functions Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 05/15] net: add rte prefix to ether defines Olivier Matz 2019-05-24 11:37 ` Ferruh Yigit 2019-05-21 16:13 ` [dpdk-dev] [PATCH 06/15] net: add rte prefix to esp structure Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 07/15] net: add rte prefix to gre structure Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 08/15] net: add rte prefix to icmp structure Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 09/15] net: add rte prefix to icmp defines Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 10/15] net: add rte prefix to ip structure Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 11/15] net: add rte prefix to ip defines Olivier Matz 2019-05-29 8:41 ` David Marchand 2019-05-21 16:13 ` [dpdk-dev] [PATCH 12/15] net: add rte prefix to sctp structure Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 13/15] net: add rte prefix to tcp structure Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 14/15] net: add rte prefix to udp structure Olivier Matz 2019-05-21 16:13 ` [dpdk-dev] [PATCH 15/15] doc: announce network api change Olivier Matz 2019-05-21 16:23 ` [dpdk-dev] [PATCH 00/15] prefix network structures Stephen Hemminger 2019-05-23 11:41 ` Maxime Coquelin 2019-05-24 11:38 ` Ferruh Yigit 2019-05-29 7:59 ` David Marchand 2019-05-29 14:46 ` Olivier Matz 2019-05-29 17:29 ` David Marchand 2019-05-29 21:15 ` Thomas Monjalon
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).