Raghu Vatsavayi | f21fb3e | 2015-06-09 18:15:23 -0700 | [diff] [blame] | 1 | /********************************************************************** |
| 2 | * Author: Cavium, Inc. |
| 3 | * |
| 4 | * Contact: support@cavium.com |
| 5 | * Please include "LiquidIO" in the subject. |
| 6 | * |
| 7 | * Copyright (c) 2003-2015 Cavium, Inc. |
| 8 | * |
| 9 | * This file is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License, Version 2, as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This file is distributed in the hope that it will be useful, but |
| 14 | * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty |
| 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or |
| 16 | * NONINFRINGEMENT. See the GNU General Public License for more |
| 17 | * details. |
| 18 | * |
| 19 | * This file may also be available under a different license from Cavium. |
| 20 | * Contact Cavium, Inc. for more information |
| 21 | **********************************************************************/ |
| 22 | |
| 23 | /*! \file liquidio_common.h |
| 24 | * \brief Common: Structures and macros used in PCI-NIC package by core and |
| 25 | * host driver. |
| 26 | */ |
| 27 | |
| 28 | #ifndef __LIQUIDIO_COMMON_H__ |
| 29 | #define __LIQUIDIO_COMMON_H__ |
| 30 | |
| 31 | #include "octeon_config.h" |
| 32 | |
| 33 | #define LIQUIDIO_VERSION "1.1.9" |
| 34 | #define LIQUIDIO_MAJOR_VERSION 1 |
| 35 | #define LIQUIDIO_MINOR_VERSION 1 |
| 36 | #define LIQUIDIO_MICRO_VERSION 9 |
| 37 | |
| 38 | #define CONTROL_IQ 0 |
| 39 | /** Tag types used by Octeon cores in its work. */ |
| 40 | enum octeon_tag_type { |
| 41 | ORDERED_TAG = 0, |
| 42 | ATOMIC_TAG = 1, |
| 43 | NULL_TAG = 2, |
| 44 | NULL_NULL_TAG = 3 |
| 45 | }; |
| 46 | |
| 47 | /* pre-defined host->NIC tag values */ |
| 48 | #define LIO_CONTROL (0x11111110) |
| 49 | #define LIO_DATA(i) (0x11111111 + (i)) |
| 50 | |
| 51 | /* Opcodes used by host driver/apps to perform operations on the core. |
| 52 | * These are used to identify the major subsystem that the operation |
| 53 | * is for. |
| 54 | */ |
| 55 | #define OPCODE_CORE 0 /* used for generic core operations */ |
| 56 | #define OPCODE_NIC 1 /* used for NIC operations */ |
| 57 | #define OPCODE_LAST OPCODE_NIC |
| 58 | |
| 59 | /* Subcodes are used by host driver/apps to identify the sub-operation |
| 60 | * for the core. They only need to by unique for a given subsystem. |
| 61 | */ |
| 62 | #define OPCODE_SUBCODE(op, sub) (((op & 0x0f) << 8) | ((sub) & 0x7f)) |
| 63 | |
| 64 | /** OPCODE_CORE subcodes. For future use. */ |
| 65 | |
| 66 | /** OPCODE_NIC subcodes */ |
| 67 | |
| 68 | /* This subcode is sent by core PCI driver to indicate cores are ready. */ |
| 69 | #define OPCODE_NIC_CORE_DRV_ACTIVE 0x01 |
| 70 | #define OPCODE_NIC_NW_DATA 0x02 /* network packet data */ |
| 71 | #define OPCODE_NIC_CMD 0x03 |
| 72 | #define OPCODE_NIC_INFO 0x04 |
| 73 | #define OPCODE_NIC_PORT_STATS 0x05 |
| 74 | #define OPCODE_NIC_MDIO45 0x06 |
| 75 | #define OPCODE_NIC_TIMESTAMP 0x07 |
| 76 | #define OPCODE_NIC_INTRMOD_CFG 0x08 |
| 77 | #define OPCODE_NIC_IF_CFG 0x09 |
| 78 | |
| 79 | #define CORE_DRV_TEST_SCATTER_OP 0xFFF5 |
| 80 | |
| 81 | #define OPCODE_SLOW_PATH(rh) \ |
| 82 | (OPCODE_SUBCODE(rh->r.opcode, rh->r.subcode) != \ |
| 83 | OPCODE_SUBCODE(OPCODE_NIC, OPCODE_NIC_NW_DATA)) |
| 84 | |
| 85 | /* Application codes advertised by the core driver initialization packet. */ |
| 86 | #define CVM_DRV_APP_START 0x0 |
| 87 | #define CVM_DRV_NO_APP 0 |
| 88 | #define CVM_DRV_APP_COUNT 0x2 |
| 89 | #define CVM_DRV_BASE_APP (CVM_DRV_APP_START + 0x0) |
| 90 | #define CVM_DRV_NIC_APP (CVM_DRV_APP_START + 0x1) |
| 91 | #define CVM_DRV_INVALID_APP (CVM_DRV_APP_START + 0x2) |
| 92 | #define CVM_DRV_APP_END (CVM_DRV_INVALID_APP - 1) |
| 93 | |
| 94 | /* Macro to increment index. |
| 95 | * Index is incremented by count; if the sum exceeds |
| 96 | * max, index is wrapped-around to the start. |
| 97 | */ |
| 98 | #define INCR_INDEX(index, count, max) \ |
| 99 | do { \ |
| 100 | if (((index) + (count)) >= (max)) \ |
| 101 | index = ((index) + (count)) - (max); \ |
| 102 | else \ |
| 103 | index += (count); \ |
| 104 | } while (0) |
| 105 | |
| 106 | #define INCR_INDEX_BY1(index, max) \ |
| 107 | do { \ |
| 108 | if ((++(index)) == (max)) \ |
| 109 | index = 0; \ |
| 110 | } while (0) |
| 111 | |
| 112 | #define DECR_INDEX(index, count, max) \ |
| 113 | do { \ |
| 114 | if ((count) > (index)) \ |
| 115 | index = ((max) - ((count - index))); \ |
| 116 | else \ |
| 117 | index -= count; \ |
| 118 | } while (0) |
| 119 | |
| 120 | #define OCT_BOARD_NAME 32 |
| 121 | #define OCT_SERIAL_LEN 64 |
| 122 | |
| 123 | /* Structure used by core driver to send indication that the Octeon |
| 124 | * application is ready. |
| 125 | */ |
| 126 | struct octeon_core_setup { |
| 127 | u64 corefreq; |
| 128 | |
| 129 | char boardname[OCT_BOARD_NAME]; |
| 130 | |
| 131 | char board_serial_number[OCT_SERIAL_LEN]; |
| 132 | |
| 133 | u64 board_rev_major; |
| 134 | |
| 135 | u64 board_rev_minor; |
| 136 | |
| 137 | }; |
| 138 | |
| 139 | /*--------------------------- SCATTER GATHER ENTRY -----------------------*/ |
| 140 | |
| 141 | /* The Scatter-Gather List Entry. The scatter or gather component used with |
| 142 | * a Octeon input instruction has this format. |
| 143 | */ |
| 144 | struct octeon_sg_entry { |
| 145 | /** The first 64 bit gives the size of data in each dptr.*/ |
| 146 | union { |
| 147 | u16 size[4]; |
| 148 | u64 size64; |
| 149 | } u; |
| 150 | |
| 151 | /** The 4 dptr pointers for this entry. */ |
| 152 | u64 ptr[4]; |
| 153 | |
| 154 | }; |
| 155 | |
| 156 | #define OCT_SG_ENTRY_SIZE (sizeof(struct octeon_sg_entry)) |
| 157 | |
| 158 | /* \brief Add size to gather list |
| 159 | * @param sg_entry scatter/gather entry |
| 160 | * @param size size to add |
| 161 | * @param pos position to add it. |
| 162 | */ |
| 163 | static inline void add_sg_size(struct octeon_sg_entry *sg_entry, |
| 164 | u16 size, |
| 165 | u32 pos) |
| 166 | { |
| 167 | #ifdef __BIG_ENDIAN_BITFIELD |
| 168 | sg_entry->u.size[pos] = size; |
| 169 | #else |
| 170 | sg_entry->u.size[3 - pos] = size; |
| 171 | #endif |
| 172 | } |
| 173 | |
| 174 | /*------------------------- End Scatter/Gather ---------------------------*/ |
| 175 | |
| 176 | #define OCTNET_FRM_PTP_HEADER_SIZE 8 |
Raghu Vatsavayi | f21fb3e | 2015-06-09 18:15:23 -0700 | [diff] [blame] | 177 | |
Raghu Vatsavayi | a5b3788 | 2016-06-14 16:54:48 -0700 | [diff] [blame^] | 178 | #define OCTNET_FRM_HEADER_SIZE 22 /* VLAN + Ethernet */ |
| 179 | |
| 180 | #define OCTNET_MIN_FRM_SIZE 64 |
| 181 | |
Raghu Vatsavayi | f21fb3e | 2015-06-09 18:15:23 -0700 | [diff] [blame] | 182 | #define OCTNET_MAX_FRM_SIZE (16000 + OCTNET_FRM_HEADER_SIZE) |
| 183 | |
| 184 | #define OCTNET_DEFAULT_FRM_SIZE (1500 + OCTNET_FRM_HEADER_SIZE) |
| 185 | |
| 186 | /** NIC Commands are sent using this Octeon Input Queue */ |
| 187 | #define OCTNET_CMD_Q 0 |
| 188 | |
| 189 | /* NIC Command types */ |
| 190 | #define OCTNET_CMD_CHANGE_MTU 0x1 |
| 191 | #define OCTNET_CMD_CHANGE_MACADDR 0x2 |
| 192 | #define OCTNET_CMD_CHANGE_DEVFLAGS 0x3 |
| 193 | #define OCTNET_CMD_RX_CTL 0x4 |
| 194 | |
| 195 | #define OCTNET_CMD_SET_MULTI_LIST 0x5 |
| 196 | #define OCTNET_CMD_CLEAR_STATS 0x6 |
| 197 | |
| 198 | /* command for setting the speed, duplex & autoneg */ |
| 199 | #define OCTNET_CMD_SET_SETTINGS 0x7 |
| 200 | #define OCTNET_CMD_SET_FLOW_CTL 0x8 |
| 201 | |
| 202 | #define OCTNET_CMD_MDIO_READ_WRITE 0x9 |
| 203 | #define OCTNET_CMD_GPIO_ACCESS 0xA |
| 204 | #define OCTNET_CMD_LRO_ENABLE 0xB |
| 205 | #define OCTNET_CMD_LRO_DISABLE 0xC |
| 206 | #define OCTNET_CMD_SET_RSS 0xD |
| 207 | #define OCTNET_CMD_WRITE_SA 0xE |
| 208 | #define OCTNET_CMD_DELETE_SA 0xF |
| 209 | #define OCTNET_CMD_UPDATE_SA 0x12 |
| 210 | |
| 211 | #define OCTNET_CMD_TNL_RX_CSUM_CTL 0x10 |
| 212 | #define OCTNET_CMD_TNL_TX_CSUM_CTL 0x11 |
| 213 | #define OCTNET_CMD_IPSECV2_AH_ESP_CTL 0x13 |
| 214 | #define OCTNET_CMD_VERBOSE_ENABLE 0x14 |
| 215 | #define OCTNET_CMD_VERBOSE_DISABLE 0x15 |
| 216 | |
| 217 | /* RX(packets coming from wire) Checksum verification flags */ |
| 218 | /* TCP/UDP csum */ |
| 219 | #define CNNIC_L4SUM_VERIFIED 0x1 |
| 220 | #define CNNIC_IPSUM_VERIFIED 0x2 |
| 221 | #define CNNIC_TUN_CSUM_VERIFIED 0x4 |
| 222 | #define CNNIC_CSUM_VERIFIED (CNNIC_IPSUM_VERIFIED | CNNIC_L4SUM_VERIFIED) |
| 223 | |
| 224 | /*LROIPV4 and LROIPV6 Flags*/ |
| 225 | #define OCTNIC_LROIPV4 0x1 |
| 226 | #define OCTNIC_LROIPV6 0x2 |
| 227 | |
| 228 | /* Interface flags communicated between host driver and core app. */ |
| 229 | enum octnet_ifflags { |
| 230 | OCTNET_IFFLAG_PROMISC = 0x01, |
| 231 | OCTNET_IFFLAG_ALLMULTI = 0x02, |
| 232 | OCTNET_IFFLAG_MULTICAST = 0x04, |
| 233 | OCTNET_IFFLAG_BROADCAST = 0x08, |
| 234 | OCTNET_IFFLAG_UNICAST = 0x10 |
| 235 | }; |
| 236 | |
| 237 | /* wqe |
| 238 | * --------------- 0 |
| 239 | * | wqe word0-3 | |
| 240 | * --------------- 32 |
| 241 | * | PCI IH | |
| 242 | * --------------- 40 |
| 243 | * | RPTR | |
| 244 | * --------------- 48 |
| 245 | * | PCI IRH | |
| 246 | * --------------- 56 |
| 247 | * | OCT_NET_CMD | |
| 248 | * --------------- 64 |
| 249 | * | Addtl 8-BData | |
| 250 | * | | |
| 251 | * --------------- |
| 252 | */ |
| 253 | |
| 254 | union octnet_cmd { |
| 255 | u64 u64; |
| 256 | |
| 257 | struct { |
| 258 | #ifdef __BIG_ENDIAN_BITFIELD |
| 259 | u64 cmd:5; |
| 260 | |
| 261 | u64 more:6; /* How many udd words follow the command */ |
| 262 | |
| 263 | u64 param1:29; |
| 264 | |
| 265 | u64 param2:16; |
| 266 | |
| 267 | u64 param3:8; |
| 268 | |
| 269 | #else |
| 270 | |
| 271 | u64 param3:8; |
| 272 | |
| 273 | u64 param2:16; |
| 274 | |
| 275 | u64 param1:29; |
| 276 | |
| 277 | u64 more:6; |
| 278 | |
| 279 | u64 cmd:5; |
| 280 | |
| 281 | #endif |
| 282 | } s; |
| 283 | |
| 284 | }; |
| 285 | |
| 286 | #define OCTNET_CMD_SIZE (sizeof(union octnet_cmd)) |
| 287 | |
| 288 | /** Instruction Header */ |
| 289 | struct octeon_instr_ih { |
| 290 | #ifdef __BIG_ENDIAN_BITFIELD |
| 291 | /** Raw mode indicator 1 = RAW */ |
| 292 | u64 raw:1; |
| 293 | |
| 294 | /** Gather indicator 1=gather*/ |
| 295 | u64 gather:1; |
| 296 | |
| 297 | /** Data length OR no. of entries in gather list */ |
| 298 | u64 dlengsz:14; |
| 299 | |
| 300 | /** Front Data size */ |
| 301 | u64 fsz:6; |
| 302 | |
| 303 | /** Packet Order / Work Unit selection (1 of 8)*/ |
| 304 | u64 qos:3; |
| 305 | |
| 306 | /** Core group selection (1 of 16) */ |
| 307 | u64 grp:4; |
| 308 | |
| 309 | /** Short Raw Packet Indicator 1=short raw pkt */ |
| 310 | u64 rs:1; |
| 311 | |
| 312 | /** Tag type */ |
| 313 | u64 tagtype:2; |
| 314 | |
| 315 | /** Tag Value */ |
| 316 | u64 tag:32; |
| 317 | #else |
| 318 | /** Tag Value */ |
| 319 | u64 tag:32; |
| 320 | |
| 321 | /** Tag type */ |
| 322 | u64 tagtype:2; |
| 323 | |
| 324 | /** Short Raw Packet Indicator 1=short raw pkt */ |
| 325 | u64 rs:1; |
| 326 | |
| 327 | /** Core group selection (1 of 16) */ |
| 328 | u64 grp:4; |
| 329 | |
| 330 | /** Packet Order / Work Unit selection (1 of 8)*/ |
| 331 | u64 qos:3; |
| 332 | |
| 333 | /** Front Data size */ |
| 334 | u64 fsz:6; |
| 335 | |
| 336 | /** Data length OR no. of entries in gather list */ |
| 337 | u64 dlengsz:14; |
| 338 | |
| 339 | /** Gather indicator 1=gather*/ |
| 340 | u64 gather:1; |
| 341 | |
| 342 | /** Raw mode indicator 1 = RAW */ |
| 343 | u64 raw:1; |
| 344 | #endif |
| 345 | }; |
| 346 | |
| 347 | /** Input Request Header */ |
| 348 | struct octeon_instr_irh { |
| 349 | #ifdef __BIG_ENDIAN_BITFIELD |
| 350 | u64 opcode:4; |
| 351 | u64 rflag:1; |
| 352 | u64 subcode:7; |
| 353 | u64 len:3; |
| 354 | u64 rid:13; |
| 355 | u64 reserved:4; |
| 356 | u64 ossp:32; /* opcode/subcode specific parameters */ |
| 357 | #else |
| 358 | u64 ossp:32; /* opcode/subcode specific parameters */ |
| 359 | u64 reserved:4; |
| 360 | u64 rid:13; |
| 361 | u64 len:3; |
| 362 | u64 subcode:7; |
| 363 | u64 rflag:1; |
| 364 | u64 opcode:4; |
| 365 | #endif |
| 366 | }; |
| 367 | |
| 368 | /** Return Data Parameters */ |
| 369 | struct octeon_instr_rdp { |
| 370 | #ifdef __BIG_ENDIAN_BITFIELD |
| 371 | u64 reserved:49; |
| 372 | u64 pcie_port:3; |
| 373 | u64 rlen:12; |
| 374 | #else |
| 375 | u64 rlen:12; |
| 376 | u64 pcie_port:3; |
| 377 | u64 reserved:49; |
| 378 | #endif |
| 379 | }; |
| 380 | |
| 381 | /** Receive Header */ |
| 382 | union octeon_rh { |
| 383 | #ifdef __BIG_ENDIAN_BITFIELD |
| 384 | u64 u64; |
| 385 | struct { |
| 386 | u64 opcode:4; |
| 387 | u64 subcode:8; |
| 388 | u64 len:3; /** additional 64-bit words */ |
| 389 | u64 rid:13; /** request id in response to pkt sent by host */ |
| 390 | u64 reserved:4; |
| 391 | u64 ossp:32; /** opcode/subcode specific parameters */ |
| 392 | } r; |
| 393 | struct { |
| 394 | u64 opcode:4; |
| 395 | u64 subcode:8; |
| 396 | u64 len:3; /** additional 64-bit words */ |
| 397 | u64 rid:13; /** request id in response to pkt sent by host */ |
| 398 | u64 extra:24; |
| 399 | u64 link:8; |
| 400 | u64 csum_verified:3; /** checksum verified. */ |
| 401 | u64 has_hwtstamp:1; /** Has hardware timestamp. 1 = yes. */ |
| 402 | } r_dh; |
| 403 | struct { |
| 404 | u64 opcode:4; |
| 405 | u64 subcode:8; |
| 406 | u64 len:3; /** additional 64-bit words */ |
| 407 | u64 rid:13; /** request id in response to pkt sent by host */ |
| 408 | u64 num_gmx_ports:8; |
| 409 | u64 max_nic_ports:8; |
| 410 | u64 app_cap_flags:4; |
| 411 | u64 app_mode:16; |
| 412 | } r_core_drv_init; |
| 413 | struct { |
| 414 | u64 opcode:4; |
| 415 | u64 subcode:8; |
| 416 | u64 len:3; /** additional 64-bit words */ |
| 417 | u64 rid:13; |
| 418 | u64 reserved:4; |
| 419 | u64 extra:25; |
| 420 | u64 ifidx:7; |
| 421 | } r_nic_info; |
| 422 | #else |
| 423 | u64 u64; |
| 424 | struct { |
| 425 | u64 ossp:32; /** opcode/subcode specific parameters */ |
| 426 | u64 reserved:4; |
| 427 | u64 rid:13; /** req id in response to pkt sent by host */ |
| 428 | u64 len:3; /** additional 64-bit words */ |
| 429 | u64 subcode:8; |
| 430 | u64 opcode:4; |
| 431 | } r; |
| 432 | struct { |
| 433 | u64 has_hwtstamp:1; /** 1 = has hwtstamp */ |
| 434 | u64 csum_verified:3; /** checksum verified. */ |
| 435 | u64 link:8; |
| 436 | u64 extra:24; |
| 437 | u64 rid:13; /** req id in response to pkt sent by host */ |
| 438 | u64 len:3; /** additional 64-bit words */ |
| 439 | u64 subcode:8; |
| 440 | u64 opcode:4; |
| 441 | } r_dh; |
| 442 | struct { |
| 443 | u64 app_mode:16; |
| 444 | u64 app_cap_flags:4; |
| 445 | u64 max_nic_ports:8; |
| 446 | u64 num_gmx_ports:8; |
| 447 | u64 rid:13; |
| 448 | u64 len:3; /** additional 64-bit words */ |
| 449 | u64 subcode:8; |
| 450 | u64 opcode:4; |
| 451 | } r_core_drv_init; |
| 452 | struct { |
| 453 | u64 ifidx:7; |
| 454 | u64 extra:25; |
| 455 | u64 reserved:4; |
| 456 | u64 rid:13; |
| 457 | u64 len:3; /** additional 64-bit words */ |
| 458 | u64 subcode:8; |
| 459 | u64 opcode:4; |
| 460 | } r_nic_info; |
| 461 | #endif |
| 462 | }; |
| 463 | |
| 464 | #define OCT_RH_SIZE (sizeof(union octeon_rh)) |
| 465 | |
| 466 | #define OCT_PKT_PARAM_IPV4OPTS 1 |
| 467 | #define OCT_PKT_PARAM_IPV6EXTHDR 2 |
| 468 | |
| 469 | union octnic_packet_params { |
| 470 | u32 u32; |
| 471 | struct { |
| 472 | #ifdef __BIG_ENDIAN_BITFIELD |
| 473 | u32 reserved:6; |
| 474 | u32 tnl_csum:1; |
| 475 | u32 ip_csum:1; |
| 476 | u32 ipv4opts_ipv6exthdr:2; |
| 477 | u32 ipsec_ops:4; |
| 478 | u32 tsflag:1; |
| 479 | u32 csoffset:9; |
| 480 | u32 ifidx:8; |
| 481 | #else |
| 482 | u32 ifidx:8; |
| 483 | u32 csoffset:9; |
| 484 | u32 tsflag:1; |
| 485 | u32 ipsec_ops:4; |
| 486 | u32 ipv4opts_ipv6exthdr:2; |
| 487 | u32 ip_csum:1; |
| 488 | u32 tnl_csum:1; |
| 489 | u32 reserved:6; |
| 490 | #endif |
| 491 | } s; |
| 492 | }; |
| 493 | |
| 494 | /** Status of a RGMII Link on Octeon as seen by core driver. */ |
| 495 | union oct_link_status { |
| 496 | u64 u64; |
| 497 | |
| 498 | struct { |
| 499 | #ifdef __BIG_ENDIAN_BITFIELD |
| 500 | u64 duplex:8; |
| 501 | u64 status:8; |
| 502 | u64 mtu:16; |
| 503 | u64 speed:16; |
| 504 | u64 autoneg:1; |
| 505 | u64 interface:4; |
| 506 | u64 pause:1; |
| 507 | u64 reserved:10; |
| 508 | #else |
| 509 | u64 reserved:10; |
| 510 | u64 pause:1; |
| 511 | u64 interface:4; |
| 512 | u64 autoneg:1; |
| 513 | u64 speed:16; |
| 514 | u64 mtu:16; |
| 515 | u64 status:8; |
| 516 | u64 duplex:8; |
| 517 | #endif |
| 518 | } s; |
| 519 | }; |
| 520 | |
Raghu Vatsavayi | 26236fa | 2016-06-14 16:54:44 -0700 | [diff] [blame] | 521 | /** The txpciq info passed to host from the firmware */ |
| 522 | |
| 523 | union oct_txpciq { |
| 524 | u64 u64; |
| 525 | |
| 526 | struct { |
| 527 | #ifdef __BIG_ENDIAN_BITFIELD |
| 528 | u64 q_no:8; |
| 529 | u64 port:8; |
| 530 | u64 pkind:6; |
| 531 | u64 use_qpg:1; |
| 532 | u64 qpg:11; |
| 533 | u64 reserved:30; |
| 534 | #else |
| 535 | u64 reserved:30; |
| 536 | u64 qpg:11; |
| 537 | u64 use_qpg:1; |
| 538 | u64 pkind:6; |
| 539 | u64 port:8; |
| 540 | u64 q_no:8; |
| 541 | #endif |
| 542 | } s; |
| 543 | }; |
| 544 | |
| 545 | /** The rxpciq info passed to host from the firmware */ |
| 546 | |
| 547 | union oct_rxpciq { |
| 548 | u64 u64; |
| 549 | |
| 550 | struct { |
| 551 | #ifdef __BIG_ENDIAN_BITFIELD |
| 552 | u64 q_no:8; |
| 553 | u64 reserved:56; |
| 554 | #else |
| 555 | u64 reserved:56; |
| 556 | u64 q_no:8; |
| 557 | #endif |
| 558 | } s; |
| 559 | }; |
| 560 | |
Raghu Vatsavayi | f21fb3e | 2015-06-09 18:15:23 -0700 | [diff] [blame] | 561 | /** Information for a OCTEON ethernet interface shared between core & host. */ |
| 562 | struct oct_link_info { |
| 563 | union oct_link_status link; |
| 564 | u64 hw_addr; |
| 565 | |
| 566 | #ifdef __BIG_ENDIAN_BITFIELD |
| 567 | u16 gmxport; |
| 568 | u8 rsvd[3]; |
| 569 | u8 num_txpciq; |
| 570 | u8 num_rxpciq; |
| 571 | u8 ifidx; |
| 572 | #else |
| 573 | u8 ifidx; |
| 574 | u8 num_rxpciq; |
| 575 | u8 num_txpciq; |
| 576 | u8 rsvd[3]; |
| 577 | u16 gmxport; |
| 578 | #endif |
| 579 | |
Raghu Vatsavayi | 26236fa | 2016-06-14 16:54:44 -0700 | [diff] [blame] | 580 | union oct_txpciq txpciq[MAX_IOQS_PER_NICIF]; |
| 581 | union oct_rxpciq rxpciq[MAX_IOQS_PER_NICIF]; |
Raghu Vatsavayi | f21fb3e | 2015-06-09 18:15:23 -0700 | [diff] [blame] | 582 | }; |
| 583 | |
| 584 | #define OCT_LINK_INFO_SIZE (sizeof(struct oct_link_info)) |
| 585 | |
| 586 | struct liquidio_if_cfg_info { |
| 587 | u64 ifidx; |
| 588 | u64 iqmask; /** mask for IQs enabled for the port */ |
| 589 | u64 oqmask; /** mask for OQs enabled for the port */ |
| 590 | struct oct_link_info linfo; /** initial link information */ |
| 591 | }; |
| 592 | |
| 593 | /** Stats for each NIC port in RX direction. */ |
| 594 | struct nic_rx_stats { |
| 595 | /* link-level stats */ |
| 596 | u64 total_rcvd; |
| 597 | u64 bytes_rcvd; |
| 598 | u64 total_bcst; |
| 599 | u64 total_mcst; |
| 600 | u64 runts; |
| 601 | u64 ctl_rcvd; |
| 602 | u64 fifo_err; /* Accounts for over/under-run of buffers */ |
| 603 | u64 dmac_drop; |
| 604 | u64 fcs_err; |
| 605 | u64 jabber_err; |
| 606 | u64 l2_err; |
| 607 | u64 frame_err; |
| 608 | |
| 609 | /* firmware stats */ |
| 610 | u64 fw_total_rcvd; |
| 611 | u64 fw_total_fwd; |
| 612 | u64 fw_err_pko; |
| 613 | u64 fw_err_link; |
| 614 | u64 fw_err_drop; |
| 615 | u64 fw_lro_pkts; /* Number of packets that are LROed */ |
| 616 | u64 fw_lro_octs; /* Number of octets that are LROed */ |
| 617 | u64 fw_total_lro; /* Number of LRO packets formed */ |
| 618 | u64 fw_lro_aborts; /* Number of times lRO of packet aborted */ |
| 619 | /* intrmod: packet forward rate */ |
| 620 | u64 fwd_rate; |
| 621 | }; |
| 622 | |
| 623 | /** Stats for each NIC port in RX direction. */ |
| 624 | struct nic_tx_stats { |
| 625 | /* link-level stats */ |
| 626 | u64 total_pkts_sent; |
| 627 | u64 total_bytes_sent; |
| 628 | u64 mcast_pkts_sent; |
| 629 | u64 bcast_pkts_sent; |
| 630 | u64 ctl_sent; |
| 631 | u64 one_collision_sent; /* Packets sent after one collision*/ |
| 632 | u64 multi_collision_sent; /* Packets sent after multiple collision*/ |
| 633 | u64 max_collision_fail; /* Packets not sent due to max collisions */ |
| 634 | u64 max_deferral_fail; /* Packets not sent due to max deferrals */ |
| 635 | u64 fifo_err; /* Accounts for over/under-run of buffers */ |
| 636 | u64 runts; |
| 637 | u64 total_collisions; /* Total number of collisions detected */ |
| 638 | |
| 639 | /* firmware stats */ |
| 640 | u64 fw_total_sent; |
| 641 | u64 fw_total_fwd; |
| 642 | u64 fw_err_pko; |
| 643 | u64 fw_err_link; |
| 644 | u64 fw_err_drop; |
| 645 | }; |
| 646 | |
| 647 | struct oct_link_stats { |
| 648 | struct nic_rx_stats fromwire; |
| 649 | struct nic_tx_stats fromhost; |
| 650 | |
| 651 | }; |
| 652 | |
| 653 | #define LIO68XX_LED_CTRL_ADDR 0x3501 |
| 654 | #define LIO68XX_LED_CTRL_CFGON 0x1f |
| 655 | #define LIO68XX_LED_CTRL_CFGOFF 0x100 |
| 656 | #define LIO68XX_LED_BEACON_ADDR 0x3508 |
| 657 | #define LIO68XX_LED_BEACON_CFGON 0x47fd |
| 658 | #define LIO68XX_LED_BEACON_CFGOFF 0x11fc |
| 659 | #define VITESSE_PHY_GPIO_DRIVEON 0x1 |
| 660 | #define VITESSE_PHY_GPIO_CFG 0x8 |
| 661 | #define VITESSE_PHY_GPIO_DRIVEOFF 0x4 |
| 662 | #define VITESSE_PHY_GPIO_HIGH 0x2 |
| 663 | #define VITESSE_PHY_GPIO_LOW 0x3 |
| 664 | |
| 665 | struct oct_mdio_cmd { |
| 666 | u64 op; |
| 667 | u64 mdio_addr; |
| 668 | u64 value1; |
| 669 | u64 value2; |
| 670 | u64 value3; |
| 671 | }; |
| 672 | |
| 673 | #define OCT_LINK_STATS_SIZE (sizeof(struct oct_link_stats)) |
| 674 | |
| 675 | #define LIO_INTRMOD_CHECK_INTERVAL 1 |
| 676 | #define LIO_INTRMOD_MAXPKT_RATETHR 196608 /* max pkt rate threshold */ |
| 677 | #define LIO_INTRMOD_MINPKT_RATETHR 9216 /* min pkt rate threshold */ |
| 678 | #define LIO_INTRMOD_MAXCNT_TRIGGER 384 /* max pkts to trigger interrupt */ |
| 679 | #define LIO_INTRMOD_MINCNT_TRIGGER 1 /* min pkts to trigger interrupt */ |
| 680 | #define LIO_INTRMOD_MAXTMR_TRIGGER 128 /* max time to trigger interrupt */ |
| 681 | #define LIO_INTRMOD_MINTMR_TRIGGER 32 /* min time to trigger interrupt */ |
| 682 | |
| 683 | struct oct_intrmod_cfg { |
| 684 | u64 intrmod_enable; |
| 685 | u64 intrmod_check_intrvl; |
| 686 | u64 intrmod_maxpkt_ratethr; |
| 687 | u64 intrmod_minpkt_ratethr; |
| 688 | u64 intrmod_maxcnt_trigger; |
| 689 | u64 intrmod_maxtmr_trigger; |
| 690 | u64 intrmod_mincnt_trigger; |
| 691 | u64 intrmod_mintmr_trigger; |
| 692 | }; |
| 693 | |
| 694 | #define BASE_QUEUE_NOT_REQUESTED 65535 |
| 695 | |
| 696 | union oct_nic_if_cfg { |
| 697 | u64 u64; |
| 698 | struct { |
| 699 | #ifdef __BIG_ENDIAN_BITFIELD |
| 700 | u64 base_queue:16; |
| 701 | u64 num_iqueues:16; |
| 702 | u64 num_oqueues:16; |
| 703 | u64 gmx_port_id:8; |
| 704 | u64 reserved:8; |
| 705 | #else |
| 706 | u64 reserved:8; |
| 707 | u64 gmx_port_id:8; |
| 708 | u64 num_oqueues:16; |
| 709 | u64 num_iqueues:16; |
| 710 | u64 base_queue:16; |
| 711 | #endif |
| 712 | } s; |
| 713 | }; |
| 714 | |
| 715 | #endif |