2 // Copyright (c) 2019 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
20 #include <rte_ethdev.h>
21 #include <rte_version.h>
23 static const uint16_t rx_rings = 1, tx_rings = 1;
24 static const struct rte_eth_conf port_conf = { .link_speeds = ETH_LINK_SPEED_AUTONEG };
32 RTE_ETH_FOREACH_DEV(port_id) {
33 ret_val = rte_eth_dev_configure(port_id, rx_rings, tx_rings, &port_conf);
37 #if RTE_VERSION < RTE_VERSION_NUM(19,8,0,0)
38 struct ether_addr addr;
40 struct rte_ether_addr addr;
42 rte_eth_macaddr_get(port_id, &addr);
43 printf("Port %u MAC: %02" PRIx8 ":%02" PRIx8 ":%02" PRIx8
44 ":%02" PRIx8 ":%02" PRIx8 ":%02" PRIx8 "\n",
46 addr.addr_bytes[0], addr.addr_bytes[1],
47 addr.addr_bytes[2], addr.addr_bytes[3],
48 addr.addr_bytes[4], addr.addr_bytes[5]);
55 main(int argc, char *argv[])
57 /* Initialize the Environment Abstraction Layer (EAL). */
58 int ret = rte_eal_init(argc, argv);
60 rte_exit(EXIT_FAILURE, "Error with EAL initialization\n");