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