/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2010-2016 Freescale Semiconductor Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2019 NXP
*
*/
#include <inttypes.h>
-#include <of.h>
+#include <dpaa_of.h>
#include <net/if.h>
#include <sys/ioctl.h>
-#include <error.h>
+#include <err.h>
#include <net/if_arp.h>
#include <assert.h>
#include <unistd.h>
/* This data structure contaings all configurations information
* related to usages of DPA devices.
*/
-struct netcfg_info *netcfg;
+static struct netcfg_info *netcfg;
/* fd to open a socket for making ioctl request to disable/enable shared
* interfaces.
*/
printf("\n+ Fman %d, MAC %d (%s);\n",
__if->fman_idx, __if->mac_idx,
- (__if->mac_type == fman_mac_1g) ? "1G" : "10G");
+ (__if->mac_type == fman_mac_1g) ? "1G" :
+ (__if->mac_type == fman_mac_2_5g) ? "2.5G" : "10G");
- printf("\tmac_addr: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ printf("\tmac_addr: " RTE_ETHER_ADDR_PRT_FMT "\n",
(&__if->mac_addr)->addr_bytes[0],
(&__if->mac_addr)->addr_bytes[1],
(&__if->mac_addr)->addr_bytes[2],
*/
skfd = socket(AF_PACKET, SOCK_RAW, 0);
if (unlikely(skfd < 0)) {
- error(0, errno, "%s(): open(SOCK_RAW)", __func__);
+ err(0, "%s(): open(SOCK_RAW)", __func__);
return NULL;
}
size = sizeof(*netcfg) +
(num_ports * sizeof(struct fm_eth_port_cfg));
- netcfg = calloc(1, size);
+ netcfg = rte_calloc(NULL, 1, size, 0);
if (unlikely(netcfg == NULL)) {
DPAA_BUS_LOG(ERR, "Unable to allocat mem for netcfg");
goto error;
error:
if (netcfg) {
- free(netcfg);
+ rte_free(netcfg);
netcfg = NULL;
}
void
netcfg_release(struct netcfg_info *cfg_ptr)
{
- free(cfg_ptr);
+ rte_free(cfg_ptr);
/* Close socket for shared interfaces */
if (skfd >= 0) {
close(skfd);