1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) 2 * 3 * Copyright 2010-2011 Freescale Semiconductor, Inc. 4 * All rights reserved. 5 * Copyright 2020 NXP 6 * 7 */ 8 9 #ifndef __PROCESS_H 10 #define __PROCESS_H 11 12 #include <compat.h> 13 #include <rte_compat.h> 14 #include <rte_ethdev.h> 15 16 /* The process device underlies process-wide user/kernel interactions, such as 17 * mapping dma_mem memory and providing accompanying ioctl()s. (This isn't used 18 * for portals, which use one UIO device each.). 19 */ 20 #define PROCESS_PATH "/dev/fsl-usdpaa" 21 22 /* Allocation of resource IDs uses a generic interface. This enum is used to 23 * distinguish between the type of underlying object being manipulated. 24 */ 25 enum dpaa_id_type { 26 dpaa_id_fqid, 27 dpaa_id_bpid, 28 dpaa_id_qpool, 29 dpaa_id_cgrid, 30 dpaa_id_max /* <-- not a valid type, represents the number of types */ 31 }; 32 33 int process_alloc(enum dpaa_id_type id_type, uint32_t *base, uint32_t num, 34 uint32_t align, int partial); 35 void process_release(enum dpaa_id_type id_type, uint32_t base, uint32_t num); 36 37 int process_reserve(enum dpaa_id_type id_type, uint32_t base, uint32_t num); 38 39 /* Mapping and using QMan/BMan portals */ 40 enum dpaa_portal_type { 41 dpaa_portal_qman, 42 dpaa_portal_bman, 43 }; 44 45 struct dpaa_portal_map { 46 void *cinh; 47 void *cena; 48 }; 49 50 struct dpaa_ioctl_portal_map { 51 /* Input parameter, is a qman or bman portal required. */ 52 enum dpaa_portal_type type; 53 /* Specifies a specific portal index to map or 0xffffffff 54 * for don't care. 55 */ 56 uint32_t index; 57 58 /* Return value if the map succeeds, this gives the mapped 59 * cache-inhibited (cinh) and cache-enabled (cena) addresses. 60 */ 61 struct dpaa_portal_map addr; 62 63 /* Qman-specific return values */ 64 u16 channel; 65 uint32_t pools; 66 }; 67 68 int process_portal_map(struct dpaa_ioctl_portal_map *params); 69 int process_portal_unmap(struct dpaa_portal_map *map); 70 71 struct dpaa_ioctl_irq_map { 72 enum dpaa_portal_type type; /* Type of portal to map */ 73 int fd; /* File descriptor that contains the portal */ 74 void *portal_cinh; /* Cache inhibited area to identify the portal */ 75 }; 76 77 int process_portal_irq_map(int fd, struct dpaa_ioctl_irq_map *irq); 78 int process_portal_irq_unmap(int fd); 79 80 struct usdpaa_ioctl_link_status { 81 char if_name[IF_NAME_MAX_LEN]; 82 uint32_t efd; 83 }; 84 85 __rte_internal 86 int dpaa_intr_enable(char *if_name, int efd); 87 88 __rte_internal 89 int dpaa_intr_disable(char *if_name); 90 91 struct usdpaa_ioctl_link_status_args_old { 92 /* network device node name */ 93 char if_name[IF_NAME_MAX_LEN]; 94 /* link status(RTE_ETH_LINK_UP/DOWN) */ 95 int link_status; 96 }; 97 98 struct usdpaa_ioctl_link_status_args { 99 /* network device node name */ 100 char if_name[IF_NAME_MAX_LEN]; 101 /* link status(RTE_ETH_LINK_UP/DOWN) */ 102 int link_status; 103 /* link speed (RTE_ETH_SPEED_NUM_)*/ 104 int link_speed; 105 /* link duplex (RTE_ETH_LINK_[HALF/FULL]_DUPLEX)*/ 106 int link_duplex; 107 /* link autoneg (RTE_ETH_LINK_AUTONEG/FIXED)*/ 108 int link_autoneg; 109 110 }; 111 112 struct usdpaa_ioctl_update_link_status_args { 113 /* network device node name */ 114 char if_name[IF_NAME_MAX_LEN]; 115 /* link status(RTE_ETH_LINK_UP/DOWN) */ 116 int link_status; 117 }; 118 119 struct usdpaa_ioctl_update_link_speed { 120 /* network device node name*/ 121 char if_name[IF_NAME_MAX_LEN]; 122 /* link speed (RTE_ETH_SPEED_NUM_)*/ 123 int link_speed; 124 /* link duplex (RTE_ETH_LINK_[HALF/FULL]_DUPLEX)*/ 125 int link_duplex; 126 }; 127 128 __rte_internal 129 int dpaa_get_link_status(char *if_name, struct rte_eth_link *link); 130 __rte_internal 131 int dpaa_update_link_status(char *if_name, int link_status); 132 __rte_internal 133 int dpaa_update_link_speed(char *if_name, int speed, int duplex); 134 __rte_internal 135 int dpaa_restart_link_autoneg(char *if_name); 136 __rte_internal 137 int dpaa_get_ioctl_version_number(void); 138 139 #endif /* __PROCESS_H */ 140