1619c5cb6SVlad Zolotarov /* bnx2x_sp.h: Broadcom Everest network driver. 2619c5cb6SVlad Zolotarov * 3247fa82bSYuval Mintz * Copyright (c) 2011-2013 Broadcom Corporation 4619c5cb6SVlad Zolotarov * 5619c5cb6SVlad Zolotarov * Unless you and Broadcom execute a separate written software license 6619c5cb6SVlad Zolotarov * agreement governing use of this software, this software is licensed to you 7619c5cb6SVlad Zolotarov * under the terms of the GNU General Public License version 2, available 8619c5cb6SVlad Zolotarov * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL"). 9619c5cb6SVlad Zolotarov * 10619c5cb6SVlad Zolotarov * Notwithstanding the above, under no circumstances may you combine this 11619c5cb6SVlad Zolotarov * software in any way with any other Broadcom software provided under a 12619c5cb6SVlad Zolotarov * license other than the GPL, without Broadcom's express prior written 13619c5cb6SVlad Zolotarov * consent. 14619c5cb6SVlad Zolotarov * 15*08f6dd89SAriel Elior * Maintained by: Ariel Elior <ariel.elior@qlogic.com> 16619c5cb6SVlad Zolotarov * Written by: Vladislav Zolotarov 17619c5cb6SVlad Zolotarov * 18619c5cb6SVlad Zolotarov */ 19619c5cb6SVlad Zolotarov #ifndef BNX2X_SP_VERBS 20619c5cb6SVlad Zolotarov #define BNX2X_SP_VERBS 21042181f5SVladislav Zolotarov 22619c5cb6SVlad Zolotarov struct bnx2x; 23619c5cb6SVlad Zolotarov struct eth_context; 24042181f5SVladislav Zolotarov 25619c5cb6SVlad Zolotarov /* Bits representing general command's configuration */ 26619c5cb6SVlad Zolotarov enum { 27619c5cb6SVlad Zolotarov RAMROD_TX, 28619c5cb6SVlad Zolotarov RAMROD_RX, 29619c5cb6SVlad Zolotarov /* Wait until all pending commands complete */ 30619c5cb6SVlad Zolotarov RAMROD_COMP_WAIT, 31619c5cb6SVlad Zolotarov /* Don't send a ramrod, only update a registry */ 32619c5cb6SVlad Zolotarov RAMROD_DRV_CLR_ONLY, 33619c5cb6SVlad Zolotarov /* Configure HW according to the current object state */ 34619c5cb6SVlad Zolotarov RAMROD_RESTORE, 35619c5cb6SVlad Zolotarov /* Execute the next command now */ 36619c5cb6SVlad Zolotarov RAMROD_EXEC, 3716a5fd92SYuval Mintz /* Don't add a new command and continue execution of postponed 38619c5cb6SVlad Zolotarov * commands. If not set a new command will be added to the 39619c5cb6SVlad Zolotarov * pending commands list. 40619c5cb6SVlad Zolotarov */ 41619c5cb6SVlad Zolotarov RAMROD_CONT, 4255c11941SMerav Sicron /* If there is another pending ramrod, wait until it finishes and 4355c11941SMerav Sicron * re-try to submit this one. This flag can be set only in sleepable 4455c11941SMerav Sicron * context, and should not be set from the context that completes the 4555c11941SMerav Sicron * ramrods as deadlock will occur. 4655c11941SMerav Sicron */ 4755c11941SMerav Sicron RAMROD_RETRY, 48619c5cb6SVlad Zolotarov }; 49042181f5SVladislav Zolotarov 50619c5cb6SVlad Zolotarov typedef enum { 51619c5cb6SVlad Zolotarov BNX2X_OBJ_TYPE_RX, 52619c5cb6SVlad Zolotarov BNX2X_OBJ_TYPE_TX, 53619c5cb6SVlad Zolotarov BNX2X_OBJ_TYPE_RX_TX, 54619c5cb6SVlad Zolotarov } bnx2x_obj_type; 55042181f5SVladislav Zolotarov 562de67439SYuval Mintz /* Public slow path states */ 57619c5cb6SVlad Zolotarov enum { 58619c5cb6SVlad Zolotarov BNX2X_FILTER_MAC_PENDING, 59619c5cb6SVlad Zolotarov BNX2X_FILTER_VLAN_PENDING, 60619c5cb6SVlad Zolotarov BNX2X_FILTER_VLAN_MAC_PENDING, 61619c5cb6SVlad Zolotarov BNX2X_FILTER_RX_MODE_PENDING, 62619c5cb6SVlad Zolotarov BNX2X_FILTER_RX_MODE_SCHED, 63619c5cb6SVlad Zolotarov BNX2X_FILTER_ISCSI_ETH_START_SCHED, 64619c5cb6SVlad Zolotarov BNX2X_FILTER_ISCSI_ETH_STOP_SCHED, 65619c5cb6SVlad Zolotarov BNX2X_FILTER_FCOE_ETH_START_SCHED, 66619c5cb6SVlad Zolotarov BNX2X_FILTER_FCOE_ETH_STOP_SCHED, 67619c5cb6SVlad Zolotarov BNX2X_FILTER_MCAST_PENDING, 68619c5cb6SVlad Zolotarov BNX2X_FILTER_MCAST_SCHED, 69619c5cb6SVlad Zolotarov BNX2X_FILTER_RSS_CONF_PENDING, 70a3348722SBarak Witkowski BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, 71a3348722SBarak Witkowski BNX2X_AFEX_PENDING_VIFSET_MCP_ACK 72619c5cb6SVlad Zolotarov }; 73042181f5SVladislav Zolotarov 74619c5cb6SVlad Zolotarov struct bnx2x_raw_obj { 75619c5cb6SVlad Zolotarov u8 func_id; 76042181f5SVladislav Zolotarov 77619c5cb6SVlad Zolotarov /* Queue params */ 78619c5cb6SVlad Zolotarov u8 cl_id; 79619c5cb6SVlad Zolotarov u32 cid; 80042181f5SVladislav Zolotarov 81619c5cb6SVlad Zolotarov /* Ramrod data buffer params */ 82619c5cb6SVlad Zolotarov void *rdata; 83619c5cb6SVlad Zolotarov dma_addr_t rdata_mapping; 84619c5cb6SVlad Zolotarov 85619c5cb6SVlad Zolotarov /* Ramrod state params */ 86619c5cb6SVlad Zolotarov int state; /* "ramrod is pending" state bit */ 87619c5cb6SVlad Zolotarov unsigned long *pstate; /* pointer to state buffer */ 88619c5cb6SVlad Zolotarov 89619c5cb6SVlad Zolotarov bnx2x_obj_type obj_type; 90619c5cb6SVlad Zolotarov 91619c5cb6SVlad Zolotarov int (*wait_comp)(struct bnx2x *bp, 92619c5cb6SVlad Zolotarov struct bnx2x_raw_obj *o); 93619c5cb6SVlad Zolotarov 94619c5cb6SVlad Zolotarov bool (*check_pending)(struct bnx2x_raw_obj *o); 95619c5cb6SVlad Zolotarov void (*clear_pending)(struct bnx2x_raw_obj *o); 96619c5cb6SVlad Zolotarov void (*set_pending)(struct bnx2x_raw_obj *o); 97619c5cb6SVlad Zolotarov }; 98619c5cb6SVlad Zolotarov 99619c5cb6SVlad Zolotarov /************************* VLAN-MAC commands related parameters ***************/ 100619c5cb6SVlad Zolotarov struct bnx2x_mac_ramrod_data { 101619c5cb6SVlad Zolotarov u8 mac[ETH_ALEN]; 10291226790SDmitry Kravkov u8 is_inner_mac; 103619c5cb6SVlad Zolotarov }; 104619c5cb6SVlad Zolotarov 105619c5cb6SVlad Zolotarov struct bnx2x_vlan_ramrod_data { 106619c5cb6SVlad Zolotarov u16 vlan; 107619c5cb6SVlad Zolotarov }; 108619c5cb6SVlad Zolotarov 109619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_ramrod_data { 110619c5cb6SVlad Zolotarov u8 mac[ETH_ALEN]; 11191226790SDmitry Kravkov u8 is_inner_mac; 112619c5cb6SVlad Zolotarov u16 vlan; 113619c5cb6SVlad Zolotarov }; 114619c5cb6SVlad Zolotarov 115619c5cb6SVlad Zolotarov union bnx2x_classification_ramrod_data { 116619c5cb6SVlad Zolotarov struct bnx2x_mac_ramrod_data mac; 117619c5cb6SVlad Zolotarov struct bnx2x_vlan_ramrod_data vlan; 118619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_ramrod_data vlan_mac; 119619c5cb6SVlad Zolotarov }; 120619c5cb6SVlad Zolotarov 121619c5cb6SVlad Zolotarov /* VLAN_MAC commands */ 122619c5cb6SVlad Zolotarov enum bnx2x_vlan_mac_cmd { 123619c5cb6SVlad Zolotarov BNX2X_VLAN_MAC_ADD, 124619c5cb6SVlad Zolotarov BNX2X_VLAN_MAC_DEL, 125619c5cb6SVlad Zolotarov BNX2X_VLAN_MAC_MOVE, 126619c5cb6SVlad Zolotarov }; 127619c5cb6SVlad Zolotarov 128619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_data { 129619c5cb6SVlad Zolotarov /* Requested command: BNX2X_VLAN_MAC_XX */ 130619c5cb6SVlad Zolotarov enum bnx2x_vlan_mac_cmd cmd; 13116a5fd92SYuval Mintz /* used to contain the data related vlan_mac_flags bits from 132619c5cb6SVlad Zolotarov * ramrod parameters. 133619c5cb6SVlad Zolotarov */ 134619c5cb6SVlad Zolotarov unsigned long vlan_mac_flags; 135619c5cb6SVlad Zolotarov 136619c5cb6SVlad Zolotarov /* Needed for MOVE command */ 137619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj *target_obj; 138619c5cb6SVlad Zolotarov 139619c5cb6SVlad Zolotarov union bnx2x_classification_ramrod_data u; 140619c5cb6SVlad Zolotarov }; 141619c5cb6SVlad Zolotarov 142619c5cb6SVlad Zolotarov /*************************** Exe Queue obj ************************************/ 143619c5cb6SVlad Zolotarov union bnx2x_exe_queue_cmd_data { 144619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_data vlan_mac; 145619c5cb6SVlad Zolotarov 146619c5cb6SVlad Zolotarov struct { 147619c5cb6SVlad Zolotarov /* TODO */ 148619c5cb6SVlad Zolotarov } mcast; 149619c5cb6SVlad Zolotarov }; 150619c5cb6SVlad Zolotarov 151619c5cb6SVlad Zolotarov struct bnx2x_exeq_elem { 152619c5cb6SVlad Zolotarov struct list_head link; 153619c5cb6SVlad Zolotarov 154619c5cb6SVlad Zolotarov /* Length of this element in the exe_chunk. */ 155619c5cb6SVlad Zolotarov int cmd_len; 156619c5cb6SVlad Zolotarov 157619c5cb6SVlad Zolotarov union bnx2x_exe_queue_cmd_data cmd_data; 158619c5cb6SVlad Zolotarov }; 159619c5cb6SVlad Zolotarov 160619c5cb6SVlad Zolotarov union bnx2x_qable_obj; 161619c5cb6SVlad Zolotarov 162619c5cb6SVlad Zolotarov union bnx2x_exeq_comp_elem { 163619c5cb6SVlad Zolotarov union event_ring_elem *elem; 164619c5cb6SVlad Zolotarov }; 165619c5cb6SVlad Zolotarov 166619c5cb6SVlad Zolotarov struct bnx2x_exe_queue_obj; 167619c5cb6SVlad Zolotarov 168619c5cb6SVlad Zolotarov typedef int (*exe_q_validate)(struct bnx2x *bp, 169619c5cb6SVlad Zolotarov union bnx2x_qable_obj *o, 170619c5cb6SVlad Zolotarov struct bnx2x_exeq_elem *elem); 171619c5cb6SVlad Zolotarov 172460a25cdSYuval Mintz typedef int (*exe_q_remove)(struct bnx2x *bp, 173460a25cdSYuval Mintz union bnx2x_qable_obj *o, 174460a25cdSYuval Mintz struct bnx2x_exeq_elem *elem); 175460a25cdSYuval Mintz 1761aa8b471SBen Hutchings /* Return positive if entry was optimized, 0 - if not, negative 177619c5cb6SVlad Zolotarov * in case of an error. 178619c5cb6SVlad Zolotarov */ 179619c5cb6SVlad Zolotarov typedef int (*exe_q_optimize)(struct bnx2x *bp, 180619c5cb6SVlad Zolotarov union bnx2x_qable_obj *o, 181619c5cb6SVlad Zolotarov struct bnx2x_exeq_elem *elem); 182619c5cb6SVlad Zolotarov typedef int (*exe_q_execute)(struct bnx2x *bp, 183619c5cb6SVlad Zolotarov union bnx2x_qable_obj *o, 184619c5cb6SVlad Zolotarov struct list_head *exe_chunk, 185619c5cb6SVlad Zolotarov unsigned long *ramrod_flags); 186619c5cb6SVlad Zolotarov typedef struct bnx2x_exeq_elem * 187619c5cb6SVlad Zolotarov (*exe_q_get)(struct bnx2x_exe_queue_obj *o, 188619c5cb6SVlad Zolotarov struct bnx2x_exeq_elem *elem); 189619c5cb6SVlad Zolotarov 190619c5cb6SVlad Zolotarov struct bnx2x_exe_queue_obj { 19116a5fd92SYuval Mintz /* Commands pending for an execution. */ 192619c5cb6SVlad Zolotarov struct list_head exe_queue; 193619c5cb6SVlad Zolotarov 19416a5fd92SYuval Mintz /* Commands pending for an completion. */ 195619c5cb6SVlad Zolotarov struct list_head pending_comp; 196619c5cb6SVlad Zolotarov 197619c5cb6SVlad Zolotarov spinlock_t lock; 198619c5cb6SVlad Zolotarov 199619c5cb6SVlad Zolotarov /* Maximum length of commands' list for one execution */ 200619c5cb6SVlad Zolotarov int exe_chunk_len; 201619c5cb6SVlad Zolotarov 202619c5cb6SVlad Zolotarov union bnx2x_qable_obj *owner; 203619c5cb6SVlad Zolotarov 204619c5cb6SVlad Zolotarov /****** Virtual functions ******/ 205619c5cb6SVlad Zolotarov /** 206619c5cb6SVlad Zolotarov * Called before commands execution for commands that are really 207619c5cb6SVlad Zolotarov * going to be executed (after 'optimize'). 208619c5cb6SVlad Zolotarov * 209619c5cb6SVlad Zolotarov * Must run under exe_queue->lock 210619c5cb6SVlad Zolotarov */ 211619c5cb6SVlad Zolotarov exe_q_validate validate; 212619c5cb6SVlad Zolotarov 213460a25cdSYuval Mintz /** 214460a25cdSYuval Mintz * Called before removing pending commands, cleaning allocated 215460a25cdSYuval Mintz * resources (e.g., credits from validate) 216460a25cdSYuval Mintz */ 217460a25cdSYuval Mintz exe_q_remove remove; 218619c5cb6SVlad Zolotarov 219619c5cb6SVlad Zolotarov /** 220619c5cb6SVlad Zolotarov * This will try to cancel the current pending commands list 221619c5cb6SVlad Zolotarov * considering the new command. 222619c5cb6SVlad Zolotarov * 223460a25cdSYuval Mintz * Returns the number of optimized commands or a negative error code 224460a25cdSYuval Mintz * 225619c5cb6SVlad Zolotarov * Must run under exe_queue->lock 226619c5cb6SVlad Zolotarov */ 227619c5cb6SVlad Zolotarov exe_q_optimize optimize; 228619c5cb6SVlad Zolotarov 229619c5cb6SVlad Zolotarov /** 230619c5cb6SVlad Zolotarov * Run the next commands chunk (owner specific). 231619c5cb6SVlad Zolotarov */ 232619c5cb6SVlad Zolotarov exe_q_execute execute; 233619c5cb6SVlad Zolotarov 234619c5cb6SVlad Zolotarov /** 235619c5cb6SVlad Zolotarov * Return the exe_queue element containing the specific command 236619c5cb6SVlad Zolotarov * if any. Otherwise return NULL. 237619c5cb6SVlad Zolotarov */ 238619c5cb6SVlad Zolotarov exe_q_get get; 239619c5cb6SVlad Zolotarov }; 240619c5cb6SVlad Zolotarov /***************** Classification verbs: Set/Del MAC/VLAN/VLAN-MAC ************/ 241619c5cb6SVlad Zolotarov /* 24216a5fd92SYuval Mintz * Element in the VLAN_MAC registry list having all currently configured 243619c5cb6SVlad Zolotarov * rules. 244619c5cb6SVlad Zolotarov */ 245619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_registry_elem { 246619c5cb6SVlad Zolotarov struct list_head link; 247619c5cb6SVlad Zolotarov 24816a5fd92SYuval Mintz /* Used to store the cam offset used for the mac/vlan/vlan-mac. 249619c5cb6SVlad Zolotarov * Relevant for 57710 and 57711 only. VLANs and MACs share the 250619c5cb6SVlad Zolotarov * same CAM for these chips. 251619c5cb6SVlad Zolotarov */ 252619c5cb6SVlad Zolotarov int cam_offset; 253619c5cb6SVlad Zolotarov 254619c5cb6SVlad Zolotarov /* Needed for DEL and RESTORE flows */ 255619c5cb6SVlad Zolotarov unsigned long vlan_mac_flags; 256619c5cb6SVlad Zolotarov 257619c5cb6SVlad Zolotarov union bnx2x_classification_ramrod_data u; 258619c5cb6SVlad Zolotarov }; 259619c5cb6SVlad Zolotarov 260619c5cb6SVlad Zolotarov /* Bits representing VLAN_MAC commands specific flags */ 261619c5cb6SVlad Zolotarov enum { 262619c5cb6SVlad Zolotarov BNX2X_UC_LIST_MAC, 263619c5cb6SVlad Zolotarov BNX2X_ETH_MAC, 264619c5cb6SVlad Zolotarov BNX2X_ISCSI_ETH_MAC, 265619c5cb6SVlad Zolotarov BNX2X_NETQ_ETH_MAC, 266619c5cb6SVlad Zolotarov BNX2X_DONT_CONSUME_CAM_CREDIT, 267619c5cb6SVlad Zolotarov BNX2X_DONT_CONSUME_CAM_CREDIT_DEST, 268619c5cb6SVlad Zolotarov }; 269e8379c79SYuval Mintz /* When looking for matching filters, some flags are not interesting */ 270e8379c79SYuval Mintz #define BNX2X_VLAN_MAC_CMP_MASK (1 << BNX2X_UC_LIST_MAC | \ 271e8379c79SYuval Mintz 1 << BNX2X_ETH_MAC | \ 272e8379c79SYuval Mintz 1 << BNX2X_ISCSI_ETH_MAC | \ 273e8379c79SYuval Mintz 1 << BNX2X_NETQ_ETH_MAC) 274e8379c79SYuval Mintz #define BNX2X_VLAN_MAC_CMP_FLAGS(flags) \ 275e8379c79SYuval Mintz ((flags) & BNX2X_VLAN_MAC_CMP_MASK) 276619c5cb6SVlad Zolotarov 277619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_ramrod_params { 278619c5cb6SVlad Zolotarov /* Object to run the command from */ 279619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj *vlan_mac_obj; 280619c5cb6SVlad Zolotarov 281619c5cb6SVlad Zolotarov /* General command flags: COMP_WAIT, etc. */ 282619c5cb6SVlad Zolotarov unsigned long ramrod_flags; 283619c5cb6SVlad Zolotarov 284619c5cb6SVlad Zolotarov /* Command specific configuration request */ 285619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_data user_req; 286619c5cb6SVlad Zolotarov }; 287619c5cb6SVlad Zolotarov 288619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj { 289619c5cb6SVlad Zolotarov struct bnx2x_raw_obj raw; 290619c5cb6SVlad Zolotarov 291619c5cb6SVlad Zolotarov /* Bookkeeping list: will prevent the addition of already existing 292619c5cb6SVlad Zolotarov * entries. 293619c5cb6SVlad Zolotarov */ 294619c5cb6SVlad Zolotarov struct list_head head; 2958b09be5fSYuval Mintz /* Implement a simple reader/writer lock on the head list. 2968b09be5fSYuval Mintz * all these fields should only be accessed under the exe_queue lock 2978b09be5fSYuval Mintz */ 2988b09be5fSYuval Mintz u8 head_reader; /* Num. of readers accessing head list */ 2998b09be5fSYuval Mintz bool head_exe_request; /* Pending execution request. */ 3008b09be5fSYuval Mintz unsigned long saved_ramrod_flags; /* Ramrods of pending execution */ 301619c5cb6SVlad Zolotarov 302619c5cb6SVlad Zolotarov /* TODO: Add it's initialization in the init functions */ 303619c5cb6SVlad Zolotarov struct bnx2x_exe_queue_obj exe_queue; 304619c5cb6SVlad Zolotarov 305619c5cb6SVlad Zolotarov /* MACs credit pool */ 306619c5cb6SVlad Zolotarov struct bnx2x_credit_pool_obj *macs_pool; 307619c5cb6SVlad Zolotarov 308619c5cb6SVlad Zolotarov /* VLANs credit pool */ 309619c5cb6SVlad Zolotarov struct bnx2x_credit_pool_obj *vlans_pool; 310619c5cb6SVlad Zolotarov 311619c5cb6SVlad Zolotarov /* RAMROD command to be used */ 312619c5cb6SVlad Zolotarov int ramrod_cmd; 313619c5cb6SVlad Zolotarov 314ed5162a0SAriel Elior /* copy first n elements onto preallocated buffer 315ed5162a0SAriel Elior * 316ed5162a0SAriel Elior * @param n number of elements to get 317ed5162a0SAriel Elior * @param buf buffer preallocated by caller into which elements 318ed5162a0SAriel Elior * will be copied. Note elements are 4-byte aligned 31916a5fd92SYuval Mintz * so buffer size must be able to accommodate the 320ed5162a0SAriel Elior * aligned elements. 321ed5162a0SAriel Elior * 322ed5162a0SAriel Elior * @return number of copied bytes 323ed5162a0SAriel Elior */ 3243ec9f9caSAriel Elior int (*get_n_elements)(struct bnx2x *bp, 3253ec9f9caSAriel Elior struct bnx2x_vlan_mac_obj *o, int n, u8 *base, 3263ec9f9caSAriel Elior u8 stride, u8 size); 327ed5162a0SAriel Elior 328619c5cb6SVlad Zolotarov /** 329619c5cb6SVlad Zolotarov * Checks if ADD-ramrod with the given params may be performed. 330619c5cb6SVlad Zolotarov * 331619c5cb6SVlad Zolotarov * @return zero if the element may be added 332619c5cb6SVlad Zolotarov */ 333619c5cb6SVlad Zolotarov 33451c1a580SMerav Sicron int (*check_add)(struct bnx2x *bp, 33551c1a580SMerav Sicron struct bnx2x_vlan_mac_obj *o, 336619c5cb6SVlad Zolotarov union bnx2x_classification_ramrod_data *data); 337619c5cb6SVlad Zolotarov 338619c5cb6SVlad Zolotarov /** 339619c5cb6SVlad Zolotarov * Checks if DEL-ramrod with the given params may be performed. 340619c5cb6SVlad Zolotarov * 341619c5cb6SVlad Zolotarov * @return true if the element may be deleted 342619c5cb6SVlad Zolotarov */ 343619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_registry_elem * 34451c1a580SMerav Sicron (*check_del)(struct bnx2x *bp, 34551c1a580SMerav Sicron struct bnx2x_vlan_mac_obj *o, 346619c5cb6SVlad Zolotarov union bnx2x_classification_ramrod_data *data); 347619c5cb6SVlad Zolotarov 348619c5cb6SVlad Zolotarov /** 349619c5cb6SVlad Zolotarov * Checks if DEL-ramrod with the given params may be performed. 350619c5cb6SVlad Zolotarov * 351619c5cb6SVlad Zolotarov * @return true if the element may be deleted 352619c5cb6SVlad Zolotarov */ 35351c1a580SMerav Sicron bool (*check_move)(struct bnx2x *bp, 35451c1a580SMerav Sicron struct bnx2x_vlan_mac_obj *src_o, 355619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj *dst_o, 356619c5cb6SVlad Zolotarov union bnx2x_classification_ramrod_data *data); 357619c5cb6SVlad Zolotarov 358619c5cb6SVlad Zolotarov /** 359619c5cb6SVlad Zolotarov * Update the relevant credit object(s) (consume/return 360619c5cb6SVlad Zolotarov * correspondingly). 361619c5cb6SVlad Zolotarov */ 362619c5cb6SVlad Zolotarov bool (*get_credit)(struct bnx2x_vlan_mac_obj *o); 363619c5cb6SVlad Zolotarov bool (*put_credit)(struct bnx2x_vlan_mac_obj *o); 364619c5cb6SVlad Zolotarov bool (*get_cam_offset)(struct bnx2x_vlan_mac_obj *o, int *offset); 365619c5cb6SVlad Zolotarov bool (*put_cam_offset)(struct bnx2x_vlan_mac_obj *o, int offset); 366619c5cb6SVlad Zolotarov 367619c5cb6SVlad Zolotarov /** 368619c5cb6SVlad Zolotarov * Configures one rule in the ramrod data buffer. 369619c5cb6SVlad Zolotarov */ 370619c5cb6SVlad Zolotarov void (*set_one_rule)(struct bnx2x *bp, 371619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj *o, 372619c5cb6SVlad Zolotarov struct bnx2x_exeq_elem *elem, int rule_idx, 373619c5cb6SVlad Zolotarov int cam_offset); 374619c5cb6SVlad Zolotarov 375619c5cb6SVlad Zolotarov /** 376619c5cb6SVlad Zolotarov * Delete all configured elements having the given 377619c5cb6SVlad Zolotarov * vlan_mac_flags specification. Assumes no pending for 378619c5cb6SVlad Zolotarov * execution commands. Will schedule all all currently 379619c5cb6SVlad Zolotarov * configured MACs/VLANs/VLAN-MACs matching the vlan_mac_flags 380619c5cb6SVlad Zolotarov * specification for deletion and will use the given 381619c5cb6SVlad Zolotarov * ramrod_flags for the last DEL operation. 382619c5cb6SVlad Zolotarov * 383619c5cb6SVlad Zolotarov * @param bp 384619c5cb6SVlad Zolotarov * @param o 385619c5cb6SVlad Zolotarov * @param ramrod_flags RAMROD_XX flags 386619c5cb6SVlad Zolotarov * 387619c5cb6SVlad Zolotarov * @return 0 if the last operation has completed successfully 388619c5cb6SVlad Zolotarov * and there are no more elements left, positive value 389619c5cb6SVlad Zolotarov * if there are pending for completion commands, 390619c5cb6SVlad Zolotarov * negative value in case of failure. 391619c5cb6SVlad Zolotarov */ 392619c5cb6SVlad Zolotarov int (*delete_all)(struct bnx2x *bp, 393619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj *o, 394619c5cb6SVlad Zolotarov unsigned long *vlan_mac_flags, 395619c5cb6SVlad Zolotarov unsigned long *ramrod_flags); 396619c5cb6SVlad Zolotarov 397619c5cb6SVlad Zolotarov /** 398619c5cb6SVlad Zolotarov * Reconfigures the next MAC/VLAN/VLAN-MAC element from the previously 399619c5cb6SVlad Zolotarov * configured elements list. 400619c5cb6SVlad Zolotarov * 401619c5cb6SVlad Zolotarov * @param bp 402619c5cb6SVlad Zolotarov * @param p Command parameters (RAMROD_COMP_WAIT bit in 403619c5cb6SVlad Zolotarov * ramrod_flags is only taken into an account) 40416a5fd92SYuval Mintz * @param ppos a pointer to the cookie that should be given back in the 405619c5cb6SVlad Zolotarov * next call to make function handle the next element. If 406619c5cb6SVlad Zolotarov * *ppos is set to NULL it will restart the iterator. 407619c5cb6SVlad Zolotarov * If returned *ppos == NULL this means that the last 408619c5cb6SVlad Zolotarov * element has been handled. 409619c5cb6SVlad Zolotarov * 410619c5cb6SVlad Zolotarov * @return int 411619c5cb6SVlad Zolotarov */ 412619c5cb6SVlad Zolotarov int (*restore)(struct bnx2x *bp, 413619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_ramrod_params *p, 414619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_registry_elem **ppos); 415619c5cb6SVlad Zolotarov 416619c5cb6SVlad Zolotarov /** 41716a5fd92SYuval Mintz * Should be called on a completion arrival. 418619c5cb6SVlad Zolotarov * 419619c5cb6SVlad Zolotarov * @param bp 420619c5cb6SVlad Zolotarov * @param o 421619c5cb6SVlad Zolotarov * @param cqe Completion element we are handling 422619c5cb6SVlad Zolotarov * @param ramrod_flags if RAMROD_CONT is set the next bulk of 423619c5cb6SVlad Zolotarov * pending commands will be executed. 424619c5cb6SVlad Zolotarov * RAMROD_DRV_CLR_ONLY and RAMROD_RESTORE 425619c5cb6SVlad Zolotarov * may also be set if needed. 426619c5cb6SVlad Zolotarov * 427619c5cb6SVlad Zolotarov * @return 0 if there are neither pending nor waiting for 428619c5cb6SVlad Zolotarov * completion commands. Positive value if there are 429619c5cb6SVlad Zolotarov * pending for execution or for completion commands. 430619c5cb6SVlad Zolotarov * Negative value in case of an error (including an 431619c5cb6SVlad Zolotarov * error in the cqe). 432619c5cb6SVlad Zolotarov */ 433619c5cb6SVlad Zolotarov int (*complete)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o, 434619c5cb6SVlad Zolotarov union event_ring_elem *cqe, 435619c5cb6SVlad Zolotarov unsigned long *ramrod_flags); 436619c5cb6SVlad Zolotarov 437619c5cb6SVlad Zolotarov /** 438619c5cb6SVlad Zolotarov * Wait for completion of all commands. Don't schedule new ones, 439619c5cb6SVlad Zolotarov * just wait. It assumes that the completion code will schedule 440619c5cb6SVlad Zolotarov * for new commands. 441619c5cb6SVlad Zolotarov */ 442619c5cb6SVlad Zolotarov int (*wait)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o); 443619c5cb6SVlad Zolotarov }; 444619c5cb6SVlad Zolotarov 4450a52fd01SYuval Mintz enum { 4460a52fd01SYuval Mintz BNX2X_LLH_CAM_ISCSI_ETH_LINE = 0, 4470a52fd01SYuval Mintz BNX2X_LLH_CAM_ETH_LINE, 4480a52fd01SYuval Mintz BNX2X_LLH_CAM_MAX_PF_LINE = NIG_REG_LLH1_FUNC_MEM_SIZE / 2 4490a52fd01SYuval Mintz }; 4500a52fd01SYuval Mintz 451619c5cb6SVlad Zolotarov /** RX_MODE verbs:DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */ 452619c5cb6SVlad Zolotarov 45316a5fd92SYuval Mintz /* RX_MODE ramrod special flags: set in rx_mode_flags field in 454619c5cb6SVlad Zolotarov * a bnx2x_rx_mode_ramrod_params. 455619c5cb6SVlad Zolotarov */ 456619c5cb6SVlad Zolotarov enum { 457619c5cb6SVlad Zolotarov BNX2X_RX_MODE_FCOE_ETH, 458619c5cb6SVlad Zolotarov BNX2X_RX_MODE_ISCSI_ETH, 459619c5cb6SVlad Zolotarov }; 460619c5cb6SVlad Zolotarov 461619c5cb6SVlad Zolotarov enum { 462619c5cb6SVlad Zolotarov BNX2X_ACCEPT_UNICAST, 463619c5cb6SVlad Zolotarov BNX2X_ACCEPT_MULTICAST, 464619c5cb6SVlad Zolotarov BNX2X_ACCEPT_ALL_UNICAST, 465619c5cb6SVlad Zolotarov BNX2X_ACCEPT_ALL_MULTICAST, 466619c5cb6SVlad Zolotarov BNX2X_ACCEPT_BROADCAST, 467619c5cb6SVlad Zolotarov BNX2X_ACCEPT_UNMATCHED, 468619c5cb6SVlad Zolotarov BNX2X_ACCEPT_ANY_VLAN 469619c5cb6SVlad Zolotarov }; 470619c5cb6SVlad Zolotarov 471619c5cb6SVlad Zolotarov struct bnx2x_rx_mode_ramrod_params { 472619c5cb6SVlad Zolotarov struct bnx2x_rx_mode_obj *rx_mode_obj; 473619c5cb6SVlad Zolotarov unsigned long *pstate; 474619c5cb6SVlad Zolotarov int state; 475619c5cb6SVlad Zolotarov u8 cl_id; 476619c5cb6SVlad Zolotarov u32 cid; 477619c5cb6SVlad Zolotarov u8 func_id; 478619c5cb6SVlad Zolotarov unsigned long ramrod_flags; 479619c5cb6SVlad Zolotarov unsigned long rx_mode_flags; 480619c5cb6SVlad Zolotarov 48116a5fd92SYuval Mintz /* rdata is either a pointer to eth_filter_rules_ramrod_data(e2) or to 482619c5cb6SVlad Zolotarov * a tstorm_eth_mac_filter_config (e1x). 483619c5cb6SVlad Zolotarov */ 484619c5cb6SVlad Zolotarov void *rdata; 485619c5cb6SVlad Zolotarov dma_addr_t rdata_mapping; 486619c5cb6SVlad Zolotarov 487619c5cb6SVlad Zolotarov /* Rx mode settings */ 488619c5cb6SVlad Zolotarov unsigned long rx_accept_flags; 489619c5cb6SVlad Zolotarov 490619c5cb6SVlad Zolotarov /* internal switching settings */ 491619c5cb6SVlad Zolotarov unsigned long tx_accept_flags; 492619c5cb6SVlad Zolotarov }; 493619c5cb6SVlad Zolotarov 494619c5cb6SVlad Zolotarov struct bnx2x_rx_mode_obj { 495619c5cb6SVlad Zolotarov int (*config_rx_mode)(struct bnx2x *bp, 496619c5cb6SVlad Zolotarov struct bnx2x_rx_mode_ramrod_params *p); 497619c5cb6SVlad Zolotarov 498619c5cb6SVlad Zolotarov int (*wait_comp)(struct bnx2x *bp, 499619c5cb6SVlad Zolotarov struct bnx2x_rx_mode_ramrod_params *p); 500619c5cb6SVlad Zolotarov }; 501619c5cb6SVlad Zolotarov 502619c5cb6SVlad Zolotarov /********************** Set multicast group ***********************************/ 503619c5cb6SVlad Zolotarov 504619c5cb6SVlad Zolotarov struct bnx2x_mcast_list_elem { 505619c5cb6SVlad Zolotarov struct list_head link; 506619c5cb6SVlad Zolotarov u8 *mac; 507619c5cb6SVlad Zolotarov }; 508619c5cb6SVlad Zolotarov 509619c5cb6SVlad Zolotarov union bnx2x_mcast_config_data { 510619c5cb6SVlad Zolotarov u8 *mac; 511619c5cb6SVlad Zolotarov u8 bin; /* used in a RESTORE flow */ 512619c5cb6SVlad Zolotarov }; 513619c5cb6SVlad Zolotarov 514619c5cb6SVlad Zolotarov struct bnx2x_mcast_ramrod_params { 515619c5cb6SVlad Zolotarov struct bnx2x_mcast_obj *mcast_obj; 516619c5cb6SVlad Zolotarov 517619c5cb6SVlad Zolotarov /* Relevant options are RAMROD_COMP_WAIT and RAMROD_DRV_CLR_ONLY */ 518619c5cb6SVlad Zolotarov unsigned long ramrod_flags; 519619c5cb6SVlad Zolotarov 520619c5cb6SVlad Zolotarov struct list_head mcast_list; /* list of struct bnx2x_mcast_list_elem */ 521619c5cb6SVlad Zolotarov /** TODO: 522619c5cb6SVlad Zolotarov * - rename it to macs_num. 523619c5cb6SVlad Zolotarov * - Add a new command type for handling pending commands 524619c5cb6SVlad Zolotarov * (remove "zero semantics"). 525619c5cb6SVlad Zolotarov * 526619c5cb6SVlad Zolotarov * Length of mcast_list. If zero and ADD_CONT command - post 527619c5cb6SVlad Zolotarov * pending commands. 528619c5cb6SVlad Zolotarov */ 529619c5cb6SVlad Zolotarov int mcast_list_len; 530619c5cb6SVlad Zolotarov }; 531619c5cb6SVlad Zolotarov 53286564c3fSYuval Mintz enum bnx2x_mcast_cmd { 533619c5cb6SVlad Zolotarov BNX2X_MCAST_CMD_ADD, 534619c5cb6SVlad Zolotarov BNX2X_MCAST_CMD_CONT, 535619c5cb6SVlad Zolotarov BNX2X_MCAST_CMD_DEL, 536619c5cb6SVlad Zolotarov BNX2X_MCAST_CMD_RESTORE, 537619c5cb6SVlad Zolotarov }; 538619c5cb6SVlad Zolotarov 539619c5cb6SVlad Zolotarov struct bnx2x_mcast_obj { 540619c5cb6SVlad Zolotarov struct bnx2x_raw_obj raw; 541619c5cb6SVlad Zolotarov 542619c5cb6SVlad Zolotarov union { 543619c5cb6SVlad Zolotarov struct { 544619c5cb6SVlad Zolotarov #define BNX2X_MCAST_BINS_NUM 256 545619c5cb6SVlad Zolotarov #define BNX2X_MCAST_VEC_SZ (BNX2X_MCAST_BINS_NUM / 64) 546619c5cb6SVlad Zolotarov u64 vec[BNX2X_MCAST_VEC_SZ]; 547619c5cb6SVlad Zolotarov 548619c5cb6SVlad Zolotarov /** Number of BINs to clear. Should be updated 549619c5cb6SVlad Zolotarov * immediately when a command arrives in order to 550619c5cb6SVlad Zolotarov * properly create DEL commands. 551619c5cb6SVlad Zolotarov */ 552619c5cb6SVlad Zolotarov int num_bins_set; 553619c5cb6SVlad Zolotarov } aprox_match; 554619c5cb6SVlad Zolotarov 555619c5cb6SVlad Zolotarov struct { 556619c5cb6SVlad Zolotarov struct list_head macs; 557619c5cb6SVlad Zolotarov int num_macs_set; 558619c5cb6SVlad Zolotarov } exact_match; 559619c5cb6SVlad Zolotarov } registry; 560619c5cb6SVlad Zolotarov 561619c5cb6SVlad Zolotarov /* Pending commands */ 562619c5cb6SVlad Zolotarov struct list_head pending_cmds_head; 563619c5cb6SVlad Zolotarov 564619c5cb6SVlad Zolotarov /* A state that is set in raw.pstate, when there are pending commands */ 565619c5cb6SVlad Zolotarov int sched_state; 566619c5cb6SVlad Zolotarov 567619c5cb6SVlad Zolotarov /* Maximal number of mcast MACs configured in one command */ 568619c5cb6SVlad Zolotarov int max_cmd_len; 569619c5cb6SVlad Zolotarov 570619c5cb6SVlad Zolotarov /* Total number of currently pending MACs to configure: both 571619c5cb6SVlad Zolotarov * in the pending commands list and in the current command. 572619c5cb6SVlad Zolotarov */ 573619c5cb6SVlad Zolotarov int total_pending_num; 574619c5cb6SVlad Zolotarov 575619c5cb6SVlad Zolotarov u8 engine_id; 576619c5cb6SVlad Zolotarov 577619c5cb6SVlad Zolotarov /** 578619c5cb6SVlad Zolotarov * @param cmd command to execute (BNX2X_MCAST_CMD_X, see above) 579619c5cb6SVlad Zolotarov */ 580619c5cb6SVlad Zolotarov int (*config_mcast)(struct bnx2x *bp, 58186564c3fSYuval Mintz struct bnx2x_mcast_ramrod_params *p, 58286564c3fSYuval Mintz enum bnx2x_mcast_cmd cmd); 583619c5cb6SVlad Zolotarov 584619c5cb6SVlad Zolotarov /** 585619c5cb6SVlad Zolotarov * Fills the ramrod data during the RESTORE flow. 586619c5cb6SVlad Zolotarov * 587619c5cb6SVlad Zolotarov * @param bp 588619c5cb6SVlad Zolotarov * @param o 589619c5cb6SVlad Zolotarov * @param start_idx Registry index to start from 590619c5cb6SVlad Zolotarov * @param rdata_idx Index in the ramrod data to start from 591619c5cb6SVlad Zolotarov * 592619c5cb6SVlad Zolotarov * @return -1 if we handled the whole registry or index of the last 593619c5cb6SVlad Zolotarov * handled registry element. 594619c5cb6SVlad Zolotarov */ 595619c5cb6SVlad Zolotarov int (*hdl_restore)(struct bnx2x *bp, struct bnx2x_mcast_obj *o, 596619c5cb6SVlad Zolotarov int start_bin, int *rdata_idx); 597619c5cb6SVlad Zolotarov 598619c5cb6SVlad Zolotarov int (*enqueue_cmd)(struct bnx2x *bp, struct bnx2x_mcast_obj *o, 59986564c3fSYuval Mintz struct bnx2x_mcast_ramrod_params *p, 60086564c3fSYuval Mintz enum bnx2x_mcast_cmd cmd); 601619c5cb6SVlad Zolotarov 602619c5cb6SVlad Zolotarov void (*set_one_rule)(struct bnx2x *bp, 603619c5cb6SVlad Zolotarov struct bnx2x_mcast_obj *o, int idx, 60486564c3fSYuval Mintz union bnx2x_mcast_config_data *cfg_data, 60586564c3fSYuval Mintz enum bnx2x_mcast_cmd cmd); 606619c5cb6SVlad Zolotarov 607619c5cb6SVlad Zolotarov /** Checks if there are more mcast MACs to be set or a previous 608619c5cb6SVlad Zolotarov * command is still pending. 609619c5cb6SVlad Zolotarov */ 610619c5cb6SVlad Zolotarov bool (*check_pending)(struct bnx2x_mcast_obj *o); 611619c5cb6SVlad Zolotarov 612619c5cb6SVlad Zolotarov /** 613619c5cb6SVlad Zolotarov * Set/Clear/Check SCHEDULED state of the object 614619c5cb6SVlad Zolotarov */ 615619c5cb6SVlad Zolotarov void (*set_sched)(struct bnx2x_mcast_obj *o); 616619c5cb6SVlad Zolotarov void (*clear_sched)(struct bnx2x_mcast_obj *o); 617619c5cb6SVlad Zolotarov bool (*check_sched)(struct bnx2x_mcast_obj *o); 618619c5cb6SVlad Zolotarov 619619c5cb6SVlad Zolotarov /* Wait until all pending commands complete */ 620619c5cb6SVlad Zolotarov int (*wait_comp)(struct bnx2x *bp, struct bnx2x_mcast_obj *o); 621619c5cb6SVlad Zolotarov 622619c5cb6SVlad Zolotarov /** 623619c5cb6SVlad Zolotarov * Handle the internal object counters needed for proper 624619c5cb6SVlad Zolotarov * commands handling. Checks that the provided parameters are 625619c5cb6SVlad Zolotarov * feasible. 626619c5cb6SVlad Zolotarov */ 627619c5cb6SVlad Zolotarov int (*validate)(struct bnx2x *bp, 62886564c3fSYuval Mintz struct bnx2x_mcast_ramrod_params *p, 62986564c3fSYuval Mintz enum bnx2x_mcast_cmd cmd); 630619c5cb6SVlad Zolotarov 631619c5cb6SVlad Zolotarov /** 632619c5cb6SVlad Zolotarov * Restore the values of internal counters in case of a failure. 633619c5cb6SVlad Zolotarov */ 634619c5cb6SVlad Zolotarov void (*revert)(struct bnx2x *bp, 635619c5cb6SVlad Zolotarov struct bnx2x_mcast_ramrod_params *p, 636619c5cb6SVlad Zolotarov int old_num_bins); 637619c5cb6SVlad Zolotarov 638619c5cb6SVlad Zolotarov int (*get_registry_size)(struct bnx2x_mcast_obj *o); 639619c5cb6SVlad Zolotarov void (*set_registry_size)(struct bnx2x_mcast_obj *o, int n); 640619c5cb6SVlad Zolotarov }; 641619c5cb6SVlad Zolotarov 642619c5cb6SVlad Zolotarov /*************************** Credit handling **********************************/ 643619c5cb6SVlad Zolotarov struct bnx2x_credit_pool_obj { 644619c5cb6SVlad Zolotarov 645619c5cb6SVlad Zolotarov /* Current amount of credit in the pool */ 646619c5cb6SVlad Zolotarov atomic_t credit; 647619c5cb6SVlad Zolotarov 648619c5cb6SVlad Zolotarov /* Maximum allowed credit. put() will check against it. */ 649619c5cb6SVlad Zolotarov int pool_sz; 650619c5cb6SVlad Zolotarov 65116a5fd92SYuval Mintz /* Allocate a pool table statically. 652619c5cb6SVlad Zolotarov * 65316a5fd92SYuval Mintz * Currently the maximum allowed size is MAX_MAC_CREDIT_E2(272) 654619c5cb6SVlad Zolotarov * 655619c5cb6SVlad Zolotarov * The set bit in the table will mean that the entry is available. 656619c5cb6SVlad Zolotarov */ 657619c5cb6SVlad Zolotarov #define BNX2X_POOL_VEC_SIZE (MAX_MAC_CREDIT_E2 / 64) 658619c5cb6SVlad Zolotarov u64 pool_mirror[BNX2X_POOL_VEC_SIZE]; 659619c5cb6SVlad Zolotarov 660619c5cb6SVlad Zolotarov /* Base pool offset (initialized differently */ 661619c5cb6SVlad Zolotarov int base_pool_offset; 662619c5cb6SVlad Zolotarov 663619c5cb6SVlad Zolotarov /** 664619c5cb6SVlad Zolotarov * Get the next free pool entry. 665619c5cb6SVlad Zolotarov * 666619c5cb6SVlad Zolotarov * @return true if there was a free entry in the pool 667619c5cb6SVlad Zolotarov */ 668619c5cb6SVlad Zolotarov bool (*get_entry)(struct bnx2x_credit_pool_obj *o, int *entry); 669619c5cb6SVlad Zolotarov 670619c5cb6SVlad Zolotarov /** 671619c5cb6SVlad Zolotarov * Return the entry back to the pool. 672619c5cb6SVlad Zolotarov * 673619c5cb6SVlad Zolotarov * @return true if entry is legal and has been successfully 674619c5cb6SVlad Zolotarov * returned to the pool. 675619c5cb6SVlad Zolotarov */ 676619c5cb6SVlad Zolotarov bool (*put_entry)(struct bnx2x_credit_pool_obj *o, int entry); 677619c5cb6SVlad Zolotarov 678619c5cb6SVlad Zolotarov /** 679619c5cb6SVlad Zolotarov * Get the requested amount of credit from the pool. 680619c5cb6SVlad Zolotarov * 681619c5cb6SVlad Zolotarov * @param cnt Amount of requested credit 682619c5cb6SVlad Zolotarov * @return true if the operation is successful 683619c5cb6SVlad Zolotarov */ 684619c5cb6SVlad Zolotarov bool (*get)(struct bnx2x_credit_pool_obj *o, int cnt); 685619c5cb6SVlad Zolotarov 686619c5cb6SVlad Zolotarov /** 687619c5cb6SVlad Zolotarov * Returns the credit to the pool. 688619c5cb6SVlad Zolotarov * 689619c5cb6SVlad Zolotarov * @param cnt Amount of credit to return 690619c5cb6SVlad Zolotarov * @return true if the operation is successful 691619c5cb6SVlad Zolotarov */ 692619c5cb6SVlad Zolotarov bool (*put)(struct bnx2x_credit_pool_obj *o, int cnt); 693619c5cb6SVlad Zolotarov 694619c5cb6SVlad Zolotarov /** 695619c5cb6SVlad Zolotarov * Reads the current amount of credit. 696619c5cb6SVlad Zolotarov */ 697619c5cb6SVlad Zolotarov int (*check)(struct bnx2x_credit_pool_obj *o); 698619c5cb6SVlad Zolotarov }; 699619c5cb6SVlad Zolotarov 700619c5cb6SVlad Zolotarov /*************************** RSS configuration ********************************/ 701619c5cb6SVlad Zolotarov enum { 702619c5cb6SVlad Zolotarov /* RSS_MODE bits are mutually exclusive */ 703619c5cb6SVlad Zolotarov BNX2X_RSS_MODE_DISABLED, 704619c5cb6SVlad Zolotarov BNX2X_RSS_MODE_REGULAR, 705619c5cb6SVlad Zolotarov 706619c5cb6SVlad Zolotarov BNX2X_RSS_SET_SRCH, /* Setup searcher, E1x specific flag */ 707619c5cb6SVlad Zolotarov 708619c5cb6SVlad Zolotarov BNX2X_RSS_IPV4, 709619c5cb6SVlad Zolotarov BNX2X_RSS_IPV4_TCP, 7105d317c6aSMerav Sicron BNX2X_RSS_IPV4_UDP, 711619c5cb6SVlad Zolotarov BNX2X_RSS_IPV6, 712619c5cb6SVlad Zolotarov BNX2X_RSS_IPV6_TCP, 7135d317c6aSMerav Sicron BNX2X_RSS_IPV6_UDP, 714619c5cb6SVlad Zolotarov }; 715619c5cb6SVlad Zolotarov 716619c5cb6SVlad Zolotarov struct bnx2x_config_rss_params { 717619c5cb6SVlad Zolotarov struct bnx2x_rss_config_obj *rss_obj; 718619c5cb6SVlad Zolotarov 719619c5cb6SVlad Zolotarov /* may have RAMROD_COMP_WAIT set only */ 720619c5cb6SVlad Zolotarov unsigned long ramrod_flags; 721619c5cb6SVlad Zolotarov 722619c5cb6SVlad Zolotarov /* BNX2X_RSS_X bits */ 723619c5cb6SVlad Zolotarov unsigned long rss_flags; 724619c5cb6SVlad Zolotarov 725619c5cb6SVlad Zolotarov /* Number hash bits to take into an account */ 726619c5cb6SVlad Zolotarov u8 rss_result_mask; 727619c5cb6SVlad Zolotarov 728619c5cb6SVlad Zolotarov /* Indirection table */ 729619c5cb6SVlad Zolotarov u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE]; 730619c5cb6SVlad Zolotarov 731619c5cb6SVlad Zolotarov /* RSS hash values */ 732619c5cb6SVlad Zolotarov u32 rss_key[10]; 733619c5cb6SVlad Zolotarov 734619c5cb6SVlad Zolotarov /* valid only iff BNX2X_RSS_UPDATE_TOE is set */ 735619c5cb6SVlad Zolotarov u16 toe_rss_bitmap; 736619c5cb6SVlad Zolotarov }; 737619c5cb6SVlad Zolotarov 738619c5cb6SVlad Zolotarov struct bnx2x_rss_config_obj { 739619c5cb6SVlad Zolotarov struct bnx2x_raw_obj raw; 740619c5cb6SVlad Zolotarov 741619c5cb6SVlad Zolotarov /* RSS engine to use */ 742619c5cb6SVlad Zolotarov u8 engine_id; 743619c5cb6SVlad Zolotarov 744619c5cb6SVlad Zolotarov /* Last configured indirection table */ 745619c5cb6SVlad Zolotarov u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE]; 746619c5cb6SVlad Zolotarov 7475d317c6aSMerav Sicron /* flags for enabling 4-tupple hash on UDP */ 7485d317c6aSMerav Sicron u8 udp_rss_v4; 7495d317c6aSMerav Sicron u8 udp_rss_v6; 7505d317c6aSMerav Sicron 751619c5cb6SVlad Zolotarov int (*config_rss)(struct bnx2x *bp, 752619c5cb6SVlad Zolotarov struct bnx2x_config_rss_params *p); 753619c5cb6SVlad Zolotarov }; 754619c5cb6SVlad Zolotarov 755619c5cb6SVlad Zolotarov /*********************** Queue state update ***********************************/ 756619c5cb6SVlad Zolotarov 757619c5cb6SVlad Zolotarov /* UPDATE command options */ 758619c5cb6SVlad Zolotarov enum { 759619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_IN_VLAN_REM, 760619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_IN_VLAN_REM_CHNG, 761619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_OUT_VLAN_REM, 762619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_OUT_VLAN_REM_CHNG, 763619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_ANTI_SPOOF, 764619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_ANTI_SPOOF_CHNG, 765619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_ACTIVATE, 766619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_ACTIVATE_CHNG, 767619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_DEF_VLAN_EN, 768619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG, 769619c5cb6SVlad Zolotarov BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG, 770c14db202SYuval Mintz BNX2X_Q_UPDATE_SILENT_VLAN_REM, 771c14db202SYuval Mintz BNX2X_Q_UPDATE_TX_SWITCHING_CHNG, 772c14db202SYuval Mintz BNX2X_Q_UPDATE_TX_SWITCHING 773619c5cb6SVlad Zolotarov }; 774619c5cb6SVlad Zolotarov 775619c5cb6SVlad Zolotarov /* Allowed Queue states */ 776619c5cb6SVlad Zolotarov enum bnx2x_q_state { 777619c5cb6SVlad Zolotarov BNX2X_Q_STATE_RESET, 778619c5cb6SVlad Zolotarov BNX2X_Q_STATE_INITIALIZED, 779619c5cb6SVlad Zolotarov BNX2X_Q_STATE_ACTIVE, 7806383c0b3SAriel Elior BNX2X_Q_STATE_MULTI_COS, 7816383c0b3SAriel Elior BNX2X_Q_STATE_MCOS_TERMINATED, 782619c5cb6SVlad Zolotarov BNX2X_Q_STATE_INACTIVE, 783619c5cb6SVlad Zolotarov BNX2X_Q_STATE_STOPPED, 784619c5cb6SVlad Zolotarov BNX2X_Q_STATE_TERMINATED, 785619c5cb6SVlad Zolotarov BNX2X_Q_STATE_FLRED, 786619c5cb6SVlad Zolotarov BNX2X_Q_STATE_MAX, 787619c5cb6SVlad Zolotarov }; 788619c5cb6SVlad Zolotarov 78967c431a5SAriel Elior /* Allowed Queue states */ 79067c431a5SAriel Elior enum bnx2x_q_logical_state { 79167c431a5SAriel Elior BNX2X_Q_LOGICAL_STATE_ACTIVE, 79267c431a5SAriel Elior BNX2X_Q_LOGICAL_STATE_STOPPED, 79367c431a5SAriel Elior }; 79467c431a5SAriel Elior 795619c5cb6SVlad Zolotarov /* Allowed commands */ 796619c5cb6SVlad Zolotarov enum bnx2x_queue_cmd { 797619c5cb6SVlad Zolotarov BNX2X_Q_CMD_INIT, 798619c5cb6SVlad Zolotarov BNX2X_Q_CMD_SETUP, 7996383c0b3SAriel Elior BNX2X_Q_CMD_SETUP_TX_ONLY, 800619c5cb6SVlad Zolotarov BNX2X_Q_CMD_DEACTIVATE, 801619c5cb6SVlad Zolotarov BNX2X_Q_CMD_ACTIVATE, 802619c5cb6SVlad Zolotarov BNX2X_Q_CMD_UPDATE, 803619c5cb6SVlad Zolotarov BNX2X_Q_CMD_UPDATE_TPA, 804619c5cb6SVlad Zolotarov BNX2X_Q_CMD_HALT, 805619c5cb6SVlad Zolotarov BNX2X_Q_CMD_CFC_DEL, 806619c5cb6SVlad Zolotarov BNX2X_Q_CMD_TERMINATE, 807619c5cb6SVlad Zolotarov BNX2X_Q_CMD_EMPTY, 808619c5cb6SVlad Zolotarov BNX2X_Q_CMD_MAX, 809619c5cb6SVlad Zolotarov }; 810619c5cb6SVlad Zolotarov 811619c5cb6SVlad Zolotarov /* queue SETUP + INIT flags */ 812619c5cb6SVlad Zolotarov enum { 813619c5cb6SVlad Zolotarov BNX2X_Q_FLG_TPA, 814f5219d8eSVladislav Zolotarov BNX2X_Q_FLG_TPA_IPV6, 815621b4d66SDmitry Kravkov BNX2X_Q_FLG_TPA_GRO, 816619c5cb6SVlad Zolotarov BNX2X_Q_FLG_STATS, 817619c5cb6SVlad Zolotarov BNX2X_Q_FLG_ZERO_STATS, 818619c5cb6SVlad Zolotarov BNX2X_Q_FLG_ACTIVE, 819619c5cb6SVlad Zolotarov BNX2X_Q_FLG_OV, 820619c5cb6SVlad Zolotarov BNX2X_Q_FLG_VLAN, 821619c5cb6SVlad Zolotarov BNX2X_Q_FLG_COS, 822619c5cb6SVlad Zolotarov BNX2X_Q_FLG_HC, 823619c5cb6SVlad Zolotarov BNX2X_Q_FLG_HC_EN, 824619c5cb6SVlad Zolotarov BNX2X_Q_FLG_DHC, 825619c5cb6SVlad Zolotarov BNX2X_Q_FLG_FCOE, 826619c5cb6SVlad Zolotarov BNX2X_Q_FLG_LEADING_RSS, 827619c5cb6SVlad Zolotarov BNX2X_Q_FLG_MCAST, 828619c5cb6SVlad Zolotarov BNX2X_Q_FLG_DEF_VLAN, 829619c5cb6SVlad Zolotarov BNX2X_Q_FLG_TX_SWITCH, 830619c5cb6SVlad Zolotarov BNX2X_Q_FLG_TX_SEC, 831619c5cb6SVlad Zolotarov BNX2X_Q_FLG_ANTI_SPOOF, 832a3348722SBarak Witkowski BNX2X_Q_FLG_SILENT_VLAN_REM, 83391226790SDmitry Kravkov BNX2X_Q_FLG_FORCE_DEFAULT_PRI, 834e287a75cSDmitry Kravkov BNX2X_Q_FLG_PCSUM_ON_PKT, 835e287a75cSDmitry Kravkov BNX2X_Q_FLG_TUN_INC_INNER_IP_ID 836619c5cb6SVlad Zolotarov }; 837619c5cb6SVlad Zolotarov 83816a5fd92SYuval Mintz /* Queue type options: queue type may be a combination of below. */ 839619c5cb6SVlad Zolotarov enum bnx2x_q_type { 840619c5cb6SVlad Zolotarov /** TODO: Consider moving both these flags into the init() 841619c5cb6SVlad Zolotarov * ramrod params. 842619c5cb6SVlad Zolotarov */ 843619c5cb6SVlad Zolotarov BNX2X_Q_TYPE_HAS_RX, 844619c5cb6SVlad Zolotarov BNX2X_Q_TYPE_HAS_TX, 845619c5cb6SVlad Zolotarov }; 846619c5cb6SVlad Zolotarov 8476383c0b3SAriel Elior #define BNX2X_PRIMARY_CID_INDEX 0 8488d7b0278SAriel Elior #define BNX2X_MULTI_TX_COS_E1X 3 /* QM only */ 8496383c0b3SAriel Elior #define BNX2X_MULTI_TX_COS_E2_E3A0 2 8506383c0b3SAriel Elior #define BNX2X_MULTI_TX_COS_E3B0 3 8518d7b0278SAriel Elior #define BNX2X_MULTI_TX_COS 3 /* Maximum possible */ 8526383c0b3SAriel Elior 8533ec9f9caSAriel Elior #define MAC_PAD (ALIGN(ETH_ALEN, sizeof(u32)) - ETH_ALEN) 8546383c0b3SAriel Elior 855619c5cb6SVlad Zolotarov struct bnx2x_queue_init_params { 856619c5cb6SVlad Zolotarov struct { 857619c5cb6SVlad Zolotarov unsigned long flags; 858619c5cb6SVlad Zolotarov u16 hc_rate; 859619c5cb6SVlad Zolotarov u8 fw_sb_id; 860619c5cb6SVlad Zolotarov u8 sb_cq_index; 861619c5cb6SVlad Zolotarov } tx; 862619c5cb6SVlad Zolotarov 863619c5cb6SVlad Zolotarov struct { 864619c5cb6SVlad Zolotarov unsigned long flags; 865619c5cb6SVlad Zolotarov u16 hc_rate; 866619c5cb6SVlad Zolotarov u8 fw_sb_id; 867619c5cb6SVlad Zolotarov u8 sb_cq_index; 868619c5cb6SVlad Zolotarov } rx; 869619c5cb6SVlad Zolotarov 870619c5cb6SVlad Zolotarov /* CID context in the host memory */ 8716383c0b3SAriel Elior struct eth_context *cxts[BNX2X_MULTI_TX_COS]; 8726383c0b3SAriel Elior 8736383c0b3SAriel Elior /* maximum number of cos supported by hardware */ 8746383c0b3SAriel Elior u8 max_cos; 8756383c0b3SAriel Elior }; 8766383c0b3SAriel Elior 8776383c0b3SAriel Elior struct bnx2x_queue_terminate_params { 8786383c0b3SAriel Elior /* index within the tx_only cids of this queue object */ 8796383c0b3SAriel Elior u8 cid_index; 8806383c0b3SAriel Elior }; 8816383c0b3SAriel Elior 8826383c0b3SAriel Elior struct bnx2x_queue_cfc_del_params { 8836383c0b3SAriel Elior /* index within the tx_only cids of this queue object */ 8846383c0b3SAriel Elior u8 cid_index; 885619c5cb6SVlad Zolotarov }; 886619c5cb6SVlad Zolotarov 887619c5cb6SVlad Zolotarov struct bnx2x_queue_update_params { 888619c5cb6SVlad Zolotarov unsigned long update_flags; /* BNX2X_Q_UPDATE_XX bits */ 889619c5cb6SVlad Zolotarov u16 def_vlan; 890619c5cb6SVlad Zolotarov u16 silent_removal_value; 891619c5cb6SVlad Zolotarov u16 silent_removal_mask; 8926383c0b3SAriel Elior /* index within the tx_only cids of this queue object */ 8936383c0b3SAriel Elior u8 cid_index; 894619c5cb6SVlad Zolotarov }; 895619c5cb6SVlad Zolotarov 89614a94ebdSMichal Kalderon struct bnx2x_queue_update_tpa_params { 89714a94ebdSMichal Kalderon dma_addr_t sge_map; 89814a94ebdSMichal Kalderon u8 update_ipv4; 89914a94ebdSMichal Kalderon u8 update_ipv6; 90014a94ebdSMichal Kalderon u8 max_tpa_queues; 90114a94ebdSMichal Kalderon u8 max_sges_pkt; 90214a94ebdSMichal Kalderon u8 complete_on_both_clients; 90314a94ebdSMichal Kalderon u8 dont_verify_thr; 90414a94ebdSMichal Kalderon u8 tpa_mode; 90514a94ebdSMichal Kalderon u8 _pad; 90614a94ebdSMichal Kalderon 90714a94ebdSMichal Kalderon u16 sge_buff_sz; 90814a94ebdSMichal Kalderon u16 max_agg_sz; 90914a94ebdSMichal Kalderon 91014a94ebdSMichal Kalderon u16 sge_pause_thr_low; 91114a94ebdSMichal Kalderon u16 sge_pause_thr_high; 91214a94ebdSMichal Kalderon }; 91314a94ebdSMichal Kalderon 914619c5cb6SVlad Zolotarov struct rxq_pause_params { 915619c5cb6SVlad Zolotarov u16 bd_th_lo; 916619c5cb6SVlad Zolotarov u16 bd_th_hi; 917619c5cb6SVlad Zolotarov u16 rcq_th_lo; 918619c5cb6SVlad Zolotarov u16 rcq_th_hi; 919619c5cb6SVlad Zolotarov u16 sge_th_lo; /* valid iff BNX2X_Q_FLG_TPA */ 920619c5cb6SVlad Zolotarov u16 sge_th_hi; /* valid iff BNX2X_Q_FLG_TPA */ 921619c5cb6SVlad Zolotarov u16 pri_map; 922619c5cb6SVlad Zolotarov }; 923619c5cb6SVlad Zolotarov 924619c5cb6SVlad Zolotarov /* general */ 925619c5cb6SVlad Zolotarov struct bnx2x_general_setup_params { 926619c5cb6SVlad Zolotarov /* valid iff BNX2X_Q_FLG_STATS */ 927619c5cb6SVlad Zolotarov u8 stat_id; 928619c5cb6SVlad Zolotarov 929619c5cb6SVlad Zolotarov u8 spcl_id; 930619c5cb6SVlad Zolotarov u16 mtu; 9316383c0b3SAriel Elior u8 cos; 932619c5cb6SVlad Zolotarov }; 933619c5cb6SVlad Zolotarov 934619c5cb6SVlad Zolotarov struct bnx2x_rxq_setup_params { 935619c5cb6SVlad Zolotarov /* dma */ 936619c5cb6SVlad Zolotarov dma_addr_t dscr_map; 937619c5cb6SVlad Zolotarov dma_addr_t sge_map; 938619c5cb6SVlad Zolotarov dma_addr_t rcq_map; 939619c5cb6SVlad Zolotarov dma_addr_t rcq_np_map; 940619c5cb6SVlad Zolotarov 941619c5cb6SVlad Zolotarov u16 drop_flags; 942619c5cb6SVlad Zolotarov u16 buf_sz; 943619c5cb6SVlad Zolotarov u8 fw_sb_id; 944619c5cb6SVlad Zolotarov u8 cl_qzone_id; 945619c5cb6SVlad Zolotarov 946619c5cb6SVlad Zolotarov /* valid iff BNX2X_Q_FLG_TPA */ 947619c5cb6SVlad Zolotarov u16 tpa_agg_sz; 948619c5cb6SVlad Zolotarov u16 sge_buf_sz; 949619c5cb6SVlad Zolotarov u8 max_sges_pkt; 950619c5cb6SVlad Zolotarov u8 max_tpa_queues; 951619c5cb6SVlad Zolotarov u8 rss_engine_id; 952619c5cb6SVlad Zolotarov 953259afa1fSYuval Mintz /* valid iff BNX2X_Q_FLG_MCAST */ 954259afa1fSYuval Mintz u8 mcast_engine_id; 955259afa1fSYuval Mintz 956619c5cb6SVlad Zolotarov u8 cache_line_log; 957619c5cb6SVlad Zolotarov 958619c5cb6SVlad Zolotarov u8 sb_cq_index; 959619c5cb6SVlad Zolotarov 960619c5cb6SVlad Zolotarov /* valid iff BXN2X_Q_FLG_SILENT_VLAN_REM */ 961619c5cb6SVlad Zolotarov u16 silent_removal_value; 962619c5cb6SVlad Zolotarov u16 silent_removal_mask; 963619c5cb6SVlad Zolotarov }; 964619c5cb6SVlad Zolotarov 965619c5cb6SVlad Zolotarov struct bnx2x_txq_setup_params { 966619c5cb6SVlad Zolotarov /* dma */ 967619c5cb6SVlad Zolotarov dma_addr_t dscr_map; 968619c5cb6SVlad Zolotarov 969619c5cb6SVlad Zolotarov u8 fw_sb_id; 970619c5cb6SVlad Zolotarov u8 sb_cq_index; 971619c5cb6SVlad Zolotarov u8 cos; /* valid iff BNX2X_Q_FLG_COS */ 972619c5cb6SVlad Zolotarov u16 traffic_type; 973619c5cb6SVlad Zolotarov /* equals to the leading rss client id, used for TX classification*/ 974619c5cb6SVlad Zolotarov u8 tss_leading_cl_id; 975619c5cb6SVlad Zolotarov 976619c5cb6SVlad Zolotarov /* valid iff BNX2X_Q_FLG_DEF_VLAN */ 977619c5cb6SVlad Zolotarov u16 default_vlan; 978619c5cb6SVlad Zolotarov }; 979619c5cb6SVlad Zolotarov 980619c5cb6SVlad Zolotarov struct bnx2x_queue_setup_params { 981619c5cb6SVlad Zolotarov struct bnx2x_general_setup_params gen_params; 982619c5cb6SVlad Zolotarov struct bnx2x_txq_setup_params txq_params; 9836383c0b3SAriel Elior struct bnx2x_rxq_setup_params rxq_params; 9846383c0b3SAriel Elior struct rxq_pause_params pause_params; 985619c5cb6SVlad Zolotarov unsigned long flags; 986619c5cb6SVlad Zolotarov }; 987619c5cb6SVlad Zolotarov 9886383c0b3SAriel Elior struct bnx2x_queue_setup_tx_only_params { 9896383c0b3SAriel Elior struct bnx2x_general_setup_params gen_params; 9906383c0b3SAriel Elior struct bnx2x_txq_setup_params txq_params; 9916383c0b3SAriel Elior unsigned long flags; 9926383c0b3SAriel Elior /* index within the tx_only cids of this queue object */ 9936383c0b3SAriel Elior u8 cid_index; 9946383c0b3SAriel Elior }; 995619c5cb6SVlad Zolotarov 996619c5cb6SVlad Zolotarov struct bnx2x_queue_state_params { 997619c5cb6SVlad Zolotarov struct bnx2x_queue_sp_obj *q_obj; 998619c5cb6SVlad Zolotarov 999619c5cb6SVlad Zolotarov /* Current command */ 1000619c5cb6SVlad Zolotarov enum bnx2x_queue_cmd cmd; 1001619c5cb6SVlad Zolotarov 1002619c5cb6SVlad Zolotarov /* may have RAMROD_COMP_WAIT set only */ 1003619c5cb6SVlad Zolotarov unsigned long ramrod_flags; 1004619c5cb6SVlad Zolotarov 1005619c5cb6SVlad Zolotarov /* Params according to the current command */ 1006619c5cb6SVlad Zolotarov union { 1007619c5cb6SVlad Zolotarov struct bnx2x_queue_update_params update; 100814a94ebdSMichal Kalderon struct bnx2x_queue_update_tpa_params update_tpa; 1009619c5cb6SVlad Zolotarov struct bnx2x_queue_setup_params setup; 1010619c5cb6SVlad Zolotarov struct bnx2x_queue_init_params init; 10116383c0b3SAriel Elior struct bnx2x_queue_setup_tx_only_params tx_only; 10126383c0b3SAriel Elior struct bnx2x_queue_terminate_params terminate; 10136383c0b3SAriel Elior struct bnx2x_queue_cfc_del_params cfc_del; 1014619c5cb6SVlad Zolotarov } params; 1015619c5cb6SVlad Zolotarov }; 1016619c5cb6SVlad Zolotarov 1017a3348722SBarak Witkowski struct bnx2x_viflist_params { 1018a3348722SBarak Witkowski u8 echo_res; 1019a3348722SBarak Witkowski u8 func_bit_map_res; 1020a3348722SBarak Witkowski }; 1021a3348722SBarak Witkowski 1022619c5cb6SVlad Zolotarov struct bnx2x_queue_sp_obj { 10236383c0b3SAriel Elior u32 cids[BNX2X_MULTI_TX_COS]; 1024619c5cb6SVlad Zolotarov u8 cl_id; 1025619c5cb6SVlad Zolotarov u8 func_id; 1026619c5cb6SVlad Zolotarov 102716a5fd92SYuval Mintz /* number of traffic classes supported by queue. 102816a5fd92SYuval Mintz * The primary connection of the queue supports the first traffic 102916a5fd92SYuval Mintz * class. Any further traffic class is supported by a tx-only 10306383c0b3SAriel Elior * connection. 10316383c0b3SAriel Elior * 10326383c0b3SAriel Elior * Therefore max_cos is also a number of valid entries in the cids 10336383c0b3SAriel Elior * array. 10346383c0b3SAriel Elior */ 10356383c0b3SAriel Elior u8 max_cos; 10366383c0b3SAriel Elior u8 num_tx_only, next_tx_only; 10376383c0b3SAriel Elior 1038619c5cb6SVlad Zolotarov enum bnx2x_q_state state, next_state; 1039619c5cb6SVlad Zolotarov 1040619c5cb6SVlad Zolotarov /* bits from enum bnx2x_q_type */ 1041619c5cb6SVlad Zolotarov unsigned long type; 1042619c5cb6SVlad Zolotarov 1043619c5cb6SVlad Zolotarov /* BNX2X_Q_CMD_XX bits. This object implements "one 1044619c5cb6SVlad Zolotarov * pending" paradigm but for debug and tracing purposes it's 104516a5fd92SYuval Mintz * more convenient to have different bits for different 1046619c5cb6SVlad Zolotarov * commands. 1047619c5cb6SVlad Zolotarov */ 1048619c5cb6SVlad Zolotarov unsigned long pending; 1049619c5cb6SVlad Zolotarov 1050619c5cb6SVlad Zolotarov /* Buffer to use as a ramrod data and its mapping */ 1051619c5cb6SVlad Zolotarov void *rdata; 1052619c5cb6SVlad Zolotarov dma_addr_t rdata_mapping; 1053619c5cb6SVlad Zolotarov 1054619c5cb6SVlad Zolotarov /** 1055619c5cb6SVlad Zolotarov * Performs one state change according to the given parameters. 1056619c5cb6SVlad Zolotarov * 1057619c5cb6SVlad Zolotarov * @return 0 in case of success and negative value otherwise. 1058619c5cb6SVlad Zolotarov */ 1059619c5cb6SVlad Zolotarov int (*send_cmd)(struct bnx2x *bp, 1060619c5cb6SVlad Zolotarov struct bnx2x_queue_state_params *params); 1061619c5cb6SVlad Zolotarov 1062619c5cb6SVlad Zolotarov /** 1063619c5cb6SVlad Zolotarov * Sets the pending bit according to the requested transition. 1064619c5cb6SVlad Zolotarov */ 1065619c5cb6SVlad Zolotarov int (*set_pending)(struct bnx2x_queue_sp_obj *o, 1066619c5cb6SVlad Zolotarov struct bnx2x_queue_state_params *params); 1067619c5cb6SVlad Zolotarov 1068619c5cb6SVlad Zolotarov /** 1069619c5cb6SVlad Zolotarov * Checks that the requested state transition is legal. 1070619c5cb6SVlad Zolotarov */ 1071619c5cb6SVlad Zolotarov int (*check_transition)(struct bnx2x *bp, 1072619c5cb6SVlad Zolotarov struct bnx2x_queue_sp_obj *o, 1073619c5cb6SVlad Zolotarov struct bnx2x_queue_state_params *params); 1074619c5cb6SVlad Zolotarov 1075619c5cb6SVlad Zolotarov /** 1076619c5cb6SVlad Zolotarov * Completes the pending command. 1077619c5cb6SVlad Zolotarov */ 1078619c5cb6SVlad Zolotarov int (*complete_cmd)(struct bnx2x *bp, 1079619c5cb6SVlad Zolotarov struct bnx2x_queue_sp_obj *o, 1080619c5cb6SVlad Zolotarov enum bnx2x_queue_cmd); 1081619c5cb6SVlad Zolotarov 1082619c5cb6SVlad Zolotarov int (*wait_comp)(struct bnx2x *bp, 1083619c5cb6SVlad Zolotarov struct bnx2x_queue_sp_obj *o, 1084619c5cb6SVlad Zolotarov enum bnx2x_queue_cmd cmd); 1085619c5cb6SVlad Zolotarov }; 1086619c5cb6SVlad Zolotarov 1087619c5cb6SVlad Zolotarov /********************** Function state update *********************************/ 1088619c5cb6SVlad Zolotarov /* Allowed Function states */ 1089619c5cb6SVlad Zolotarov enum bnx2x_func_state { 1090619c5cb6SVlad Zolotarov BNX2X_F_STATE_RESET, 1091619c5cb6SVlad Zolotarov BNX2X_F_STATE_INITIALIZED, 1092619c5cb6SVlad Zolotarov BNX2X_F_STATE_STARTED, 10936debea87SDmitry Kravkov BNX2X_F_STATE_TX_STOPPED, 1094619c5cb6SVlad Zolotarov BNX2X_F_STATE_MAX, 1095619c5cb6SVlad Zolotarov }; 1096619c5cb6SVlad Zolotarov 1097619c5cb6SVlad Zolotarov /* Allowed Function commands */ 1098619c5cb6SVlad Zolotarov enum bnx2x_func_cmd { 1099619c5cb6SVlad Zolotarov BNX2X_F_CMD_HW_INIT, 1100619c5cb6SVlad Zolotarov BNX2X_F_CMD_START, 1101619c5cb6SVlad Zolotarov BNX2X_F_CMD_STOP, 1102619c5cb6SVlad Zolotarov BNX2X_F_CMD_HW_RESET, 1103a3348722SBarak Witkowski BNX2X_F_CMD_AFEX_UPDATE, 1104a3348722SBarak Witkowski BNX2X_F_CMD_AFEX_VIFLISTS, 11056debea87SDmitry Kravkov BNX2X_F_CMD_TX_STOP, 11066debea87SDmitry Kravkov BNX2X_F_CMD_TX_START, 110755c11941SMerav Sicron BNX2X_F_CMD_SWITCH_UPDATE, 1108619c5cb6SVlad Zolotarov BNX2X_F_CMD_MAX, 1109619c5cb6SVlad Zolotarov }; 1110619c5cb6SVlad Zolotarov 1111619c5cb6SVlad Zolotarov struct bnx2x_func_hw_init_params { 1112619c5cb6SVlad Zolotarov /* A load phase returned by MCP. 1113619c5cb6SVlad Zolotarov * 1114619c5cb6SVlad Zolotarov * May be: 1115619c5cb6SVlad Zolotarov * FW_MSG_CODE_DRV_LOAD_COMMON_CHIP 1116619c5cb6SVlad Zolotarov * FW_MSG_CODE_DRV_LOAD_COMMON 1117619c5cb6SVlad Zolotarov * FW_MSG_CODE_DRV_LOAD_PORT 1118619c5cb6SVlad Zolotarov * FW_MSG_CODE_DRV_LOAD_FUNCTION 1119619c5cb6SVlad Zolotarov */ 1120619c5cb6SVlad Zolotarov u32 load_phase; 1121619c5cb6SVlad Zolotarov }; 1122619c5cb6SVlad Zolotarov 1123619c5cb6SVlad Zolotarov struct bnx2x_func_hw_reset_params { 1124619c5cb6SVlad Zolotarov /* A load phase returned by MCP. 1125619c5cb6SVlad Zolotarov * 1126619c5cb6SVlad Zolotarov * May be: 1127619c5cb6SVlad Zolotarov * FW_MSG_CODE_DRV_LOAD_COMMON_CHIP 1128619c5cb6SVlad Zolotarov * FW_MSG_CODE_DRV_LOAD_COMMON 1129619c5cb6SVlad Zolotarov * FW_MSG_CODE_DRV_LOAD_PORT 1130619c5cb6SVlad Zolotarov * FW_MSG_CODE_DRV_LOAD_FUNCTION 1131619c5cb6SVlad Zolotarov */ 1132619c5cb6SVlad Zolotarov u32 reset_phase; 1133619c5cb6SVlad Zolotarov }; 1134619c5cb6SVlad Zolotarov 1135619c5cb6SVlad Zolotarov struct bnx2x_func_start_params { 1136619c5cb6SVlad Zolotarov /* Multi Function mode: 1137619c5cb6SVlad Zolotarov * - Single Function 1138619c5cb6SVlad Zolotarov * - Switch Dependent 1139619c5cb6SVlad Zolotarov * - Switch Independent 1140619c5cb6SVlad Zolotarov */ 1141619c5cb6SVlad Zolotarov u16 mf_mode; 1142619c5cb6SVlad Zolotarov 1143619c5cb6SVlad Zolotarov /* Switch Dependent mode outer VLAN tag */ 1144619c5cb6SVlad Zolotarov u16 sd_vlan_tag; 1145619c5cb6SVlad Zolotarov 1146619c5cb6SVlad Zolotarov /* Function cos mode */ 1147619c5cb6SVlad Zolotarov u8 network_cos_mode; 11481bc277f7SDmitry Kravkov 11491bc277f7SDmitry Kravkov /* NVGRE classification enablement */ 11501bc277f7SDmitry Kravkov u8 nvgre_clss_en; 11511bc277f7SDmitry Kravkov 11521bc277f7SDmitry Kravkov /* NO_GRE_TUNNEL/NVGRE_TUNNEL/L2GRE_TUNNEL/IPGRE_TUNNEL */ 11531bc277f7SDmitry Kravkov u8 gre_tunnel_mode; 11541bc277f7SDmitry Kravkov 11551bc277f7SDmitry Kravkov /* GRE_OUTER_HEADERS_RSS/GRE_INNER_HEADERS_RSS/NVGRE_KEY_ENTROPY_RSS */ 11561bc277f7SDmitry Kravkov u8 gre_tunnel_rss; 1157619c5cb6SVlad Zolotarov }; 1158619c5cb6SVlad Zolotarov 115955c11941SMerav Sicron struct bnx2x_func_switch_update_params { 116055c11941SMerav Sicron u8 suspend; 116155c11941SMerav Sicron }; 116255c11941SMerav Sicron 1163a3348722SBarak Witkowski struct bnx2x_func_afex_update_params { 1164a3348722SBarak Witkowski u16 vif_id; 1165a3348722SBarak Witkowski u16 afex_default_vlan; 1166a3348722SBarak Witkowski u8 allowed_priorities; 1167a3348722SBarak Witkowski }; 1168a3348722SBarak Witkowski 1169a3348722SBarak Witkowski struct bnx2x_func_afex_viflists_params { 1170a3348722SBarak Witkowski u16 vif_list_index; 1171a3348722SBarak Witkowski u8 func_bit_map; 1172a3348722SBarak Witkowski u8 afex_vif_list_command; 1173a3348722SBarak Witkowski u8 func_to_clear; 1174a3348722SBarak Witkowski }; 11756debea87SDmitry Kravkov struct bnx2x_func_tx_start_params { 11766debea87SDmitry Kravkov struct priority_cos traffic_type_to_priority_cos[MAX_TRAFFIC_TYPES]; 11776debea87SDmitry Kravkov u8 dcb_enabled; 11786debea87SDmitry Kravkov u8 dcb_version; 11796debea87SDmitry Kravkov u8 dont_add_pri_0_en; 11806debea87SDmitry Kravkov }; 11816debea87SDmitry Kravkov 1182619c5cb6SVlad Zolotarov struct bnx2x_func_state_params { 1183619c5cb6SVlad Zolotarov struct bnx2x_func_sp_obj *f_obj; 1184619c5cb6SVlad Zolotarov 1185619c5cb6SVlad Zolotarov /* Current command */ 1186619c5cb6SVlad Zolotarov enum bnx2x_func_cmd cmd; 1187619c5cb6SVlad Zolotarov 1188619c5cb6SVlad Zolotarov /* may have RAMROD_COMP_WAIT set only */ 1189619c5cb6SVlad Zolotarov unsigned long ramrod_flags; 1190619c5cb6SVlad Zolotarov 1191619c5cb6SVlad Zolotarov /* Params according to the current command */ 1192619c5cb6SVlad Zolotarov union { 1193619c5cb6SVlad Zolotarov struct bnx2x_func_hw_init_params hw_init; 1194619c5cb6SVlad Zolotarov struct bnx2x_func_hw_reset_params hw_reset; 1195619c5cb6SVlad Zolotarov struct bnx2x_func_start_params start; 119655c11941SMerav Sicron struct bnx2x_func_switch_update_params switch_update; 1197a3348722SBarak Witkowski struct bnx2x_func_afex_update_params afex_update; 1198a3348722SBarak Witkowski struct bnx2x_func_afex_viflists_params afex_viflists; 11996debea87SDmitry Kravkov struct bnx2x_func_tx_start_params tx_start; 1200619c5cb6SVlad Zolotarov } params; 1201619c5cb6SVlad Zolotarov }; 1202619c5cb6SVlad Zolotarov 1203619c5cb6SVlad Zolotarov struct bnx2x_func_sp_drv_ops { 1204619c5cb6SVlad Zolotarov /* Init tool + runtime initialization: 1205619c5cb6SVlad Zolotarov * - Common Chip 1206619c5cb6SVlad Zolotarov * - Common (per Path) 1207619c5cb6SVlad Zolotarov * - Port 1208619c5cb6SVlad Zolotarov * - Function phases 1209619c5cb6SVlad Zolotarov */ 1210619c5cb6SVlad Zolotarov int (*init_hw_cmn_chip)(struct bnx2x *bp); 1211619c5cb6SVlad Zolotarov int (*init_hw_cmn)(struct bnx2x *bp); 1212619c5cb6SVlad Zolotarov int (*init_hw_port)(struct bnx2x *bp); 1213619c5cb6SVlad Zolotarov int (*init_hw_func)(struct bnx2x *bp); 1214619c5cb6SVlad Zolotarov 1215619c5cb6SVlad Zolotarov /* Reset Function HW: Common, Port, Function phases. */ 1216619c5cb6SVlad Zolotarov void (*reset_hw_cmn)(struct bnx2x *bp); 1217619c5cb6SVlad Zolotarov void (*reset_hw_port)(struct bnx2x *bp); 1218619c5cb6SVlad Zolotarov void (*reset_hw_func)(struct bnx2x *bp); 1219619c5cb6SVlad Zolotarov 1220619c5cb6SVlad Zolotarov /* Init/Free GUNZIP resources */ 1221619c5cb6SVlad Zolotarov int (*gunzip_init)(struct bnx2x *bp); 1222619c5cb6SVlad Zolotarov void (*gunzip_end)(struct bnx2x *bp); 1223619c5cb6SVlad Zolotarov 1224619c5cb6SVlad Zolotarov /* Prepare/Release FW resources */ 1225619c5cb6SVlad Zolotarov int (*init_fw)(struct bnx2x *bp); 1226619c5cb6SVlad Zolotarov void (*release_fw)(struct bnx2x *bp); 1227619c5cb6SVlad Zolotarov }; 1228619c5cb6SVlad Zolotarov 1229619c5cb6SVlad Zolotarov struct bnx2x_func_sp_obj { 1230619c5cb6SVlad Zolotarov enum bnx2x_func_state state, next_state; 1231619c5cb6SVlad Zolotarov 1232619c5cb6SVlad Zolotarov /* BNX2X_FUNC_CMD_XX bits. This object implements "one 1233619c5cb6SVlad Zolotarov * pending" paradigm but for debug and tracing purposes it's 123416a5fd92SYuval Mintz * more convenient to have different bits for different 1235619c5cb6SVlad Zolotarov * commands. 1236619c5cb6SVlad Zolotarov */ 1237619c5cb6SVlad Zolotarov unsigned long pending; 1238619c5cb6SVlad Zolotarov 1239619c5cb6SVlad Zolotarov /* Buffer to use as a ramrod data and its mapping */ 1240619c5cb6SVlad Zolotarov void *rdata; 1241619c5cb6SVlad Zolotarov dma_addr_t rdata_mapping; 1242619c5cb6SVlad Zolotarov 1243a3348722SBarak Witkowski /* Buffer to use as a afex ramrod data and its mapping. 1244a3348722SBarak Witkowski * This can't be same rdata as above because afex ramrod requests 1245a3348722SBarak Witkowski * can arrive to the object in parallel to other ramrod requests. 1246a3348722SBarak Witkowski */ 1247a3348722SBarak Witkowski void *afex_rdata; 1248a3348722SBarak Witkowski dma_addr_t afex_rdata_mapping; 1249a3348722SBarak Witkowski 1250619c5cb6SVlad Zolotarov /* this mutex validates that when pending flag is taken, the next 1251619c5cb6SVlad Zolotarov * ramrod to be sent will be the one set the pending bit 1252619c5cb6SVlad Zolotarov */ 1253619c5cb6SVlad Zolotarov struct mutex one_pending_mutex; 1254619c5cb6SVlad Zolotarov 1255619c5cb6SVlad Zolotarov /* Driver interface */ 1256619c5cb6SVlad Zolotarov struct bnx2x_func_sp_drv_ops *drv; 1257619c5cb6SVlad Zolotarov 1258619c5cb6SVlad Zolotarov /** 1259619c5cb6SVlad Zolotarov * Performs one state change according to the given parameters. 1260619c5cb6SVlad Zolotarov * 1261619c5cb6SVlad Zolotarov * @return 0 in case of success and negative value otherwise. 1262619c5cb6SVlad Zolotarov */ 1263619c5cb6SVlad Zolotarov int (*send_cmd)(struct bnx2x *bp, 1264619c5cb6SVlad Zolotarov struct bnx2x_func_state_params *params); 1265619c5cb6SVlad Zolotarov 1266619c5cb6SVlad Zolotarov /** 1267619c5cb6SVlad Zolotarov * Checks that the requested state transition is legal. 1268619c5cb6SVlad Zolotarov */ 1269619c5cb6SVlad Zolotarov int (*check_transition)(struct bnx2x *bp, 1270619c5cb6SVlad Zolotarov struct bnx2x_func_sp_obj *o, 1271619c5cb6SVlad Zolotarov struct bnx2x_func_state_params *params); 1272619c5cb6SVlad Zolotarov 1273619c5cb6SVlad Zolotarov /** 1274619c5cb6SVlad Zolotarov * Completes the pending command. 1275619c5cb6SVlad Zolotarov */ 1276619c5cb6SVlad Zolotarov int (*complete_cmd)(struct bnx2x *bp, 1277619c5cb6SVlad Zolotarov struct bnx2x_func_sp_obj *o, 1278619c5cb6SVlad Zolotarov enum bnx2x_func_cmd cmd); 1279619c5cb6SVlad Zolotarov 1280619c5cb6SVlad Zolotarov int (*wait_comp)(struct bnx2x *bp, struct bnx2x_func_sp_obj *o, 1281619c5cb6SVlad Zolotarov enum bnx2x_func_cmd cmd); 1282619c5cb6SVlad Zolotarov }; 1283619c5cb6SVlad Zolotarov 1284619c5cb6SVlad Zolotarov /********************** Interfaces ********************************************/ 1285619c5cb6SVlad Zolotarov /* Queueable objects set */ 1286619c5cb6SVlad Zolotarov union bnx2x_qable_obj { 1287619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj vlan_mac; 1288619c5cb6SVlad Zolotarov }; 1289619c5cb6SVlad Zolotarov /************** Function state update *********/ 1290619c5cb6SVlad Zolotarov void bnx2x_init_func_obj(struct bnx2x *bp, 1291619c5cb6SVlad Zolotarov struct bnx2x_func_sp_obj *obj, 1292619c5cb6SVlad Zolotarov void *rdata, dma_addr_t rdata_mapping, 1293a3348722SBarak Witkowski void *afex_rdata, dma_addr_t afex_rdata_mapping, 1294619c5cb6SVlad Zolotarov struct bnx2x_func_sp_drv_ops *drv_iface); 1295619c5cb6SVlad Zolotarov 1296619c5cb6SVlad Zolotarov int bnx2x_func_state_change(struct bnx2x *bp, 1297619c5cb6SVlad Zolotarov struct bnx2x_func_state_params *params); 1298619c5cb6SVlad Zolotarov 12996debea87SDmitry Kravkov enum bnx2x_func_state bnx2x_func_get_state(struct bnx2x *bp, 13006debea87SDmitry Kravkov struct bnx2x_func_sp_obj *o); 1301619c5cb6SVlad Zolotarov /******************* Queue State **************/ 1302619c5cb6SVlad Zolotarov void bnx2x_init_queue_obj(struct bnx2x *bp, 13036383c0b3SAriel Elior struct bnx2x_queue_sp_obj *obj, u8 cl_id, u32 *cids, 13046383c0b3SAriel Elior u8 cid_cnt, u8 func_id, void *rdata, 13056383c0b3SAriel Elior dma_addr_t rdata_mapping, unsigned long type); 1306619c5cb6SVlad Zolotarov 1307619c5cb6SVlad Zolotarov int bnx2x_queue_state_change(struct bnx2x *bp, 1308619c5cb6SVlad Zolotarov struct bnx2x_queue_state_params *params); 1309619c5cb6SVlad Zolotarov 131067c431a5SAriel Elior int bnx2x_get_q_logical_state(struct bnx2x *bp, 131167c431a5SAriel Elior struct bnx2x_queue_sp_obj *obj); 131267c431a5SAriel Elior 1313619c5cb6SVlad Zolotarov /********************* VLAN-MAC ****************/ 1314619c5cb6SVlad Zolotarov void bnx2x_init_mac_obj(struct bnx2x *bp, 1315619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj *mac_obj, 1316619c5cb6SVlad Zolotarov u8 cl_id, u32 cid, u8 func_id, void *rdata, 1317619c5cb6SVlad Zolotarov dma_addr_t rdata_mapping, int state, 1318619c5cb6SVlad Zolotarov unsigned long *pstate, bnx2x_obj_type type, 1319619c5cb6SVlad Zolotarov struct bnx2x_credit_pool_obj *macs_pool); 1320619c5cb6SVlad Zolotarov 1321619c5cb6SVlad Zolotarov void bnx2x_init_vlan_obj(struct bnx2x *bp, 1322619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj *vlan_obj, 1323619c5cb6SVlad Zolotarov u8 cl_id, u32 cid, u8 func_id, void *rdata, 1324619c5cb6SVlad Zolotarov dma_addr_t rdata_mapping, int state, 1325619c5cb6SVlad Zolotarov unsigned long *pstate, bnx2x_obj_type type, 1326619c5cb6SVlad Zolotarov struct bnx2x_credit_pool_obj *vlans_pool); 1327619c5cb6SVlad Zolotarov 13288b09be5fSYuval Mintz int bnx2x_vlan_mac_h_read_lock(struct bnx2x *bp, 13298b09be5fSYuval Mintz struct bnx2x_vlan_mac_obj *o); 13308b09be5fSYuval Mintz void bnx2x_vlan_mac_h_read_unlock(struct bnx2x *bp, 13318b09be5fSYuval Mintz struct bnx2x_vlan_mac_obj *o); 13328b09be5fSYuval Mintz int bnx2x_vlan_mac_h_write_lock(struct bnx2x *bp, 13338b09be5fSYuval Mintz struct bnx2x_vlan_mac_obj *o); 1334619c5cb6SVlad Zolotarov int bnx2x_config_vlan_mac(struct bnx2x *bp, 1335619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_ramrod_params *p); 1336619c5cb6SVlad Zolotarov 1337619c5cb6SVlad Zolotarov int bnx2x_vlan_mac_move(struct bnx2x *bp, 1338619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_ramrod_params *p, 1339619c5cb6SVlad Zolotarov struct bnx2x_vlan_mac_obj *dest_o); 1340619c5cb6SVlad Zolotarov 1341619c5cb6SVlad Zolotarov /********************* RX MODE ****************/ 1342619c5cb6SVlad Zolotarov 1343619c5cb6SVlad Zolotarov void bnx2x_init_rx_mode_obj(struct bnx2x *bp, 1344619c5cb6SVlad Zolotarov struct bnx2x_rx_mode_obj *o); 1345619c5cb6SVlad Zolotarov 1346619c5cb6SVlad Zolotarov /** 13471aa8b471SBen Hutchings * bnx2x_config_rx_mode - Send and RX_MODE ramrod according to the provided parameters. 1348619c5cb6SVlad Zolotarov * 13491aa8b471SBen Hutchings * @p: Command parameters 1350619c5cb6SVlad Zolotarov * 135116a5fd92SYuval Mintz * Return: 0 - if operation was successful and there is no pending completions, 1352619c5cb6SVlad Zolotarov * positive number - if there are pending completions, 1353619c5cb6SVlad Zolotarov * negative - if there were errors 1354619c5cb6SVlad Zolotarov */ 1355619c5cb6SVlad Zolotarov int bnx2x_config_rx_mode(struct bnx2x *bp, 1356619c5cb6SVlad Zolotarov struct bnx2x_rx_mode_ramrod_params *p); 1357619c5cb6SVlad Zolotarov 1358619c5cb6SVlad Zolotarov /****************** MULTICASTS ****************/ 1359619c5cb6SVlad Zolotarov 1360619c5cb6SVlad Zolotarov void bnx2x_init_mcast_obj(struct bnx2x *bp, 1361619c5cb6SVlad Zolotarov struct bnx2x_mcast_obj *mcast_obj, 1362619c5cb6SVlad Zolotarov u8 mcast_cl_id, u32 mcast_cid, u8 func_id, 1363619c5cb6SVlad Zolotarov u8 engine_id, void *rdata, dma_addr_t rdata_mapping, 1364619c5cb6SVlad Zolotarov int state, unsigned long *pstate, 1365619c5cb6SVlad Zolotarov bnx2x_obj_type type); 1366619c5cb6SVlad Zolotarov 1367619c5cb6SVlad Zolotarov /** 13681aa8b471SBen Hutchings * bnx2x_config_mcast - Configure multicast MACs list. 13691aa8b471SBen Hutchings * 13701aa8b471SBen Hutchings * @cmd: command to execute: BNX2X_MCAST_CMD_X 13711aa8b471SBen Hutchings * 13721aa8b471SBen Hutchings * May configure a new list 1373619c5cb6SVlad Zolotarov * provided in p->mcast_list (BNX2X_MCAST_CMD_ADD), clean up 1374619c5cb6SVlad Zolotarov * (BNX2X_MCAST_CMD_DEL) or restore (BNX2X_MCAST_CMD_RESTORE) a current 1375619c5cb6SVlad Zolotarov * configuration, continue to execute the pending commands 1376619c5cb6SVlad Zolotarov * (BNX2X_MCAST_CMD_CONT). 1377619c5cb6SVlad Zolotarov * 1378619c5cb6SVlad Zolotarov * If previous command is still pending or if number of MACs to 1379619c5cb6SVlad Zolotarov * configure is more that maximum number of MACs in one command, 1380619c5cb6SVlad Zolotarov * the current command will be enqueued to the tail of the 1381619c5cb6SVlad Zolotarov * pending commands list. 1382619c5cb6SVlad Zolotarov * 138316a5fd92SYuval Mintz * Return: 0 is operation was successful and there are no pending completions, 1384619c5cb6SVlad Zolotarov * negative if there were errors, positive if there are pending 1385619c5cb6SVlad Zolotarov * completions. 1386619c5cb6SVlad Zolotarov */ 1387619c5cb6SVlad Zolotarov int bnx2x_config_mcast(struct bnx2x *bp, 138886564c3fSYuval Mintz struct bnx2x_mcast_ramrod_params *p, 138986564c3fSYuval Mintz enum bnx2x_mcast_cmd cmd); 1390619c5cb6SVlad Zolotarov 1391619c5cb6SVlad Zolotarov /****************** CREDIT POOL ****************/ 1392619c5cb6SVlad Zolotarov void bnx2x_init_mac_credit_pool(struct bnx2x *bp, 1393619c5cb6SVlad Zolotarov struct bnx2x_credit_pool_obj *p, u8 func_id, 1394619c5cb6SVlad Zolotarov u8 func_num); 1395619c5cb6SVlad Zolotarov void bnx2x_init_vlan_credit_pool(struct bnx2x *bp, 1396619c5cb6SVlad Zolotarov struct bnx2x_credit_pool_obj *p, u8 func_id, 1397619c5cb6SVlad Zolotarov u8 func_num); 1398619c5cb6SVlad Zolotarov 1399619c5cb6SVlad Zolotarov /****************** RSS CONFIGURATION ****************/ 1400619c5cb6SVlad Zolotarov void bnx2x_init_rss_config_obj(struct bnx2x *bp, 1401619c5cb6SVlad Zolotarov struct bnx2x_rss_config_obj *rss_obj, 1402619c5cb6SVlad Zolotarov u8 cl_id, u32 cid, u8 func_id, u8 engine_id, 1403619c5cb6SVlad Zolotarov void *rdata, dma_addr_t rdata_mapping, 1404619c5cb6SVlad Zolotarov int state, unsigned long *pstate, 1405619c5cb6SVlad Zolotarov bnx2x_obj_type type); 1406619c5cb6SVlad Zolotarov 1407619c5cb6SVlad Zolotarov /** 14081aa8b471SBen Hutchings * bnx2x_config_rss - Updates RSS configuration according to provided parameters 1409619c5cb6SVlad Zolotarov * 14101aa8b471SBen Hutchings * Return: 0 in case of success 1411619c5cb6SVlad Zolotarov */ 1412619c5cb6SVlad Zolotarov int bnx2x_config_rss(struct bnx2x *bp, 1413619c5cb6SVlad Zolotarov struct bnx2x_config_rss_params *p); 1414619c5cb6SVlad Zolotarov 1415619c5cb6SVlad Zolotarov /** 14161aa8b471SBen Hutchings * bnx2x_get_rss_ind_table - Return the current ind_table configuration. 1417619c5cb6SVlad Zolotarov * 14181aa8b471SBen Hutchings * @ind_table: buffer to fill with the current indirection 1419619c5cb6SVlad Zolotarov * table content. Should be at least 1420619c5cb6SVlad Zolotarov * T_ETH_INDIRECTION_TABLE_SIZE bytes long. 1421619c5cb6SVlad Zolotarov */ 1422619c5cb6SVlad Zolotarov void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj, 1423619c5cb6SVlad Zolotarov u8 *ind_table); 1424619c5cb6SVlad Zolotarov 1425619c5cb6SVlad Zolotarov #endif /* BNX2X_SP_VERBS */ 1426