1 /*- 2 * BSD LICENSE 3 * 4 * Copyright (c) 2016 Intel Corporation. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in 14 * the documentation and/or other materials provided with the 15 * distribution. 16 * * Neither the name of Intel Corporation nor the names of its 17 * contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 /** 34 * @file rte_pmd_ixgbe.h 35 * ixgbe PMD specific functions. 36 * 37 **/ 38 39 #ifndef _PMD_IXGBE_H_ 40 #define _PMD_IXGBE_H_ 41 42 #include <rte_ethdev.h> 43 44 /** 45 * Set the VF MAC address. 46 * 47 * @param port 48 * The port identifier of the Ethernet device. 49 * @param vf 50 * VF id. 51 * @param mac_addr 52 * VF MAC address. 53 * @return 54 * - (0) if successful. 55 * - (-ENODEV) if *port* invalid. 56 * - (-EINVAL) if *vf* or *mac_addr* is invalid. 57 */ 58 int rte_pmd_ixgbe_set_vf_mac_addr(uint8_t port, uint16_t vf, 59 struct ether_addr *mac_addr); 60 61 /** 62 * Enable/Disable VF VLAN anti spoofing. 63 * 64 * @param port 65 * The port identifier of the Ethernet device. 66 * @param vf 67 * VF on which to set VLAN anti spoofing. 68 * @param on 69 * 1 - Enable VFs VLAN anti spoofing. 70 * 0 - Disable VFs VLAN anti spoofing. 71 * @return 72 * - (0) if successful. 73 * - (-ENODEV) if *port* invalid. 74 * - (-EINVAL) if bad parameter. 75 */ 76 int rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on); 77 78 /** 79 * Enable/Disable VF MAC anti spoofing. 80 * 81 * @param port 82 * The port identifier of the Ethernet device. 83 * @param vf 84 * VF on which to set MAC anti spoofing. 85 * @param on 86 * 1 - Enable VFs MAC anti spoofing. 87 * 0 - Disable VFs MAC anti spoofing. 88 * @return 89 * - (0) if successful. 90 * - (-ENODEV) if *port* invalid. 91 * - (-EINVAL) if bad parameter. 92 */ 93 int rte_pmd_ixgbe_set_vf_mac_anti_spoof(uint8_t port, uint16_t vf, uint8_t on); 94 95 /** 96 * Enable/Disable vf vlan insert 97 * 98 * @param port 99 * The port identifier of the Ethernet device. 100 * @param vf 101 * ID specifying VF. 102 * @param vlan_id 103 * 0 - Disable VF's vlan insert. 104 * n - Enable; n is inserted as the vlan id. 105 * 106 * @return 107 * - (0) if successful. 108 * - (-ENODEV) if *port* invalid. 109 * - (-EINVAL) if bad parameter. 110 */ 111 int rte_pmd_ixgbe_set_vf_vlan_insert(uint8_t port, uint16_t vf, 112 uint16_t vlan_id); 113 114 /** 115 * Enable/Disable tx loopback 116 * 117 * @param port 118 * The port identifier of the Ethernet device. 119 * @param on 120 * 1 - Enable tx loopback. 121 * 0 - Disable tx loopback. 122 * 123 * @return 124 * - (0) if successful. 125 * - (-ENODEV) if *port* invalid. 126 * - (-EINVAL) if bad parameter. 127 */ 128 int rte_pmd_ixgbe_set_tx_loopback(uint8_t port, uint8_t on); 129 130 /** 131 * set all queues drop enable bit 132 * 133 * @param port 134 * The port identifier of the Ethernet device. 135 * @param on 136 * 1 - set the queue drop enable bit for all pools. 137 * 0 - reset the queue drop enable bit for all pools. 138 * 139 * @return 140 * - (0) if successful. 141 * - (-ENODEV) if *port* invalid. 142 * - (-EINVAL) if bad parameter. 143 */ 144 int rte_pmd_ixgbe_set_all_queues_drop_en(uint8_t port, uint8_t on); 145 146 /** 147 * set drop enable bit in the VF split rx control register 148 * 149 * @param port 150 * The port identifier of the Ethernet device. 151 * @param vf 152 * ID specifying VF. 153 * @param on 154 * 1 - set the drop enable bit in the split rx control register. 155 * 0 - reset the drop enable bit in the split rx control register. 156 * 157 * @return 158 * - (0) if successful. 159 * - (-ENODEV) if *port* invalid. 160 * - (-EINVAL) if bad parameter. 161 */ 162 163 int rte_pmd_ixgbe_set_vf_split_drop_en(uint8_t port, uint16_t vf, uint8_t on); 164 165 /** 166 * Enable/Disable vf vlan strip for all queues in a pool 167 * 168 * @param port 169 * The port identifier of the Ethernet device. 170 * @param vf 171 * ID specifying VF. 172 * @param on 173 * 1 - Enable VF's vlan strip on RX queues. 174 * 0 - Disable VF's vlan strip on RX queues. 175 * 176 * @return 177 * - (0) if successful. 178 * - (-ENOTSUP) if hardware doesn't support this feature. 179 * - (-ENODEV) if *port* invalid. 180 * - (-EINVAL) if bad parameter. 181 */ 182 int 183 rte_pmd_ixgbe_set_vf_vlan_stripq(uint8_t port, uint16_t vf, uint8_t on); 184 185 /** 186 * Enable MACsec offload. 187 * 188 * @param port 189 * The port identifier of the Ethernet device. 190 * @param en 191 * 1 - Enable encryption (encrypt and add integrity signature). 192 * 0 - Disable encryption (only add integrity signature). 193 * @param rp 194 * 1 - Enable replay protection. 195 * 0 - Disable replay protection. 196 * @return 197 * - (0) if successful. 198 * - (-ENODEV) if *port* invalid. 199 * - (-ENOTSUP) if hardware doesn't support this feature. 200 */ 201 int rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp); 202 203 /** 204 * Disable MACsec offload. 205 * 206 * @param port 207 * The port identifier of the Ethernet device. 208 * @return 209 * - (0) if successful. 210 * - (-ENODEV) if *port* invalid. 211 * - (-ENOTSUP) if hardware doesn't support this feature. 212 */ 213 int rte_pmd_ixgbe_macsec_disable(uint8_t port); 214 215 /** 216 * Configure Tx SC (Secure Connection). 217 * 218 * @param port 219 * The port identifier of the Ethernet device. 220 * @param mac 221 * The MAC address on the local side. 222 * @return 223 * - (0) if successful. 224 * - (-ENODEV) if *port* invalid. 225 */ 226 int rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac); 227 228 /** 229 * Configure Rx SC (Secure Connection). 230 * 231 * @param port 232 * The port identifier of the Ethernet device. 233 * @param mac 234 * The MAC address on the remote side. 235 * @param pi 236 * The PI (port identifier) on the remote side. 237 * @return 238 * - (0) if successful. 239 * - (-ENODEV) if *port* invalid. 240 */ 241 int rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi); 242 243 /** 244 * Enable Tx SA (Secure Association). 245 * 246 * @param port 247 * The port identifier of the Ethernet device. 248 * @param idx 249 * The SA to be enabled (0 or 1). 250 * @param an 251 * The association number on the local side. 252 * @param pn 253 * The packet number on the local side. 254 * @param key 255 * The key on the local side. 256 * @return 257 * - (0) if successful. 258 * - (-ENODEV) if *port* invalid. 259 * - (-EINVAL) if bad parameter. 260 */ 261 int rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an, 262 uint32_t pn, uint8_t *key); 263 264 /** 265 * Enable Rx SA (Secure Association). 266 * 267 * @param port 268 * The port identifier of the Ethernet device. 269 * @param idx 270 * The SA to be enabled (0 or 1) 271 * @param an 272 * The association number on the remote side. 273 * @param pn 274 * The packet number on the remote side. 275 * @param key 276 * The key on the remote side. 277 * @return 278 * - (0) if successful. 279 * - (-ENODEV) if *port* invalid. 280 * - (-EINVAL) if bad parameter. 281 */ 282 int rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an, 283 uint32_t pn, uint8_t *key); 284 285 /** 286 * Set RX L2 Filtering mode of a VF of an Ethernet device. 287 * 288 * @param port 289 * The port identifier of the Ethernet device. 290 * @param vf 291 * VF id. 292 * @param rx_mode 293 * The RX mode mask, which is one or more of accepting Untagged Packets, 294 * packets that match the PFUTA table, Broadcast and Multicast Promiscuous. 295 * ETH_VMDQ_ACCEPT_UNTAG,ETH_VMDQ_ACCEPT_HASH_UC, 296 * ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST will be used 297 * in rx_mode. 298 * @param on 299 * 1 - Enable a VF RX mode. 300 * 0 - Disable a VF RX mode. 301 * @return 302 * - (0) if successful. 303 * - (-ENOTSUP) if hardware doesn't support. 304 * - (-ENODEV) if *port_id* invalid. 305 * - (-EINVAL) if bad parameter. 306 */ 307 int 308 rte_pmd_ixgbe_set_vf_rxmode(uint8_t port, uint16_t vf, uint16_t rx_mask, uint8_t on); 309 310 /** 311 * Enable or disable a VF traffic receive of an Ethernet device. 312 * 313 * @param port 314 * The port identifier of the Ethernet device. 315 * @param vf 316 * VF id. 317 * @param on 318 * 1 - Enable a VF traffic receive. 319 * 0 - Disable a VF traffic receive. 320 * @return 321 * - (0) if successful. 322 * - (-ENOTSUP) if hardware doesn't support. 323 * - (-ENODEV) if *port_id* invalid. 324 * - (-EINVAL) if bad parameter. 325 */ 326 int 327 rte_pmd_ixgbe_set_vf_rx(uint8_t port, uint16_t vf, uint8_t on); 328 329 /** 330 * Enable or disable a VF traffic transmit of the Ethernet device. 331 * 332 * @param port 333 * The port identifier of the Ethernet device. 334 * @param vf 335 * VF id. 336 * @param on 337 * 1 - Enable a VF traffic transmit. 338 * 0 - Disable a VF traffic transmit. 339 * @return 340 * - (0) if successful. 341 * - (-ENODEV) if *port_id* invalid. 342 * - (-ENOTSUP) if hardware doesn't support. 343 * - (-EINVAL) if bad parameter. 344 */ 345 int 346 rte_pmd_ixgbe_set_vf_tx(uint8_t port, uint16_t vf, uint8_t on); 347 348 /** 349 * Enable/Disable hardware VF VLAN filtering by an Ethernet device of 350 * received VLAN packets tagged with a given VLAN Tag Identifier. 351 * 352 * @param port id 353 * The port identifier of the Ethernet device. 354 * @param vlan_id 355 * The VLAN Tag Identifier whose filtering must be enabled or disabled. 356 * @param vf_mask 357 * Bitmap listing which VFs participate in the VLAN filtering. 358 * @param vlan_on 359 * 1 - Enable VFs VLAN filtering. 360 * 0 - Disable VFs VLAN filtering. 361 * @return 362 * - (0) if successful. 363 * - (-ENOTSUP) if hardware doesn't support. 364 * - (-ENODEV) if *port_id* invalid. 365 * - (-EINVAL) if bad parameter. 366 */ 367 int 368 rte_pmd_ixgbe_set_vf_vlan_filter(uint8_t port, uint16_t vlan, uint64_t vf_mask, uint8_t vlan_on); 369 370 /** 371 * Set the rate limitation for a vf on an Ethernet device. 372 * 373 * @param port_id 374 * The port identifier of the Ethernet device. 375 * @param vf 376 * VF id. 377 * @param tx_rate 378 * The tx rate allocated from the total link speed for this VF id. 379 * @param q_msk 380 * The queue mask which need to set the rate. 381 * @return 382 * - (0) if successful. 383 * - (-ENOTSUP) if hardware doesn't support this feature. 384 * - (-ENODEV) if *port_id* invalid. 385 * - (-EINVAL) if bad parameter. 386 */ 387 int rte_pmd_ixgbe_set_vf_rate_limit(uint8_t port, uint16_t vf, uint16_t tx_rate, uint64_t q_msk); 388 389 /** 390 * Response sent back to ixgbe driver from user app after callback 391 */ 392 enum rte_pmd_ixgbe_mb_event_rsp { 393 RTE_PMD_IXGBE_MB_EVENT_NOOP_ACK, /**< skip mbox request and ACK */ 394 RTE_PMD_IXGBE_MB_EVENT_NOOP_NACK, /**< skip mbox request and NACK */ 395 RTE_PMD_IXGBE_MB_EVENT_PROCEED, /**< proceed with mbox request */ 396 RTE_PMD_IXGBE_MB_EVENT_MAX /**< max value of this enum */ 397 }; 398 399 /** 400 * Data sent to the user application when the callback is executed. 401 */ 402 struct rte_pmd_ixgbe_mb_event_param { 403 uint16_t vfid; /**< Virtual Function number */ 404 uint16_t msg_type; /**< VF to PF message type, defined in ixgbe_mbx.h */ 405 uint16_t retval; /**< return value */ 406 void *msg; /**< pointer to message */ 407 }; 408 #endif /* _PMD_IXGBE_H_ */ 409