1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2017 Intel Corporation 3 */ 4 5 #ifndef _RTE_ETHDEV_DRIVER_H_ 6 #define _RTE_ETHDEV_DRIVER_H_ 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /** 13 * @file 14 * 15 * RTE Ethernet Device PMD API 16 * 17 * These APIs for the use from Ethernet drivers, user applications shouldn't 18 * use them. 19 * 20 */ 21 22 #include <dev_driver.h> 23 #include <rte_ethdev.h> 24 25 /** 26 * @internal 27 * Structure used to hold information about the callbacks to be called for a 28 * queue on Rx and Tx. 29 */ 30 struct rte_eth_rxtx_callback { 31 struct rte_eth_rxtx_callback *next; 32 union{ 33 rte_rx_callback_fn rx; 34 rte_tx_callback_fn tx; 35 } fn; 36 void *param; 37 }; 38 39 /** 40 * @internal 41 * The generic data structure associated with each Ethernet device. 42 * 43 * Pointers to burst-oriented packet receive and transmit functions are 44 * located at the beginning of the structure, along with the pointer to 45 * where all the data elements for the particular device are stored in shared 46 * memory. This split allows the function pointer and driver data to be per- 47 * process, while the actual configuration data for the device is shared. 48 */ 49 struct rte_eth_dev { 50 eth_rx_burst_t rx_pkt_burst; /**< Pointer to PMD receive function */ 51 eth_tx_burst_t tx_pkt_burst; /**< Pointer to PMD transmit function */ 52 53 /** Pointer to PMD transmit prepare function */ 54 eth_tx_prep_t tx_pkt_prepare; 55 /** Get the number of used Rx descriptors */ 56 eth_rx_queue_count_t rx_queue_count; 57 /** Check the status of a Rx descriptor */ 58 eth_rx_descriptor_status_t rx_descriptor_status; 59 /** Check the status of a Tx descriptor */ 60 eth_tx_descriptor_status_t tx_descriptor_status; 61 62 /** 63 * Device data that is shared between primary and secondary processes 64 */ 65 struct rte_eth_dev_data *data; 66 void *process_private; /**< Pointer to per-process device data */ 67 const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */ 68 struct rte_device *device; /**< Backing device */ 69 struct rte_intr_handle *intr_handle; /**< Device interrupt handle */ 70 71 /** User application callbacks for NIC interrupts */ 72 struct rte_eth_dev_cb_list link_intr_cbs; 73 /** 74 * User-supplied functions called from rx_burst to post-process 75 * received packets before passing them to the user 76 */ 77 struct rte_eth_rxtx_callback *post_rx_burst_cbs[RTE_MAX_QUEUES_PER_PORT]; 78 /** 79 * User-supplied functions called from tx_burst to pre-process 80 * received packets before passing them to the driver for transmission 81 */ 82 struct rte_eth_rxtx_callback *pre_tx_burst_cbs[RTE_MAX_QUEUES_PER_PORT]; 83 84 enum rte_eth_dev_state state; /**< Flag indicating the port state */ 85 void *security_ctx; /**< Context for security ops */ 86 } __rte_cache_aligned; 87 88 struct rte_eth_dev_sriov; 89 struct rte_eth_dev_owner; 90 91 /** 92 * @internal 93 * The data part, with no function pointers, associated with each Ethernet 94 * device. This structure is safe to place in shared memory to be common 95 * among different processes in a multi-process configuration. 96 */ 97 struct rte_eth_dev_data { 98 char name[RTE_ETH_NAME_MAX_LEN]; /**< Unique identifier name */ 99 100 void **rx_queues; /**< Array of pointers to Rx queues */ 101 void **tx_queues; /**< Array of pointers to Tx queues */ 102 uint16_t nb_rx_queues; /**< Number of Rx queues */ 103 uint16_t nb_tx_queues; /**< Number of Tx queues */ 104 105 struct rte_eth_dev_sriov sriov; /**< SRIOV data */ 106 107 /** PMD-specific private data. @see rte_eth_dev_release_port() */ 108 void *dev_private; 109 110 struct rte_eth_link dev_link; /**< Link-level information & status */ 111 struct rte_eth_conf dev_conf; /**< Configuration applied to device */ 112 uint16_t mtu; /**< Maximum Transmission Unit */ 113 114 /** Common Rx buffer size handled by all queues */ 115 uint32_t min_rx_buf_size; 116 117 uint64_t rx_mbuf_alloc_failed; /**< Rx ring mbuf allocation failures */ 118 119 /** Device Ethernet link address. @see rte_eth_dev_release_port() */ 120 struct rte_ether_addr *mac_addrs; 121 /** Bitmap associating MAC addresses to pools */ 122 uint64_t mac_pool_sel[RTE_ETH_NUM_RECEIVE_MAC_ADDR]; 123 /** 124 * Device Ethernet MAC addresses of hash filtering. 125 * @see rte_eth_dev_release_port() 126 */ 127 struct rte_ether_addr *hash_mac_addrs; 128 129 uint16_t port_id; /**< Device [external] port identifier */ 130 131 __extension__ 132 uint8_t /** Rx promiscuous mode ON(1) / OFF(0) */ 133 promiscuous : 1, 134 /** Rx of scattered packets is ON(1) / OFF(0) */ 135 scattered_rx : 1, 136 /** Rx all multicast mode ON(1) / OFF(0) */ 137 all_multicast : 1, 138 /** Device state: STARTED(1) / STOPPED(0) */ 139 dev_started : 1, 140 /** Rx LRO is ON(1) / OFF(0) */ 141 lro : 1, 142 /** 143 * Indicates whether the device is configured: 144 * CONFIGURED(1) / NOT CONFIGURED(0) 145 */ 146 dev_configured : 1, 147 /** 148 * Indicates whether the flow engine is configured: 149 * CONFIGURED(1) / NOT CONFIGURED(0) 150 */ 151 flow_configured : 1; 152 153 /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */ 154 uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT]; 155 /** Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0) */ 156 uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT]; 157 158 uint32_t dev_flags; /**< Capabilities */ 159 int numa_node; /**< NUMA node connection */ 160 161 /** VLAN filter configuration */ 162 struct rte_vlan_filter_conf vlan_filter_conf; 163 164 struct rte_eth_dev_owner owner; /**< The port owner */ 165 166 /** 167 * Switch-specific identifier. 168 * Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. 169 */ 170 uint16_t representor_id; 171 /** 172 * Port ID of the backing device. 173 * This device will be used to query representor info and calculate 174 * representor IDs. Valid if RTE_ETH_DEV_REPRESENTOR in dev_flags. 175 */ 176 uint16_t backer_port_id; 177 178 pthread_mutex_t flow_ops_mutex; /**< rte_flow ops mutex */ 179 } __rte_cache_aligned; 180 181 /** 182 * @internal 183 * The pool of *rte_eth_dev* structures. The size of the pool 184 * is configured at compile-time in the <rte_ethdev.c> file. 185 */ 186 extern struct rte_eth_dev rte_eth_devices[]; 187 188 /** @internal Declaration of the hairpin peer queue information structure. */ 189 struct rte_hairpin_peer_info; 190 191 /* 192 * Definitions of all functions exported by an Ethernet driver through the 193 * generic structure of type *eth_dev_ops* supplied in the *rte_eth_dev* 194 * structure associated with an Ethernet device. 195 */ 196 197 /** @internal Ethernet device configuration. */ 198 typedef int (*eth_dev_configure_t)(struct rte_eth_dev *dev); 199 200 /** @internal Function used to start a configured Ethernet device. */ 201 typedef int (*eth_dev_start_t)(struct rte_eth_dev *dev); 202 203 /** @internal Function used to stop a configured Ethernet device. */ 204 typedef int (*eth_dev_stop_t)(struct rte_eth_dev *dev); 205 206 /** @internal Function used to link up a configured Ethernet device. */ 207 typedef int (*eth_dev_set_link_up_t)(struct rte_eth_dev *dev); 208 209 /** @internal Function used to link down a configured Ethernet device. */ 210 typedef int (*eth_dev_set_link_down_t)(struct rte_eth_dev *dev); 211 212 /** @internal Function used to close a configured Ethernet device. */ 213 typedef int (*eth_dev_close_t)(struct rte_eth_dev *dev); 214 215 /** @internal Function used to reset a configured Ethernet device. */ 216 typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev); 217 218 /** @internal Function used to detect an Ethernet device removal. */ 219 typedef int (*eth_is_removed_t)(struct rte_eth_dev *dev); 220 221 /** 222 * @internal 223 * Function used to enable the Rx promiscuous mode of an Ethernet device. 224 * 225 * @param dev 226 * ethdev handle of port. 227 * 228 * @return 229 * Negative errno value on error, 0 on success. 230 * 231 * @retval 0 232 * Success, promiscuous mode is enabled. 233 * @retval -ENOTSUP 234 * Promiscuous mode is not supported. 235 * @retval -ENODEV 236 * Device is gone. 237 * @retval -E_RTE_SECONDARY 238 * Function was called from a secondary process instance and not supported. 239 * @retval -ETIMEDOUT 240 * Attempt to enable promiscuous mode failed because of timeout. 241 * @retval -EAGAIN 242 * Failed to enable promiscuous mode. 243 */ 244 typedef int (*eth_promiscuous_enable_t)(struct rte_eth_dev *dev); 245 246 /** 247 * @internal 248 * Function used to disable the Rx promiscuous mode of an Ethernet device. 249 * 250 * @param dev 251 * ethdev handle of port. 252 * 253 * @return 254 * Negative errno value on error, 0 on success. 255 * 256 * @retval 0 257 * Success, promiscuous mode is disabled. 258 * @retval -ENOTSUP 259 * Promiscuous mode disabling is not supported. 260 * @retval -ENODEV 261 * Device is gone. 262 * @retval -E_RTE_SECONDARY 263 * Function was called from a secondary process instance and not supported. 264 * @retval -ETIMEDOUT 265 * Attempt to disable promiscuous mode failed because of timeout. 266 * @retval -EAGAIN 267 * Failed to disable promiscuous mode. 268 */ 269 typedef int (*eth_promiscuous_disable_t)(struct rte_eth_dev *dev); 270 271 /** 272 * @internal 273 * Enable the receipt of all multicast packets by an Ethernet device. 274 * 275 * @param dev 276 * ethdev handle of port. 277 * 278 * @return 279 * Negative errno value on error, 0 on success. 280 * 281 * @retval 0 282 * Success, all-multicast mode is enabled. 283 * @retval -ENOTSUP 284 * All-multicast mode is not supported. 285 * @retval -ENODEV 286 * Device is gone. 287 * @retval -E_RTE_SECONDARY 288 * Function was called from a secondary process instance and not supported. 289 * @retval -ETIMEDOUT 290 * Attempt to enable all-multicast mode failed because of timeout. 291 * @retval -EAGAIN 292 * Failed to enable all-multicast mode. 293 */ 294 typedef int (*eth_allmulticast_enable_t)(struct rte_eth_dev *dev); 295 296 /** 297 * @internal 298 * Disable the receipt of all multicast packets by an Ethernet device. 299 * 300 * @param dev 301 * ethdev handle of port. 302 * 303 * @return 304 * Negative errno value on error, 0 on success. 305 * 306 * @retval 0 307 * Success, all-multicast mode is disabled. 308 * @retval -ENOTSUP 309 * All-multicast mode disabling is not supported. 310 * @retval -ENODEV 311 * Device is gone. 312 * @retval -E_RTE_SECONDARY 313 * Function was called from a secondary process instance and not supported. 314 * @retval -ETIMEDOUT 315 * Attempt to disable all-multicast mode failed because of timeout. 316 * @retval -EAGAIN 317 * Failed to disable all-multicast mode. 318 */ 319 typedef int (*eth_allmulticast_disable_t)(struct rte_eth_dev *dev); 320 321 /** 322 * @internal 323 * Get link speed, duplex mode and state (up/down) of an Ethernet device. 324 */ 325 typedef int (*eth_link_update_t)(struct rte_eth_dev *dev, 326 int wait_to_complete); 327 328 /** @internal Get global I/O statistics of an Ethernet device. */ 329 typedef int (*eth_stats_get_t)(struct rte_eth_dev *dev, 330 struct rte_eth_stats *igb_stats); 331 332 /** 333 * @internal 334 * Reset global I/O statistics of an Ethernet device to 0. 335 * 336 * @param dev 337 * ethdev handle of port. 338 * 339 * @return 340 * Negative errno value on error, 0 on success. 341 * 342 * @retval 0 343 * Success, statistics has been reset. 344 * @retval -ENOTSUP 345 * Resetting statistics is not supported. 346 * @retval -EINVAL 347 * Resetting statistics is not valid. 348 * @retval -ENOMEM 349 * Not enough memory to get the stats. 350 */ 351 typedef int (*eth_stats_reset_t)(struct rte_eth_dev *dev); 352 353 /** @internal Get extended stats of an Ethernet device. */ 354 typedef int (*eth_xstats_get_t)(struct rte_eth_dev *dev, 355 struct rte_eth_xstat *stats, unsigned int n); 356 357 /** 358 * @internal 359 * Get extended stats of an Ethernet device. 360 * 361 * @param dev 362 * ethdev handle of port. 363 * @param ids 364 * IDs array to retrieve specific statistics. Must not be NULL. 365 * @param values 366 * A pointer to a table to be filled with device statistics values. 367 * Must not be NULL. 368 * @param n 369 * Element count in @p ids and @p values. 370 * 371 * @return 372 * - A number of filled in stats. 373 * - A negative value on error. 374 */ 375 typedef int (*eth_xstats_get_by_id_t)(struct rte_eth_dev *dev, 376 const uint64_t *ids, 377 uint64_t *values, 378 unsigned int n); 379 380 /** 381 * @internal 382 * Reset extended stats of an Ethernet device. 383 * 384 * @param dev 385 * ethdev handle of port. 386 * 387 * @return 388 * Negative errno value on error, 0 on success. 389 * 390 * @retval 0 391 * Success, statistics has been reset. 392 * @retval -ENOTSUP 393 * Resetting statistics is not supported. 394 * @retval -EINVAL 395 * Resetting statistics is not valid. 396 * @retval -ENOMEM 397 * Not enough memory to get the stats. 398 */ 399 typedef int (*eth_xstats_reset_t)(struct rte_eth_dev *dev); 400 401 /** @internal Get names of extended stats of an Ethernet device. */ 402 typedef int (*eth_xstats_get_names_t)(struct rte_eth_dev *dev, 403 struct rte_eth_xstat_name *xstats_names, unsigned int size); 404 405 /** 406 * @internal 407 * Get names of extended stats of an Ethernet device. 408 * 409 * @param dev 410 * ethdev handle of port. 411 * @param ids 412 * IDs array to retrieve specific statistics. Must not be NULL. 413 * @param xstats_names 414 * An rte_eth_xstat_name array of at least @p size elements to be filled. 415 * Must not be NULL. 416 * @param size 417 * Element count in @p ids and @p xstats_names. 418 * 419 * @return 420 * - A number of filled in stats. 421 * - A negative value on error. 422 */ 423 typedef int (*eth_xstats_get_names_by_id_t)(struct rte_eth_dev *dev, 424 const uint64_t *ids, struct rte_eth_xstat_name *xstats_names, 425 unsigned int size); 426 427 /** 428 * @internal 429 * Set a queue statistics mapping for a Tx/Rx queue of an Ethernet device. 430 */ 431 typedef int (*eth_queue_stats_mapping_set_t)(struct rte_eth_dev *dev, 432 uint16_t queue_id, 433 uint8_t stat_idx, 434 uint8_t is_rx); 435 436 /** @internal Get specific information of an Ethernet device. */ 437 typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev, 438 struct rte_eth_dev_info *dev_info); 439 440 /** @internal Get supported ptypes of an Ethernet device. */ 441 typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev); 442 443 /** 444 * @internal 445 * Inform Ethernet device about reduced range of packet types to handle. 446 * 447 * @param dev 448 * The Ethernet device identifier. 449 * @param ptype_mask 450 * The ptype family that application is interested in should be bitwise OR of 451 * RTE_PTYPE_*_MASK or 0. 452 * @return 453 * - (0) if Success. 454 */ 455 typedef int (*eth_dev_ptypes_set_t)(struct rte_eth_dev *dev, 456 uint32_t ptype_mask); 457 458 /** @internal Start Rx and Tx of a queue of an Ethernet device. */ 459 typedef int (*eth_queue_start_t)(struct rte_eth_dev *dev, 460 uint16_t queue_id); 461 462 /** @internal Stop Rx and Tx of a queue of an Ethernet device. */ 463 typedef int (*eth_queue_stop_t)(struct rte_eth_dev *dev, 464 uint16_t queue_id); 465 466 /** @internal Set up a receive queue of an Ethernet device. */ 467 typedef int (*eth_rx_queue_setup_t)(struct rte_eth_dev *dev, 468 uint16_t rx_queue_id, 469 uint16_t nb_rx_desc, 470 unsigned int socket_id, 471 const struct rte_eth_rxconf *rx_conf, 472 struct rte_mempool *mb_pool); 473 474 /** @internal Setup a transmit queue of an Ethernet device. */ 475 typedef int (*eth_tx_queue_setup_t)(struct rte_eth_dev *dev, 476 uint16_t tx_queue_id, 477 uint16_t nb_tx_desc, 478 unsigned int socket_id, 479 const struct rte_eth_txconf *tx_conf); 480 481 /** @internal Enable interrupt of a receive queue of an Ethernet device. */ 482 typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev, 483 uint16_t rx_queue_id); 484 485 /** @internal Disable interrupt of a receive queue of an Ethernet device. */ 486 typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev, 487 uint16_t rx_queue_id); 488 489 /** @internal Release memory resources allocated by given Rx/Tx queue. */ 490 typedef void (*eth_queue_release_t)(struct rte_eth_dev *dev, 491 uint16_t queue_id); 492 493 /** @internal Get firmware information of an Ethernet device. */ 494 typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, 495 char *fw_version, size_t fw_size); 496 497 /** @internal Force mbufs to be from Tx ring. */ 498 typedef int (*eth_tx_done_cleanup_t)(void *txq, uint32_t free_cnt); 499 500 typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev, 501 uint16_t rx_queue_id, struct rte_eth_rxq_info *qinfo); 502 503 typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev, 504 uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo); 505 506 typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev, 507 uint16_t queue_id, struct rte_eth_burst_mode *mode); 508 509 /** @internal Set MTU. */ 510 typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu); 511 512 /** @internal Filtering of a VLAN Tag Identifier by an Ethernet device. */ 513 typedef int (*vlan_filter_set_t)(struct rte_eth_dev *dev, 514 uint16_t vlan_id, 515 int on); 516 517 /** @internal Set the outer/inner VLAN-TPID by an Ethernet device. */ 518 typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev, 519 enum rte_vlan_type type, uint16_t tpid); 520 521 /** @internal Set VLAN offload function by an Ethernet device. */ 522 typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask); 523 524 /** @internal Set port based Tx VLAN insertion by an Ethernet device. */ 525 typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev, 526 uint16_t vlan_id, 527 int on); 528 529 /** @internal VLAN stripping enable/disable by an queue of Ethernet device. */ 530 typedef void (*vlan_strip_queue_set_t)(struct rte_eth_dev *dev, 531 uint16_t rx_queue_id, 532 int on); 533 534 /** @internal Get current flow control parameter on an Ethernet device. */ 535 typedef int (*flow_ctrl_get_t)(struct rte_eth_dev *dev, 536 struct rte_eth_fc_conf *fc_conf); 537 538 /** @internal Setup flow control parameter on an Ethernet device. */ 539 typedef int (*flow_ctrl_set_t)(struct rte_eth_dev *dev, 540 struct rte_eth_fc_conf *fc_conf); 541 542 /** @internal Setup priority flow control parameter on an Ethernet device. */ 543 typedef int (*priority_flow_ctrl_set_t)(struct rte_eth_dev *dev, 544 struct rte_eth_pfc_conf *pfc_conf); 545 546 /** @internal Get info for queue based PFC on an Ethernet device. */ 547 typedef int (*priority_flow_ctrl_queue_info_get_t)(struct rte_eth_dev *dev, 548 struct rte_eth_pfc_queue_info *pfc_queue_info); 549 /** @internal Configure queue based PFC parameter on an Ethernet device. */ 550 typedef int (*priority_flow_ctrl_queue_config_t)(struct rte_eth_dev *dev, 551 struct rte_eth_pfc_queue_conf *pfc_queue_conf); 552 553 /** @internal Update RSS redirection table on an Ethernet device. */ 554 typedef int (*reta_update_t)(struct rte_eth_dev *dev, 555 struct rte_eth_rss_reta_entry64 *reta_conf, 556 uint16_t reta_size); 557 558 /** @internal Query RSS redirection table on an Ethernet device. */ 559 typedef int (*reta_query_t)(struct rte_eth_dev *dev, 560 struct rte_eth_rss_reta_entry64 *reta_conf, 561 uint16_t reta_size); 562 563 /** @internal Update RSS hash configuration of an Ethernet device. */ 564 typedef int (*rss_hash_update_t)(struct rte_eth_dev *dev, 565 struct rte_eth_rss_conf *rss_conf); 566 567 /** @internal Get current RSS hash configuration of an Ethernet device. */ 568 typedef int (*rss_hash_conf_get_t)(struct rte_eth_dev *dev, 569 struct rte_eth_rss_conf *rss_conf); 570 571 /** @internal Turn on SW controllable LED on an Ethernet device. */ 572 typedef int (*eth_dev_led_on_t)(struct rte_eth_dev *dev); 573 574 /** @internal Turn off SW controllable LED on an Ethernet device. */ 575 typedef int (*eth_dev_led_off_t)(struct rte_eth_dev *dev); 576 577 /** @internal Remove MAC address from receive address register. */ 578 typedef void (*eth_mac_addr_remove_t)(struct rte_eth_dev *dev, uint32_t index); 579 580 /** @internal Set a MAC address into Receive Address Register. */ 581 typedef int (*eth_mac_addr_add_t)(struct rte_eth_dev *dev, 582 struct rte_ether_addr *mac_addr, 583 uint32_t index, 584 uint32_t vmdq); 585 586 /** @internal Set a MAC address into Receive Address Register. */ 587 typedef int (*eth_mac_addr_set_t)(struct rte_eth_dev *dev, 588 struct rte_ether_addr *mac_addr); 589 590 /** @internal Set a Unicast Hash bitmap. */ 591 typedef int (*eth_uc_hash_table_set_t)(struct rte_eth_dev *dev, 592 struct rte_ether_addr *mac_addr, 593 uint8_t on); 594 595 /** @internal Set all Unicast Hash bitmap. */ 596 typedef int (*eth_uc_all_hash_table_set_t)(struct rte_eth_dev *dev, 597 uint8_t on); 598 599 /** @internal Set queue Tx rate. */ 600 typedef int (*eth_set_queue_rate_limit_t)(struct rte_eth_dev *dev, 601 uint16_t queue_idx, 602 uint16_t tx_rate); 603 604 /** @internal Add tunneling UDP port. */ 605 typedef int (*eth_udp_tunnel_port_add_t)(struct rte_eth_dev *dev, 606 struct rte_eth_udp_tunnel *tunnel_udp); 607 608 /** @internal Delete tunneling UDP port. */ 609 typedef int (*eth_udp_tunnel_port_del_t)(struct rte_eth_dev *dev, 610 struct rte_eth_udp_tunnel *tunnel_udp); 611 612 /** @internal set the list of multicast addresses on an Ethernet device. */ 613 typedef int (*eth_set_mc_addr_list_t)(struct rte_eth_dev *dev, 614 struct rte_ether_addr *mc_addr_set, 615 uint32_t nb_mc_addr); 616 617 /** @internal Function used to enable IEEE1588/802.1AS timestamping. */ 618 typedef int (*eth_timesync_enable_t)(struct rte_eth_dev *dev); 619 620 /** @internal Function used to disable IEEE1588/802.1AS timestamping. */ 621 typedef int (*eth_timesync_disable_t)(struct rte_eth_dev *dev); 622 623 /** @internal Function used to read an Rx IEEE1588/802.1AS timestamp. */ 624 typedef int (*eth_timesync_read_rx_timestamp_t)(struct rte_eth_dev *dev, 625 struct timespec *timestamp, 626 uint32_t flags); 627 628 /** @internal Function used to read a Tx IEEE1588/802.1AS timestamp. */ 629 typedef int (*eth_timesync_read_tx_timestamp_t)(struct rte_eth_dev *dev, 630 struct timespec *timestamp); 631 632 /** @internal Function used to adjust the device clock. */ 633 typedef int (*eth_timesync_adjust_time)(struct rte_eth_dev *dev, int64_t); 634 635 /** @internal Function used to get time from the device clock. */ 636 typedef int (*eth_timesync_read_time)(struct rte_eth_dev *dev, 637 struct timespec *timestamp); 638 639 /** @internal Function used to get time from the device clock. */ 640 typedef int (*eth_timesync_write_time)(struct rte_eth_dev *dev, 641 const struct timespec *timestamp); 642 643 /** @internal Function used to get the current value of the device clock. */ 644 typedef int (*eth_read_clock)(struct rte_eth_dev *dev, 645 uint64_t *timestamp); 646 647 /** @internal Retrieve registers. */ 648 typedef int (*eth_get_reg_t)(struct rte_eth_dev *dev, 649 struct rte_dev_reg_info *info); 650 651 /** @internal Retrieve EEPROM size. */ 652 typedef int (*eth_get_eeprom_length_t)(struct rte_eth_dev *dev); 653 654 /** @internal Retrieve EEPROM data. */ 655 typedef int (*eth_get_eeprom_t)(struct rte_eth_dev *dev, 656 struct rte_dev_eeprom_info *info); 657 658 /** @internal Program EEPROM data. */ 659 typedef int (*eth_set_eeprom_t)(struct rte_eth_dev *dev, 660 struct rte_dev_eeprom_info *info); 661 662 /** @internal Retrieve type and size of plugin module EEPROM. */ 663 typedef int (*eth_get_module_info_t)(struct rte_eth_dev *dev, 664 struct rte_eth_dev_module_info *modinfo); 665 666 /** @internal Retrieve plugin module EEPROM data. */ 667 typedef int (*eth_get_module_eeprom_t)(struct rte_eth_dev *dev, 668 struct rte_dev_eeprom_info *info); 669 670 struct rte_flow_ops; 671 /** 672 * @internal 673 * Get flow operations. 674 * 675 * If the flow API is not supported for the specified device, 676 * the driver can return NULL. 677 */ 678 typedef int (*eth_flow_ops_get_t)(struct rte_eth_dev *dev, 679 const struct rte_flow_ops **ops); 680 681 /** @internal Get Traffic Management (TM) operations on an Ethernet device. */ 682 typedef int (*eth_tm_ops_get_t)(struct rte_eth_dev *dev, void *ops); 683 684 /** @internal Get Traffic Metering and Policing (MTR) operations. */ 685 typedef int (*eth_mtr_ops_get_t)(struct rte_eth_dev *dev, void *ops); 686 687 /** @internal Get DCB information on an Ethernet device. */ 688 typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev, 689 struct rte_eth_dcb_info *dcb_info); 690 691 /** @internal Test if a port supports specific mempool ops. */ 692 typedef int (*eth_pool_ops_supported_t)(struct rte_eth_dev *dev, 693 const char *pool); 694 695 /** 696 * @internal 697 * Get the hairpin capabilities. 698 * 699 * @param dev 700 * ethdev handle of port. 701 * @param cap 702 * returns the hairpin capabilities from the device. 703 * 704 * @return 705 * Negative errno value on error, 0 on success. 706 * 707 * @retval 0 708 * Success, hairpin is supported. 709 * @retval -ENOTSUP 710 * Hairpin is not supported. 711 */ 712 typedef int (*eth_hairpin_cap_get_t)(struct rte_eth_dev *dev, 713 struct rte_eth_hairpin_cap *cap); 714 715 /** 716 * @internal 717 * Setup Rx hairpin queue. 718 * 719 * @param dev 720 * ethdev handle of port. 721 * @param rx_queue_id 722 * the selected Rx queue index. 723 * @param nb_rx_desc 724 * the requested number of descriptors for this queue. 0 - use PMD default. 725 * @param conf 726 * the Rx hairpin configuration structure. 727 * 728 * @return 729 * Negative errno value on error, 0 on success. 730 * 731 * @retval 0 732 * Success, hairpin is supported. 733 * @retval -ENOTSUP 734 * Hairpin is not supported. 735 * @retval -EINVAL 736 * One of the parameters is invalid. 737 * @retval -ENOMEM 738 * Unable to allocate resources. 739 */ 740 typedef int (*eth_rx_hairpin_queue_setup_t) 741 (struct rte_eth_dev *dev, uint16_t rx_queue_id, 742 uint16_t nb_rx_desc, 743 const struct rte_eth_hairpin_conf *conf); 744 745 /** 746 * @internal 747 * Setup Tx hairpin queue. 748 * 749 * @param dev 750 * ethdev handle of port. 751 * @param tx_queue_id 752 * the selected Tx queue index. 753 * @param nb_tx_desc 754 * the requested number of descriptors for this queue. 0 - use PMD default. 755 * @param conf 756 * the Tx hairpin configuration structure. 757 * 758 * @return 759 * Negative errno value on error, 0 on success. 760 * 761 * @retval 0 762 * Success, hairpin is supported. 763 * @retval -ENOTSUP 764 * Hairpin is not supported. 765 * @retval -EINVAL 766 * One of the parameters is invalid. 767 * @retval -ENOMEM 768 * Unable to allocate resources. 769 */ 770 typedef int (*eth_tx_hairpin_queue_setup_t) 771 (struct rte_eth_dev *dev, uint16_t tx_queue_id, 772 uint16_t nb_tx_desc, 773 const struct rte_eth_hairpin_conf *hairpin_conf); 774 775 /** 776 * @internal 777 * Get Forward Error Correction(FEC) capability. 778 * 779 * @param dev 780 * ethdev handle of port. 781 * @param speed_fec_capa 782 * speed_fec_capa is out only with per-speed capabilities. 783 * @param num 784 * a number of elements in an speed_fec_capa array. 785 * 786 * @return 787 * Negative errno value on error, positive value on success. 788 * 789 * @retval positive value 790 * A non-negative value lower or equal to num: success. The return value 791 * is the number of entries filled in the fec capa array. 792 * A non-negative value higher than num: error, the given fec capa array 793 * is too small. The return value corresponds to the num that should 794 * be given to succeed. The entries in the fec capa array are not valid 795 * and shall not be used by the caller. 796 * @retval -ENOTSUP 797 * Operation is not supported. 798 * @retval -EIO 799 * Device is removed. 800 * @retval -EINVAL 801 * *num* or *speed_fec_capa* invalid. 802 */ 803 typedef int (*eth_fec_get_capability_t)(struct rte_eth_dev *dev, 804 struct rte_eth_fec_capa *speed_fec_capa, unsigned int num); 805 806 /** 807 * @internal 808 * Get Forward Error Correction(FEC) mode. 809 * 810 * @param dev 811 * ethdev handle of port. 812 * @param fec_capa 813 * a bitmask of enabled FEC modes. If AUTO bit is set, other 814 * bits specify FEC modes which may be negotiated. If AUTO 815 * bit is clear, specify FEC modes to be used (only one valid 816 * mode per speed may be set). 817 * 818 * @return 819 * Negative errno value on error, 0 on success. 820 * 821 * @retval 0 822 * Success, get FEC success. 823 * @retval -ENOTSUP 824 * Operation is not supported. 825 * @retval -EIO 826 * Device is removed. 827 */ 828 typedef int (*eth_fec_get_t)(struct rte_eth_dev *dev, 829 uint32_t *fec_capa); 830 831 /** 832 * @internal 833 * Set Forward Error Correction(FEC) mode. 834 * 835 * @param dev 836 * ethdev handle of port. 837 * @param fec_capa 838 * bitmask of allowed FEC modes. It must be only one 839 * if AUTO is disabled. If AUTO is enabled, other 840 * bits specify FEC modes which may be negotiated. 841 * 842 * @return 843 * Negative errno value on error, 0 on success. 844 * 845 * @retval 0 846 * Success, set FEC success. 847 * @retval -ENOTSUP 848 * Operation is not supported. 849 * @retval -EINVAL 850 * Unsupported FEC mode requested. 851 * @retval -EIO 852 * Device is removed. 853 */ 854 typedef int (*eth_fec_set_t)(struct rte_eth_dev *dev, uint32_t fec_capa); 855 856 /** 857 * @internal 858 * Get all hairpin Tx/Rx peer ports of the current device, if any. 859 * 860 * @param dev 861 * ethdev handle of port. 862 * @param peer_ports 863 * array to save the ports list. 864 * @param len 865 * array length. 866 * @param direction 867 * value to decide the current to peer direction 868 * positive - used as Tx to get all peer Rx ports. 869 * zero - used as Rx to get all peer Tx ports. 870 * 871 * @return 872 * Negative errno value on error, 0 or positive on success. 873 * 874 * @retval 0 875 * Success, no peer ports. 876 * @retval >0 877 * Actual number of the peer ports. 878 * @retval -ENOTSUP 879 * Get peer ports API is not supported. 880 * @retval -EINVAL 881 * One of the parameters is invalid. 882 */ 883 typedef int (*hairpin_get_peer_ports_t)(struct rte_eth_dev *dev, 884 uint16_t *peer_ports, size_t len, 885 uint32_t direction); 886 887 /** 888 * @internal 889 * Bind all hairpin Tx queues of one port to the Rx queues of the peer port. 890 * 891 * @param dev 892 * ethdev handle of port. 893 * @param rx_port 894 * the peer Rx port. 895 * 896 * @return 897 * Negative errno value on error, 0 on success. 898 * 899 * @retval 0 900 * Success, bind successfully. 901 * @retval -ENOTSUP 902 * Bind API is not supported. 903 * @retval -EINVAL 904 * One of the parameters is invalid. 905 * @retval -EBUSY 906 * Device is not started. 907 */ 908 typedef int (*eth_hairpin_bind_t)(struct rte_eth_dev *dev, 909 uint16_t rx_port); 910 911 /** 912 * @internal 913 * Unbind all hairpin Tx queues of one port from the Rx queues of the peer port. 914 * 915 * @param dev 916 * ethdev handle of port. 917 * @param rx_port 918 * the peer Rx port. 919 * 920 * @return 921 * Negative errno value on error, 0 on success. 922 * 923 * @retval 0 924 * Success, unbind successfully. 925 * @retval -ENOTSUP 926 * Bind API is not supported. 927 * @retval -EINVAL 928 * One of the parameters is invalid. 929 * @retval -EBUSY 930 * Device is already stopped. 931 */ 932 typedef int (*eth_hairpin_unbind_t)(struct rte_eth_dev *dev, 933 uint16_t rx_port); 934 935 /** @internal Update and fetch peer queue information. */ 936 typedef int (*eth_hairpin_queue_peer_update_t) 937 (struct rte_eth_dev *dev, uint16_t peer_queue, 938 struct rte_hairpin_peer_info *current_info, 939 struct rte_hairpin_peer_info *peer_info, uint32_t direction); 940 941 /** @internal Bind peer queue to the current queue with fetched information. */ 942 typedef int (*eth_hairpin_queue_peer_bind_t) 943 (struct rte_eth_dev *dev, uint16_t cur_queue, 944 struct rte_hairpin_peer_info *peer_info, uint32_t direction); 945 946 /** @internal Unbind peer queue from the current queue. */ 947 typedef int (*eth_hairpin_queue_peer_unbind_t) 948 (struct rte_eth_dev *dev, uint16_t cur_queue, uint32_t direction); 949 950 /** 951 * @internal 952 * Get address of memory location whose contents will change whenever there is 953 * new data to be received on an Rx queue. 954 * 955 * @param rxq 956 * Ethdev queue pointer. 957 * @param pmc 958 * The pointer to power-optimized monitoring condition structure. 959 * @return 960 * Negative errno value on error, 0 on success. 961 * 962 * @retval 0 963 * Success 964 * @retval -EINVAL 965 * Invalid parameters 966 */ 967 typedef int (*eth_get_monitor_addr_t)(void *rxq, 968 struct rte_power_monitor_cond *pmc); 969 970 /** 971 * @internal 972 * Get representor info to be able to calculate the unique representor ID. 973 * 974 * Caller should pass NULL as pointer of info to get number of entries, 975 * allocate info buffer according to returned entry number, then call 976 * again with buffer to get real info. 977 * 978 * To calculate the representor ID, caller should iterate each entry, 979 * match controller index, pf index, vf or sf start index and range, 980 * then calculate representor ID from offset to vf/sf start index. 981 * @see rte_eth_representor_id_get. 982 * 983 * @param dev 984 * Ethdev handle of port. 985 * @param [out] info 986 * Pointer to memory to save device representor info. 987 * @return 988 * Negative errno value on error, number of info entries otherwise. 989 */ 990 991 typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev, 992 struct rte_eth_representor_info *info); 993 994 /** 995 * @internal 996 * Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD. 997 * 998 * @param dev 999 * Port (ethdev) handle 1000 * 1001 * @param[inout] features 1002 * Feature selection buffer 1003 * 1004 * @return 1005 * Negative errno value on error, zero otherwise 1006 */ 1007 typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev, 1008 uint64_t *features); 1009 1010 /** 1011 * @internal 1012 * Get IP reassembly offload capability of a PMD. 1013 * 1014 * @param dev 1015 * Port (ethdev) handle 1016 * 1017 * @param[out] conf 1018 * IP reassembly capability supported by the PMD 1019 * 1020 * @return 1021 * Negative errno value on error, zero otherwise 1022 */ 1023 typedef int (*eth_ip_reassembly_capability_get_t)(struct rte_eth_dev *dev, 1024 struct rte_eth_ip_reassembly_params *capa); 1025 1026 /** 1027 * @internal 1028 * Get IP reassembly offload configuration parameters set in PMD. 1029 * 1030 * @param dev 1031 * Port (ethdev) handle 1032 * 1033 * @param[out] conf 1034 * Configuration parameters for IP reassembly. 1035 * 1036 * @return 1037 * Negative errno value on error, zero otherwise 1038 */ 1039 typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev, 1040 struct rte_eth_ip_reassembly_params *conf); 1041 1042 /** 1043 * @internal 1044 * Set configuration parameters for enabling IP reassembly offload in hardware. 1045 * 1046 * @param dev 1047 * Port (ethdev) handle 1048 * 1049 * @param[in] conf 1050 * Configuration parameters for IP reassembly. 1051 * 1052 * @return 1053 * Negative errno value on error, zero otherwise 1054 */ 1055 typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev, 1056 const struct rte_eth_ip_reassembly_params *conf); 1057 1058 /** 1059 * @internal 1060 * Dump private info from device to a file. 1061 * 1062 * @param dev 1063 * Port (ethdev) handle. 1064 * @param file 1065 * A pointer to a file for output. 1066 * 1067 * @return 1068 * Negative value on error, 0 on success. 1069 * 1070 * @retval 0 1071 * Success 1072 * @retval -EINVAL 1073 * Invalid file 1074 */ 1075 typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file); 1076 1077 /** 1078 * @internal Set Rx queue available descriptors threshold. 1079 * @see rte_eth_rx_avail_thresh_set() 1080 * 1081 * Driver should round down number of descriptors on conversion from 1082 * percentage. 1083 */ 1084 typedef int (*eth_rx_queue_avail_thresh_set_t)(struct rte_eth_dev *dev, 1085 uint16_t rx_queue_id, 1086 uint8_t avail_thresh); 1087 1088 /** 1089 * @internal Query Rx queue available descriptors threshold event. 1090 * @see rte_eth_rx_avail_thresh_query() 1091 */ 1092 1093 typedef int (*eth_rx_queue_avail_thresh_query_t)(struct rte_eth_dev *dev, 1094 uint16_t *rx_queue_id, 1095 uint8_t *avail_thresh); 1096 1097 /** 1098 * @internal A structure containing the functions exported by an Ethernet driver. 1099 */ 1100 struct eth_dev_ops { 1101 eth_dev_configure_t dev_configure; /**< Configure device */ 1102 eth_dev_start_t dev_start; /**< Start device */ 1103 eth_dev_stop_t dev_stop; /**< Stop device */ 1104 eth_dev_set_link_up_t dev_set_link_up; /**< Device link up */ 1105 eth_dev_set_link_down_t dev_set_link_down; /**< Device link down */ 1106 eth_dev_close_t dev_close; /**< Close device */ 1107 eth_dev_reset_t dev_reset; /**< Reset device */ 1108 eth_link_update_t link_update; /**< Get device link state */ 1109 /** Check if the device was physically removed */ 1110 eth_is_removed_t is_removed; 1111 1112 eth_promiscuous_enable_t promiscuous_enable; /**< Promiscuous ON */ 1113 eth_promiscuous_disable_t promiscuous_disable;/**< Promiscuous OFF */ 1114 eth_allmulticast_enable_t allmulticast_enable;/**< Rx multicast ON */ 1115 eth_allmulticast_disable_t allmulticast_disable;/**< Rx multicast OFF */ 1116 eth_mac_addr_remove_t mac_addr_remove; /**< Remove MAC address */ 1117 eth_mac_addr_add_t mac_addr_add; /**< Add a MAC address */ 1118 eth_mac_addr_set_t mac_addr_set; /**< Set a MAC address */ 1119 /** Set list of multicast addresses */ 1120 eth_set_mc_addr_list_t set_mc_addr_list; 1121 mtu_set_t mtu_set; /**< Set MTU */ 1122 1123 /** Get generic device statistics */ 1124 eth_stats_get_t stats_get; 1125 /** Reset generic device statistics */ 1126 eth_stats_reset_t stats_reset; 1127 /** Get extended device statistics */ 1128 eth_xstats_get_t xstats_get; 1129 /** Reset extended device statistics */ 1130 eth_xstats_reset_t xstats_reset; 1131 /** Get names of extended statistics */ 1132 eth_xstats_get_names_t xstats_get_names; 1133 /** Configure per queue stat counter mapping */ 1134 eth_queue_stats_mapping_set_t queue_stats_mapping_set; 1135 1136 eth_dev_infos_get_t dev_infos_get; /**< Get device info */ 1137 /** Retrieve Rx queue information */ 1138 eth_rxq_info_get_t rxq_info_get; 1139 /** Retrieve Tx queue information */ 1140 eth_txq_info_get_t txq_info_get; 1141 eth_burst_mode_get_t rx_burst_mode_get; /**< Get Rx burst mode */ 1142 eth_burst_mode_get_t tx_burst_mode_get; /**< Get Tx burst mode */ 1143 eth_fw_version_get_t fw_version_get; /**< Get firmware version */ 1144 1145 /** Get packet types supported and identified by device */ 1146 eth_dev_supported_ptypes_get_t dev_supported_ptypes_get; 1147 /** 1148 * Inform Ethernet device about reduced range of packet types to 1149 * handle 1150 */ 1151 eth_dev_ptypes_set_t dev_ptypes_set; 1152 1153 /** Filter VLAN Setup */ 1154 vlan_filter_set_t vlan_filter_set; 1155 /** Outer/Inner VLAN TPID Setup */ 1156 vlan_tpid_set_t vlan_tpid_set; 1157 /** VLAN Stripping on queue */ 1158 vlan_strip_queue_set_t vlan_strip_queue_set; 1159 /** Set VLAN Offload */ 1160 vlan_offload_set_t vlan_offload_set; 1161 /** Set port based Tx VLAN insertion */ 1162 vlan_pvid_set_t vlan_pvid_set; 1163 1164 eth_queue_start_t rx_queue_start;/**< Start Rx for a queue */ 1165 eth_queue_stop_t rx_queue_stop; /**< Stop Rx for a queue */ 1166 eth_queue_start_t tx_queue_start;/**< Start Tx for a queue */ 1167 eth_queue_stop_t tx_queue_stop; /**< Stop Tx for a queue */ 1168 eth_rx_queue_setup_t rx_queue_setup;/**< Set up device Rx queue */ 1169 eth_queue_release_t rx_queue_release; /**< Release Rx queue */ 1170 1171 /** Enable Rx queue interrupt */ 1172 eth_rx_enable_intr_t rx_queue_intr_enable; 1173 /** Disable Rx queue interrupt */ 1174 eth_rx_disable_intr_t rx_queue_intr_disable; 1175 1176 eth_tx_queue_setup_t tx_queue_setup;/**< Set up device Tx queue */ 1177 eth_queue_release_t tx_queue_release; /**< Release Tx queue */ 1178 eth_tx_done_cleanup_t tx_done_cleanup;/**< Free Tx ring mbufs */ 1179 1180 eth_dev_led_on_t dev_led_on; /**< Turn on LED */ 1181 eth_dev_led_off_t dev_led_off; /**< Turn off LED */ 1182 1183 flow_ctrl_get_t flow_ctrl_get; /**< Get flow control */ 1184 flow_ctrl_set_t flow_ctrl_set; /**< Setup flow control */ 1185 /** Setup priority flow control */ 1186 priority_flow_ctrl_set_t priority_flow_ctrl_set; 1187 /** Priority flow control queue info get */ 1188 priority_flow_ctrl_queue_info_get_t priority_flow_ctrl_queue_info_get; 1189 /** Priority flow control queue configure */ 1190 priority_flow_ctrl_queue_config_t priority_flow_ctrl_queue_config; 1191 1192 /** Set Unicast Table Array */ 1193 eth_uc_hash_table_set_t uc_hash_table_set; 1194 /** Set Unicast hash bitmap */ 1195 eth_uc_all_hash_table_set_t uc_all_hash_table_set; 1196 1197 /** Add UDP tunnel port */ 1198 eth_udp_tunnel_port_add_t udp_tunnel_port_add; 1199 /** Delete UDP tunnel port */ 1200 eth_udp_tunnel_port_del_t udp_tunnel_port_del; 1201 1202 /** Set queue rate limit */ 1203 eth_set_queue_rate_limit_t set_queue_rate_limit; 1204 1205 /** Configure RSS hash protocols and hashing key */ 1206 rss_hash_update_t rss_hash_update; 1207 /** Get current RSS hash configuration */ 1208 rss_hash_conf_get_t rss_hash_conf_get; 1209 /** Update redirection table */ 1210 reta_update_t reta_update; 1211 /** Query redirection table */ 1212 reta_query_t reta_query; 1213 1214 eth_get_reg_t get_reg; /**< Get registers */ 1215 eth_get_eeprom_length_t get_eeprom_length; /**< Get EEPROM length */ 1216 eth_get_eeprom_t get_eeprom; /**< Get EEPROM data */ 1217 eth_set_eeprom_t set_eeprom; /**< Set EEPROM */ 1218 1219 /** Get plugin module EEPROM attribute */ 1220 eth_get_module_info_t get_module_info; 1221 /** Get plugin module EEPROM data */ 1222 eth_get_module_eeprom_t get_module_eeprom; 1223 1224 eth_flow_ops_get_t flow_ops_get; /**< Get flow operations */ 1225 1226 eth_get_dcb_info get_dcb_info; /**< Get DCB information */ 1227 1228 /** Turn IEEE1588/802.1AS timestamping on */ 1229 eth_timesync_enable_t timesync_enable; 1230 /** Turn IEEE1588/802.1AS timestamping off */ 1231 eth_timesync_disable_t timesync_disable; 1232 /** Read the IEEE1588/802.1AS Rx timestamp */ 1233 eth_timesync_read_rx_timestamp_t timesync_read_rx_timestamp; 1234 /** Read the IEEE1588/802.1AS Tx timestamp */ 1235 eth_timesync_read_tx_timestamp_t timesync_read_tx_timestamp; 1236 /** Adjust the device clock */ 1237 eth_timesync_adjust_time timesync_adjust_time; 1238 /** Get the device clock time */ 1239 eth_timesync_read_time timesync_read_time; 1240 /** Set the device clock time */ 1241 eth_timesync_write_time timesync_write_time; 1242 1243 eth_read_clock read_clock; 1244 1245 /** Get extended device statistic values by ID */ 1246 eth_xstats_get_by_id_t xstats_get_by_id; 1247 /** Get name of extended device statistics by ID */ 1248 eth_xstats_get_names_by_id_t xstats_get_names_by_id; 1249 1250 /** Get Traffic Management (TM) operations */ 1251 eth_tm_ops_get_t tm_ops_get; 1252 1253 /** Get Traffic Metering and Policing (MTR) operations */ 1254 eth_mtr_ops_get_t mtr_ops_get; 1255 1256 /** Test if a port supports specific mempool ops */ 1257 eth_pool_ops_supported_t pool_ops_supported; 1258 1259 /** Returns the hairpin capabilities */ 1260 eth_hairpin_cap_get_t hairpin_cap_get; 1261 /** Set up device Rx hairpin queue */ 1262 eth_rx_hairpin_queue_setup_t rx_hairpin_queue_setup; 1263 /** Set up device Tx hairpin queue */ 1264 eth_tx_hairpin_queue_setup_t tx_hairpin_queue_setup; 1265 1266 /** Get Forward Error Correction(FEC) capability */ 1267 eth_fec_get_capability_t fec_get_capability; 1268 /** Get Forward Error Correction(FEC) mode */ 1269 eth_fec_get_t fec_get; 1270 /** Set Forward Error Correction(FEC) mode */ 1271 eth_fec_set_t fec_set; 1272 1273 /** Get hairpin peer ports list */ 1274 hairpin_get_peer_ports_t hairpin_get_peer_ports; 1275 /** Bind all hairpin Tx queues of device to the peer port Rx queues */ 1276 eth_hairpin_bind_t hairpin_bind; 1277 /** Unbind all hairpin Tx queues from the peer port Rx queues */ 1278 eth_hairpin_unbind_t hairpin_unbind; 1279 /** Pass the current queue info and get the peer queue info */ 1280 eth_hairpin_queue_peer_update_t hairpin_queue_peer_update; 1281 /** Set up the connection between the pair of hairpin queues */ 1282 eth_hairpin_queue_peer_bind_t hairpin_queue_peer_bind; 1283 /** Disconnect the hairpin queues of a pair from each other */ 1284 eth_hairpin_queue_peer_unbind_t hairpin_queue_peer_unbind; 1285 1286 /** Get power monitoring condition for Rx queue */ 1287 eth_get_monitor_addr_t get_monitor_addr; 1288 1289 /** Get representor info */ 1290 eth_representor_info_get_t representor_info_get; 1291 1292 /** 1293 * Negotiate the NIC's ability to deliver specific 1294 * kinds of metadata to the PMD 1295 */ 1296 eth_rx_metadata_negotiate_t rx_metadata_negotiate; 1297 1298 /** Get IP reassembly capability */ 1299 eth_ip_reassembly_capability_get_t ip_reassembly_capability_get; 1300 /** Get IP reassembly configuration */ 1301 eth_ip_reassembly_conf_get_t ip_reassembly_conf_get; 1302 /** Set IP reassembly configuration */ 1303 eth_ip_reassembly_conf_set_t ip_reassembly_conf_set; 1304 1305 /** Dump private info from device */ 1306 eth_dev_priv_dump_t eth_dev_priv_dump; 1307 1308 /** Set Rx queue available descriptors threshold */ 1309 eth_rx_queue_avail_thresh_set_t rx_queue_avail_thresh_set; 1310 /** Query Rx queue available descriptors threshold event */ 1311 eth_rx_queue_avail_thresh_query_t rx_queue_avail_thresh_query; 1312 }; 1313 1314 /** 1315 * @internal 1316 * Check if the selected Rx queue is hairpin queue. 1317 * 1318 * @param dev 1319 * Pointer to the selected device. 1320 * @param queue_id 1321 * The selected queue. 1322 * 1323 * @return 1324 * - (1) if the queue is hairpin queue, 0 otherwise. 1325 */ 1326 __rte_internal 1327 int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id); 1328 1329 /** 1330 * @internal 1331 * Check if the selected Tx queue is hairpin queue. 1332 * 1333 * @param dev 1334 * Pointer to the selected device. 1335 * @param queue_id 1336 * The selected queue. 1337 * 1338 * @return 1339 * - (1) if the queue is hairpin queue, 0 otherwise. 1340 */ 1341 __rte_internal 1342 int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id); 1343 1344 /** 1345 * @internal 1346 * Returns a ethdev slot specified by the unique identifier name. 1347 * 1348 * @param name 1349 * The pointer to the Unique identifier name for each Ethernet device 1350 * @return 1351 * - The pointer to the ethdev slot, on success. NULL on error 1352 */ 1353 __rte_internal 1354 struct rte_eth_dev *rte_eth_dev_allocated(const char *name); 1355 1356 /** 1357 * @internal 1358 * Allocates a new ethdev slot for an Ethernet device and returns the pointer 1359 * to that slot for the driver to use. 1360 * 1361 * @param name Unique identifier name for each Ethernet device 1362 * @return 1363 * - Slot in the rte_dev_devices array for a new device; 1364 */ 1365 __rte_internal 1366 struct rte_eth_dev *rte_eth_dev_allocate(const char *name); 1367 1368 /** 1369 * @internal 1370 * Attach to the ethdev already initialized by the primary 1371 * process. 1372 * 1373 * @param name Ethernet device's name. 1374 * @return 1375 * - Success: Slot in the rte_dev_devices array for attached 1376 * device. 1377 * - Error: Null pointer. 1378 */ 1379 __rte_internal 1380 struct rte_eth_dev *rte_eth_dev_attach_secondary(const char *name); 1381 1382 /** 1383 * @internal 1384 * Notify RTE_ETH_EVENT_DESTROY and release the specified ethdev port. 1385 * 1386 * The following PMD-managed data fields will be freed: 1387 * - dev_private 1388 * - mac_addrs 1389 * - hash_mac_addrs 1390 * If one of these fields should not be freed, 1391 * it must be reset to NULL by the PMD, typically in dev_close method. 1392 * 1393 * @param eth_dev 1394 * Device to be detached. 1395 * @return 1396 * - 0 on success, negative on error 1397 */ 1398 __rte_internal 1399 int rte_eth_dev_release_port(struct rte_eth_dev *eth_dev); 1400 1401 /** 1402 * @internal 1403 * Release device queues and clear its configuration to force the user 1404 * application to reconfigure it. It is for internal use only. 1405 * 1406 * @param dev 1407 * Pointer to struct rte_eth_dev. 1408 * 1409 * @return 1410 * void 1411 */ 1412 __rte_internal 1413 void rte_eth_dev_internal_reset(struct rte_eth_dev *dev); 1414 1415 /** 1416 * @internal Executes all the user application registered callbacks for 1417 * the specific device. It is for DPDK internal user only. User 1418 * application should not call it directly. 1419 * 1420 * @param dev 1421 * Pointer to struct rte_eth_dev. 1422 * @param event 1423 * Eth device interrupt event type. 1424 * @param ret_param 1425 * To pass data back to user application. 1426 * This allows the user application to decide if a particular function 1427 * is permitted or not. 1428 * 1429 * @return 1430 * int 1431 */ 1432 __rte_internal 1433 int rte_eth_dev_callback_process(struct rte_eth_dev *dev, 1434 enum rte_eth_event_type event, void *ret_param); 1435 1436 /** 1437 * @internal 1438 * This is the last step of device probing. 1439 * It must be called after a port is allocated and initialized successfully. 1440 * 1441 * The notification RTE_ETH_EVENT_NEW is sent to other entities 1442 * (libraries and applications). 1443 * The state is set as RTE_ETH_DEV_ATTACHED. 1444 * 1445 * @param dev 1446 * New ethdev port. 1447 */ 1448 __rte_internal 1449 void rte_eth_dev_probing_finish(struct rte_eth_dev *dev); 1450 1451 /** 1452 * Create memzone for HW rings. 1453 * malloc can't be used as the physical address is needed. 1454 * If the memzone is already created, then this function returns a ptr 1455 * to the old one. 1456 * 1457 * @param eth_dev 1458 * The *eth_dev* pointer is the address of the *rte_eth_dev* structure 1459 * @param name 1460 * The name of the memory zone 1461 * @param queue_id 1462 * The index of the queue to add to name 1463 * @param size 1464 * The sizeof of the memory area 1465 * @param align 1466 * Alignment for resulting memzone. Must be a power of 2. 1467 * @param socket_id 1468 * The *socket_id* argument is the socket identifier in case of NUMA. 1469 */ 1470 __rte_internal 1471 const struct rte_memzone * 1472 rte_eth_dma_zone_reserve(const struct rte_eth_dev *eth_dev, const char *name, 1473 uint16_t queue_id, size_t size, 1474 unsigned align, int socket_id); 1475 1476 /** 1477 * Free previously allocated memzone for HW rings. 1478 * 1479 * @param eth_dev 1480 * The *eth_dev* pointer is the address of the *rte_eth_dev* structure 1481 * @param name 1482 * The name of the memory zone 1483 * @param queue_id 1484 * The index of the queue to add to name 1485 * @return 1486 * Negative errno value on error, 0 on success. 1487 */ 1488 __rte_internal 1489 int 1490 rte_eth_dma_zone_free(const struct rte_eth_dev *eth_dev, const char *name, 1491 uint16_t queue_id); 1492 1493 /** 1494 * @internal 1495 * Atomically set the link status for the specific device. 1496 * It is for use by DPDK device driver use only. 1497 * User applications should not call it 1498 * 1499 * @param dev 1500 * Pointer to struct rte_eth_dev. 1501 * @param link 1502 * New link status value. 1503 * @return 1504 * Same convention as eth_link_update operation. 1505 * 0 if link up status has changed 1506 * -1 if link up status was unchanged 1507 */ 1508 static inline int 1509 rte_eth_linkstatus_set(struct rte_eth_dev *dev, 1510 const struct rte_eth_link *new_link) 1511 { 1512 uint64_t *dev_link = (uint64_t *)&(dev->data->dev_link); 1513 union { 1514 uint64_t val64; 1515 struct rte_eth_link link; 1516 } orig; 1517 1518 RTE_BUILD_BUG_ON(sizeof(*new_link) != sizeof(uint64_t)); 1519 1520 orig.val64 = __atomic_exchange_n(dev_link, *(const uint64_t *)new_link, 1521 __ATOMIC_SEQ_CST); 1522 1523 return (orig.link.link_status == new_link->link_status) ? -1 : 0; 1524 } 1525 1526 /** 1527 * @internal 1528 * Atomically get the link speed and status. 1529 * 1530 * @param dev 1531 * Pointer to struct rte_eth_dev. 1532 * @param link 1533 * link status value. 1534 */ 1535 static inline void 1536 rte_eth_linkstatus_get(const struct rte_eth_dev *dev, 1537 struct rte_eth_link *link) 1538 { 1539 uint64_t *src = (uint64_t *)&(dev->data->dev_link); 1540 uint64_t *dst = (uint64_t *)link; 1541 1542 RTE_BUILD_BUG_ON(sizeof(*link) != sizeof(uint64_t)); 1543 1544 *dst = __atomic_load_n(src, __ATOMIC_SEQ_CST); 1545 } 1546 1547 /** 1548 * @internal 1549 * Dummy DPDK callback for Rx/Tx packet burst. 1550 * 1551 * @param queue 1552 * Pointer to Rx/Tx queue 1553 * @param pkts 1554 * Packet array 1555 * @param nb_pkts 1556 * Number of packets in packet array 1557 */ 1558 __rte_internal 1559 uint16_t 1560 rte_eth_pkt_burst_dummy(void *queue __rte_unused, 1561 struct rte_mbuf **pkts __rte_unused, 1562 uint16_t nb_pkts __rte_unused); 1563 1564 /** 1565 * Allocate an unique switch domain identifier. 1566 * 1567 * A pool of switch domain identifiers which can be allocated on request. This 1568 * will enabled devices which support the concept of switch domains to request 1569 * a switch domain ID which is guaranteed to be unique from other devices 1570 * running in the same process. 1571 * 1572 * @param domain_id 1573 * switch domain identifier parameter to pass back to application 1574 * 1575 * @return 1576 * Negative errno value on error, 0 on success. 1577 */ 1578 __rte_internal 1579 int 1580 rte_eth_switch_domain_alloc(uint16_t *domain_id); 1581 1582 /** 1583 * Free switch domain. 1584 * 1585 * Return a switch domain identifier to the pool of free identifiers after it is 1586 * no longer in use by device. 1587 * 1588 * @param domain_id 1589 * switch domain identifier to free 1590 * 1591 * @return 1592 * Negative errno value on error, 0 on success. 1593 */ 1594 __rte_internal 1595 int 1596 rte_eth_switch_domain_free(uint16_t domain_id); 1597 1598 /** 1599 * Generic Ethernet device arguments 1600 * 1601 * One type of representor each structure. 1602 */ 1603 struct rte_eth_devargs { 1604 uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS]; 1605 /** controller/s number in case of multi-host */ 1606 uint16_t nb_mh_controllers; 1607 /** number of controllers in multi-host controllers field */ 1608 uint16_t ports[RTE_MAX_ETHPORTS]; 1609 /** port/s number to enable on a multi-port single function */ 1610 uint16_t nb_ports; 1611 /** number of ports in ports field */ 1612 uint16_t representor_ports[RTE_MAX_ETHPORTS]; 1613 /** representor port/s identifier to enable on device */ 1614 uint16_t nb_representor_ports; 1615 /** number of ports in representor port field */ 1616 enum rte_eth_representor_type type; /* type of representor */ 1617 }; 1618 1619 /** 1620 * PMD helper function to get representor ID from location detail. 1621 * 1622 * Get representor ID from controller, pf and (sf or vf). 1623 * The mapping is retrieved from rte_eth_representor_info_get(). 1624 * 1625 * For backward compatibility, if no representor info, direct 1626 * map legacy VF (no controller and pf). 1627 * 1628 * @param port_id 1629 * Port ID of the backing device. 1630 * @param type 1631 * Representor type. 1632 * @param controller 1633 * Controller ID, -1 if unspecified. 1634 * @param pf 1635 * PF port ID, -1 if unspecified. 1636 * @param representor_port 1637 * VF or SF representor port number, -1 if unspecified. 1638 * @param repr_id 1639 * Pointer to output representor ID. 1640 * 1641 * @return 1642 * Negative errno value on error, 0 on success. 1643 */ 1644 __rte_internal 1645 int 1646 rte_eth_representor_id_get(uint16_t port_id, 1647 enum rte_eth_representor_type type, 1648 int controller, int pf, int representor_port, 1649 uint16_t *repr_id); 1650 1651 /** 1652 * PMD helper function to parse ethdev arguments 1653 * 1654 * @param devargs 1655 * device arguments 1656 * @param eth_devargs 1657 * parsed ethdev specific arguments. 1658 * 1659 * @return 1660 * Negative errno value on error, 0 on success. 1661 */ 1662 __rte_internal 1663 int 1664 rte_eth_devargs_parse(const char *devargs, struct rte_eth_devargs *eth_devargs); 1665 1666 1667 typedef int (*ethdev_init_t)(struct rte_eth_dev *ethdev, void *init_params); 1668 typedef int (*ethdev_bus_specific_init)(struct rte_eth_dev *ethdev, 1669 void *bus_specific_init_params); 1670 1671 /** 1672 * PMD helper function for the creation of a new ethdev ports. 1673 * 1674 * @param device 1675 * rte_device handle. 1676 * @param name 1677 * port name. 1678 * @param priv_data_size 1679 * size of private data required for port. 1680 * @param bus_specific_init 1681 * port bus specific initialisation callback function 1682 * @param bus_init_params 1683 * port bus specific initialisation parameters 1684 * @param ethdev_init 1685 * device specific port initialization callback function 1686 * @param init_params 1687 * port initialisation parameters 1688 * 1689 * @return 1690 * Negative errno value on error, 0 on success. 1691 */ 1692 __rte_internal 1693 int 1694 rte_eth_dev_create(struct rte_device *device, const char *name, 1695 size_t priv_data_size, 1696 ethdev_bus_specific_init bus_specific_init, void *bus_init_params, 1697 ethdev_init_t ethdev_init, void *init_params); 1698 1699 1700 typedef int (*ethdev_uninit_t)(struct rte_eth_dev *ethdev); 1701 1702 /** 1703 * PMD helper function for cleaning up the resources of a ethdev port on it's 1704 * destruction. 1705 * 1706 * @param ethdev 1707 * ethdev handle of port. 1708 * @param ethdev_uninit 1709 * device specific port un-initialise callback function 1710 * 1711 * @return 1712 * Negative errno value on error, 0 on success. 1713 */ 1714 __rte_internal 1715 int 1716 rte_eth_dev_destroy(struct rte_eth_dev *ethdev, ethdev_uninit_t ethdev_uninit); 1717 1718 /** 1719 * @internal 1720 * Pass the current hairpin queue HW and/or SW information to the peer queue 1721 * and fetch back the information of the peer queue. 1722 * 1723 * @param peer_port 1724 * Peer port identifier of the Ethernet device. 1725 * @param peer_queue 1726 * Peer queue index of the port. 1727 * @param cur_info 1728 * Pointer to the current information structure. 1729 * @param peer_info 1730 * Pointer to the peer information, output. 1731 * @param direction 1732 * Direction to pass the information. 1733 * positive - pass Tx queue information and get peer Rx queue information 1734 * zero - pass Rx queue information and get peer Tx queue information 1735 * 1736 * @return 1737 * Negative errno value on error, 0 on success. 1738 */ 1739 __rte_internal 1740 int 1741 rte_eth_hairpin_queue_peer_update(uint16_t peer_port, uint16_t peer_queue, 1742 struct rte_hairpin_peer_info *cur_info, 1743 struct rte_hairpin_peer_info *peer_info, 1744 uint32_t direction); 1745 1746 /** 1747 * @internal 1748 * Configure current hairpin queue with the peer information fetched to create 1749 * the connection (bind) with peer queue in the specified direction. 1750 * This function might need to be called twice to fully create the connections. 1751 * 1752 * @param cur_port 1753 * Current port identifier of the Ethernet device. 1754 * @param cur_queue 1755 * Current queue index of the port. 1756 * @param peer_info 1757 * Pointer to the peer information, input. 1758 * @param direction 1759 * Direction to create the connection. 1760 * positive - bind current Tx queue to peer Rx queue 1761 * zero - bind current Rx queue to peer Tx queue 1762 * 1763 * @return 1764 * Negative errno value on error, 0 on success. 1765 */ 1766 __rte_internal 1767 int 1768 rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue, 1769 struct rte_hairpin_peer_info *peer_info, 1770 uint32_t direction); 1771 1772 /** 1773 * @internal 1774 * Get rte_eth_dev from device name. The device name should be specified 1775 * as below: 1776 * - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0 1777 * - SoC device name, for example fsl-gmac0 1778 * - vdev dpdk name, for example net_[pcap0|null0|tap0] 1779 * 1780 * @param name 1781 * PCI address or name of the device 1782 * @return 1783 * - rte_eth_dev if successful 1784 * - NULL on failure 1785 */ 1786 __rte_internal 1787 struct rte_eth_dev* 1788 rte_eth_dev_get_by_name(const char *name); 1789 1790 /** 1791 * @internal 1792 * Reset the current queue state and configuration to disconnect (unbind) it 1793 * from the peer queue. 1794 * This function might need to be called twice to disconnect each other. 1795 * 1796 * @param cur_port 1797 * Current port identifier of the Ethernet device. 1798 * @param cur_queue 1799 * Current queue index of the port. 1800 * @param direction 1801 * Direction to destroy the connection. 1802 * positive - unbind current Tx queue from peer Rx queue 1803 * zero - unbind current Rx queue from peer Tx queue 1804 * 1805 * @return 1806 * Negative errno value on error, 0 on success. 1807 */ 1808 __rte_internal 1809 int 1810 rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue, 1811 uint32_t direction); 1812 1813 /** 1814 * @internal 1815 * Register mbuf dynamic field and flag for IP reassembly incomplete case. 1816 */ 1817 __rte_internal 1818 int 1819 rte_eth_ip_reassembly_dynfield_register(int *field_offset, int *flag); 1820 1821 1822 /* 1823 * Legacy ethdev API used internally by drivers. 1824 */ 1825 1826 enum rte_filter_type { 1827 RTE_ETH_FILTER_NONE = 0, 1828 RTE_ETH_FILTER_ETHERTYPE, 1829 RTE_ETH_FILTER_FLEXIBLE, 1830 RTE_ETH_FILTER_SYN, 1831 RTE_ETH_FILTER_NTUPLE, 1832 RTE_ETH_FILTER_TUNNEL, 1833 RTE_ETH_FILTER_FDIR, 1834 RTE_ETH_FILTER_HASH, 1835 RTE_ETH_FILTER_L2_TUNNEL, 1836 }; 1837 1838 /** 1839 * Define all structures for Ethertype Filter type. 1840 */ 1841 1842 #define RTE_ETHTYPE_FLAGS_MAC 0x0001 /**< If set, compare mac */ 1843 #define RTE_ETHTYPE_FLAGS_DROP 0x0002 /**< If set, drop packet when match */ 1844 1845 /** 1846 * A structure used to define the ethertype filter entry 1847 * to support RTE_ETH_FILTER_ETHERTYPE data representation. 1848 */ 1849 struct rte_eth_ethertype_filter { 1850 struct rte_ether_addr mac_addr; /**< Mac address to match */ 1851 uint16_t ether_type; /**< Ether type to match */ 1852 uint16_t flags; /**< Flags from RTE_ETHTYPE_FLAGS_* */ 1853 uint16_t queue; /**< Queue assigned to when match */ 1854 }; 1855 1856 /** 1857 * A structure used to define the TCP syn filter entry 1858 * to support RTE_ETH_FILTER_SYN data representation. 1859 */ 1860 struct rte_eth_syn_filter { 1861 /** 1 - higher priority than other filters, 0 - lower priority */ 1862 uint8_t hig_pri; 1863 uint16_t queue; /**< Queue assigned to when match */ 1864 }; 1865 1866 /** 1867 * filter type of tunneling packet 1868 */ 1869 #define RTE_ETH_TUNNEL_FILTER_OMAC 0x01 /**< filter by outer MAC addr */ 1870 #define RTE_ETH_TUNNEL_FILTER_OIP 0x02 /**< filter by outer IP Addr */ 1871 #define RTE_ETH_TUNNEL_FILTER_TENID 0x04 /**< filter by tenant ID */ 1872 #define RTE_ETH_TUNNEL_FILTER_IMAC 0x08 /**< filter by inner MAC addr */ 1873 #define RTE_ETH_TUNNEL_FILTER_IVLAN 0x10 /**< filter by inner VLAN ID */ 1874 #define RTE_ETH_TUNNEL_FILTER_IIP 0x20 /**< filter by inner IP addr */ 1875 1876 #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN (RTE_ETH_TUNNEL_FILTER_IMAC | \ 1877 RTE_ETH_TUNNEL_FILTER_IVLAN) 1878 #define RTE_ETH_TUNNEL_FILTER_IMAC_IVLAN_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \ 1879 RTE_ETH_TUNNEL_FILTER_IVLAN | \ 1880 RTE_ETH_TUNNEL_FILTER_TENID) 1881 #define RTE_ETH_TUNNEL_FILTER_IMAC_TENID (RTE_ETH_TUNNEL_FILTER_IMAC | \ 1882 RTE_ETH_TUNNEL_FILTER_TENID) 1883 #define RTE_ETH_TUNNEL_FILTER_OMAC_TENID_IMAC (RTE_ETH_TUNNEL_FILTER_OMAC | \ 1884 RTE_ETH_TUNNEL_FILTER_TENID | \ 1885 RTE_ETH_TUNNEL_FILTER_IMAC) 1886 1887 /** 1888 * Select IPv4 or IPv6 for tunnel filters. 1889 */ 1890 enum rte_tunnel_iptype { 1891 RTE_TUNNEL_IPTYPE_IPV4 = 0, /**< IPv4 */ 1892 RTE_TUNNEL_IPTYPE_IPV6, /**< IPv6 */ 1893 }; 1894 1895 /** 1896 * Tunneling Packet filter configuration. 1897 */ 1898 struct rte_eth_tunnel_filter_conf { 1899 struct rte_ether_addr outer_mac; /**< Outer MAC address to match */ 1900 struct rte_ether_addr inner_mac; /**< Inner MAC address to match */ 1901 uint16_t inner_vlan; /**< Inner VLAN to match */ 1902 enum rte_tunnel_iptype ip_type; /**< IP address type */ 1903 /** 1904 * Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP 1905 * is set in filter_type, or inner destination IP address to match 1906 * if ETH_TUNNEL_FILTER_IIP is set in filter_type. 1907 */ 1908 union { 1909 uint32_t ipv4_addr; /**< IPv4 address in big endian */ 1910 uint32_t ipv6_addr[4]; /**< IPv6 address in big endian */ 1911 } ip_addr; 1912 /** Flags from ETH_TUNNEL_FILTER_XX - see above */ 1913 uint16_t filter_type; 1914 enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type */ 1915 uint32_t tenant_id; /**< Tenant ID to match: VNI, GRE key... */ 1916 uint16_t queue_id; /**< Queue assigned to if match */ 1917 }; 1918 1919 /** 1920 * Memory space that can be configured to store Flow Director filters 1921 * in the board memory. 1922 */ 1923 enum rte_eth_fdir_pballoc_type { 1924 RTE_ETH_FDIR_PBALLOC_64K = 0, /**< 64k. */ 1925 RTE_ETH_FDIR_PBALLOC_128K, /**< 128k. */ 1926 RTE_ETH_FDIR_PBALLOC_256K, /**< 256k. */ 1927 }; 1928 1929 /** 1930 * Select report mode of FDIR hash information in Rx descriptors. 1931 */ 1932 enum rte_fdir_status_mode { 1933 RTE_FDIR_NO_REPORT_STATUS = 0, /**< Never report FDIR hash. */ 1934 RTE_FDIR_REPORT_STATUS, /**< Only report FDIR hash for matching pkts. */ 1935 RTE_FDIR_REPORT_STATUS_ALWAYS, /**< Always report FDIR hash. */ 1936 }; 1937 1938 /** 1939 * A structure used to configure the Flow Director (FDIR) feature 1940 * of an Ethernet port. 1941 * 1942 * If mode is RTE_FDIR_MODE_NONE, the pballoc value is ignored. 1943 */ 1944 struct rte_eth_fdir_conf { 1945 enum rte_fdir_mode mode; /**< Flow Director mode. */ 1946 enum rte_eth_fdir_pballoc_type pballoc; /**< Space for FDIR filters. */ 1947 enum rte_fdir_status_mode status; /**< How to report FDIR hash. */ 1948 /** Rx queue of packets matching a "drop" filter in perfect mode. */ 1949 uint8_t drop_queue; 1950 struct rte_eth_fdir_masks mask; 1951 /** Flex payload configuration. */ 1952 struct rte_eth_fdir_flex_conf flex_conf; 1953 }; 1954 1955 #ifdef __cplusplus 1956 } 1957 #endif 1958 1959 #endif /* _RTE_ETHDEV_DRIVER_H_ */ 1960