BE NIC driver - beclib header files
Subsystems (2)
PATCH 5/12 BE NIC driver - beclib header files
Signed-off-by Subbu Seetharaman <[email protected]>
--- drivers/message/beclib/beclib_ll.h | 570 ++++++++++++++++++++++++++++ drivers/message/beclib/beclib_private_ll.h | 298 +++++++++++++++ drivers/message/beclib/beclib_stats.h | 54 +++ drivers/message/beclib/beregister.h | 417 ++++++++++++++++++++ drivers/message/beclib/bestatus.h | 103 +++++ drivers/message/beclib/pch.h | 43 ++ 6 files changed, 1485 insertions(+), 0 deletions(-) create mode 100644 drivers/message/beclib/beclib_ll.h create mode 100644 drivers/message/beclib/beclib_private_ll.h create mode 100644 drivers/message/beclib/beclib_stats.h create mode 100644 drivers/message/beclib/beregister.h create mode 100644 drivers/message/beclib/bestatus.h create mode 100644 drivers/message/beclib/pch.h
drivers/message/beclib/beclib_ll.h new file +570 -0
@@ -0,0 +1,570 @@ +/* +* Copyright (C) 2005 - 2008 ServerEngines +* All rights reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. The full GNU General +* Public License is included in this distribution in the file called COPYING. +* +* Contact Information: +* [email protected] +* +* ServerEngines +* 209 N. Fair Oaks Ave +* Sunnyvale, CA 94085 +*/ +#ifndef __beclib_lower_h__ +#define __beclib_lower_h__ + +#include "beclib_common.h" /* High and low level API commonalities */ + +/*! +@brief +Internal memory descriptor for memory shared by both the host driver and +the controller +*/ +struct be_shared_mem_descriptor { +void *va;/*! virtual address */ +struct sa_sgl *sgl;/*! memory descriptor list */ +u32 tag;/*! memory tracking tag */ +} ; + +/*! +@brief +Locking structure for beklib. +*/ +struct be_lock { +spinlock_t lock; +unsigned long irql; +} ; + +/*! +@brief +Represents a Blade Engine chip. This is used to manage +global chip resources. Only the ARM uses this from the low +level API. +*/ +struct be_chip_object { +u32 magic; +atomic_t ref_count; +struct be_lock lock; +struct list_head function_list_head; + +} ; + +struct be_mcc_wrb_response_copy { +u16 length;/* bytes in response */ +u16 fwcmd_offset;/* offset within the wrb of the response */ +void *va;/* user's va to copy response into */ + +} ; + +struct be_mcc_wrb_context { + +MCC_WRB_CQE_CALLBACK internal_callback;/* Function to call on +completion */ +void *internal_callback_context;/* Parameter to pass +to completion function */ + +MCC_WRB_CQE_CALLBACK callback;/* Function to call on completion */ +void *callback_context;/* Parameter to pass to completion function */ + +BESTATUS *users_final_status;/* pointer to a local +variable for synchronous +commands */ +struct MCC_WRB_AMAP *wrb;/* pointer to original wrb for embedded +commands only */ +struct list_head next;/* links context structs together in +free list */ + +struct be_mcc_wrb_response_copy copy;/* Optional parameters to copy +embedded response to user's va */ + +#if defined(SA_DEBUG ) +u16 subsystem, opcode;/* Track this FWCMD for debug builds. */ +struct MCC_WRB_AMAP *ring_wrb; +u32 consumed_count; +#endif +} ; + +/*! +@brief +Represents a function object for network or storage. This +is used to manage per-function resources like MCC CQs, etc. +*/ +struct be_function_object { + +u32 magic;/*!< magic for detecting memory corruption. */ +struct be_chip_object *parent_chip; + +/* +*! Generic system abstraction (SA) device object for accessing +* registers, physical memory, etc. +*/ +struct sa_dev *sa_dev; + +u32 emulate;/* if set, MPU is not available. +Emulate everything. */ +u32 pend_queue_driving;/* if set, drive the queued WRBs +after releasing the WRB lock */ + +spinlock_t post_lock;/* lock for verifying one thread posting wrbs */ +spinlock_t cq_lock;/* lock for verifying one thread +processing cq */ +spinlock_t mcc_context_lock;/* lock for protecting mcc +context free list */ +unsigned long post_irq; +unsigned long cq_irq; + +atomic_t ref_count;/* # of objects referencing this funcobj */ +struct be_lock lock;/* synchronization lock */ +u32 type; +u32 pci_function_number; + +struct list_head function_list;/* for linking these objects together */ + +struct { +struct list_head pd_list_head;/* protection domain list */ +struct list_head cq_list_head;/* completion queue list */ +struct list_head eq_list_head;/* event queue list */ +struct list_head cxn_list_head;/* list of active +connections */ +struct list_head eth_sq_list_head;/* list of ethernet +send rings */ +struct list_head eth_rq_list_head;/* list of ether RX +rings */ +struct list_head rdma_qp_list_head;/* queue pair list */ + +struct be_mcc_object *mcc;/* mcc rings. */ +struct be_pd_object *pd_object;/* perceived PD 0 */ + +union { +struct { +struct list_head wrbq_list_head; +struct list_head defq_list_head; + } iscsi; + +struct { +struct list_head dq_list_head; +struct list_head sq_list_head; +struct list_head rq_list_head; + } networking; + }; + } links; + +struct { +struct MCC_MAILBOX_AMAP *va;/* VA to the mailbox */ +u64 pa;/* PA to the mailbox */ +u32 length;/* byte length of mailbox */ + +/* One default context struct used for posting at +* least one MCC_WRB +*/ +struct be_mcc_wrb_context default_context; +bool default_context_allocated; + } mailbox; + +struct { +/* Page table */ +u32 num_page_table; +u32 num_sgl; + +/* Wake on lans configured. */ +u32 wol_bitmask;/* bits 0,1,2,3 are set if +corresponding index is enabled */ +u32 num_jell; +u32 num_vlan; +u32 num_template; +u32 num_multicast; +u32 rss_type; +u32 num_zero; +u32 num_ooo; + } config; + +u32 own_semaphore; +unsigned long current_irql; + +struct BE_FIRMWARE_CONFIG fw_config; +struct beclib_function_stats stats; +} ; + +/*! +@brief +Represents a protection domain +*/ +struct be_pd_object { +u32 magic; +atomic_t ref_count; + +struct be_function_object *parent_function; +struct list_head pd_list; + +u32 pd_id; +u8 *pd_page_va; +u64 pd_page_pa; + +} ; + +/*! +@brief +Represents an Event Queue +*/ +struct be_eq_object { +u32 magic; +atomic_t ref_count; +struct be_lock lock; + +struct be_function_object *parent_function; + +struct list_head eq_list; +struct list_head cq_list_head; + +u32 eq_id; +EQ_CALLBACK callback; +void *callback_context; + +} ; + +/*! +@brief +Manages a completion queue +*/ +struct be_cq_object { +u32 magic; +atomic_t ref_count; + +struct be_function_object *parent_function; +struct be_eq_object *eq_object; + +struct list_head cq_list; +struct list_head cqlist_for_eq; + +void *va; +u32 num_entries; + +CQ_CALLBACK callback; +void *callback_context; + +u32 cq_id; + +} ; + +/*! +@brief +Manages an ethernet send queue +*/ +struct be_ethsq_object { +u32 magic; + +struct list_head list; + +struct be_function_object *parent_function; +struct be_cq_object *cq_object; +u32 bid; + +} ; + +/*! +@brief +Manages an ethernet receive queue +*/ +struct be_ethrq_object { +u32 magic; +struct list_head list; +struct be_function_object *parent_function; +u32 rid; +struct be_cq_object *cq_object; +struct be_cq_object *rss_cq_object[4 ]; + +} ; + +/*! +@brief +Manages an MCC +*/ +struct be_mcc_object { +u32 magic; + +struct be_function_object *parent_function; +struct list_head mcc_list; + +struct be_cq_object *cq_object; + +/* Async event callback for MCC CQ. */ +MCC_ASYNC_EVENT_CALLBACK async_callback; +void *async_context; + +struct { +struct be_mcc_wrb_context *base; +u32 num; +struct list_head list_head; + } wrb_context; + +struct { +struct sa_sgl *sgl; +struct be_shared_mem_descriptor sm_descriptor; +struct sa_ring ring; + } sq; + +struct { +struct be_shared_mem_descriptor sm_descriptor; +struct sa_ring ring; + } cq; + +u32 processing;/* flag indicating that one thread +is processing CQ */ +u32 rearm;/* doorbell rearm setting to make +sure the active processing thread */ +/* rearms the CQ if any of the threads requested it. */ + +struct list_head backlog; +u32 backlog_length; +u32 driving_backlog; +u32 consumed_index; + +} ; + +/*! +@brief +Manages an iSCSI default PDU +*/ +struct be_default_pdu_queue_object { +u32 magic; + +struct be_function_object *parent_function; +struct list_head func_list; +struct be_cq_object *cq_object; +struct sa_sgl *sgl; +u32 rid; +} ; + +struct be_iscsi_wrb_queue_object { + +u32 magic; + +struct be_function_object *parent_function; + +struct list_head wrbq_list; + +/*u32 cra, length; */ +u32 cid; +struct sa_sgl *sgl; +u32 length; + +} ; + +/*! +@brief +Manages iSCSI connection resources like CID, WRB ring, etc. +*/ +struct be_iscsi_connection_object { +u32 magic; +struct be_function_object *parent_function; + +struct be_cq_object *cq; +struct be_iscsi_wrb_queue_object *wrbq; +struct be_default_pdu_queue_object *defq; + +struct list_head connection_list; +} ; + +/* Queue context header -- the required software information for +* queueing a WRB. +*/ +struct be_queue_driver_context { +MCC_WRB_CQE_CALLBACK internal_callback;/* Function to call on +completion */ +void *internal_callback_context;/* Parameter to pass +to completion function */ + +MCC_WRB_CQE_CALLBACK callback;/* Function to call on completion */ +void *callback_context;/* Parameter to pass to completion function */ + +struct be_mcc_wrb_response_copy copy;/* Optional parameters to copy +embedded response to user's va */ + +void *optional_fwcmd_va; + +struct list_head list; + +u32 bytes; + +} ; + +/* +* Common MCC WRB header that all commands require. +*/ +struct be_mcc_wrb_header { +u8 rsvd[AMAP_BYTE_OFFSET (MCC_WRB , payload)]; +} ; +SA_GLOBAL_C_ASSERT (queue_header, +sizeof (struct be_mcc_wrb_header ) ==AMAP_BYTE_OFFSET (MCC_WRB , payload)); + +/* +* All non embedded commands supported by beclib functions only allow +* 1 SGE. This queue context handles them all. +*/ +struct be_nonembedded_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct MCC_SGE_AMAP sge[1 ]; +} ; + +/* +* ------------------------------------------------------------------------ +* This section contains the specific queue struct for each command. +* The user could always provide a be_generic_queue_context but this is a +* rather large struct. By using the specific struct, memory consumption +* can be reduced. +* ------------------------------------------------------------------------ +*/ + +struct be_link_status_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_COMMON_NTWK_LINK_STATUS_QUERY fwcmd; +} ; + +struct be_multicast_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_COMMON_NTWK_MULTICAST_SET fwcmd; +} ; + +struct be_wake_on_lan_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_ETH_ACPI_CONFIG fwcmd; +} ; + +struct be_vlan_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_COMMON_NTWK_VLAN_CONFIG fwcmd; +} ; + +struct be_promiscuous_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_ETH_PROMISCUOUS fwcmd; +} ; + +struct be_force_failover_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_COMMON_FORCE_FAILOVER fwcmd; +} ; + + +struct be_nop_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_COMMON_NOP fwcmd; +} ; + +struct be_rxf_filter_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_COMMON_NTWK_RX_FILTER fwcmd; +} ; + +struct be_eq_modify_delay_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct FWCMD_COMMON_MODIFY_EQ_DELAY fwcmd; +} ; + +/* +* The generic context is the largest size that would be required. +* It is the software context plus an entire WRB. +*/ +struct be_generic_queue_context { +struct be_queue_driver_context context; +struct be_mcc_wrb_header wrb_header; +struct MCC_WRB_PAYLOAD_AMAP payload; +} ; + +SA_GLOBAL_C_ASSERT (generic_queue_context, +sizeof (struct be_generic_queue_context ) >= +sizeof (struct be_queue_driver_context ) +sizeof (struct MCC_WRB_AMAP )); +/* +* Types for the BE_QUEUE_CONTEXT object. +*/ +#define BE_QUEUE_INVALID (0) +#define BE_QUEUE_LINK_STATUS (0xA006) +#define BE_QUEUE_ETH_STATS (0xA007) +#define BE_QUEUE_TPM_STATS (0xA008) +#define BE_QUEUE_TCP_STATS (0xA009) +#define BE_QUEUE_MULTICAST (0xA00A) +#define BE_QUEUE_VLAN (0xA00B) +#define BE_QUEUE_RSS (0xA00C) +#define BE_QUEUE_FORCE_FAILOVER (0xA00D) +#define BE_QUEUE_PROMISCUOUS (0xA00E) +#define BE_QUEUE_WAKE_ON_LAN (0xA00F) +#define BE_QUEUE_NOP (0xA010) + +#include "beclib_ll_enum_nic.h" +#include "beclib_ll_bmap_nic.h" +/* +* ---------------------------------------------------------------------- +* API MACROS +* ---------------------------------------------------------------------- +*/ +#define BE_FWCMD_NAME (_short_name_) FWCMD_##_short_name_ +#define BE_OPCODE_NAME (_short_name_) OPCODE_##_short_name_ +#define BE_SUBSYSTEM_NAME (_short_name_) SUBSYSTEM_##_short_name_ + + +#define BE_PREPARE_EMBEDDED_FWCMD (_pfob_, _wrb_, _short_name_) \ + ((struct BE_FWCMD_NAME(_short_name_) *) \ + be_function_prepare_embedded_fwcmd(_pfob_, _wrb_, \ + sizeof(struct BE_FWCMD_NAME(_short_name_)), \ + SA_SIZEOF_FIELD(BE_FWCMD_NAME(_short_name_), params.request), \ + SA_SIZEOF_FIELD(BE_FWCMD_NAME(_short_name_), params.response), \ + BE_OPCODE_NAME(_short_name_), \ + BE_SUBSYSTEM_NAME(_short_name_))); + +#define BE_PREPARE_NONEMBEDDED_FWCMD (_pfob_, _wrb_, _iva_, _ipa_, _short_name_)\ + ((struct BE_FWCMD_NAME(_short_name_) *) \ + be_function_prepare_nonembedded_fwcmd(_pfob_, _wrb_, (_iva_), (_ipa_), \ + sizeof(struct BE_FWCMD_NAME(_short_name_)), \ + SA_SIZEOF_FIELD(BE_FWCMD_NAME(_short_name_), params.request), \ + SA_SIZEOF_FIELD(BE_FWCMD_NAME(_short_name_), params.response), \ + BE_OPCODE_NAME(_short_name_), \ + BE_SUBSYSTEM_NAME(_short_name_))); +/* +* ---------------------------------------------------------------------- +* API Inline Functions +* ---------------------------------------------------------------------- +* Returns TRUE for the ISCSI function +*/ +static inline bool +be_function_is_iscsi (struct be_function_object *pfob) +{ +return (pfob->type ==BE_FUNCTION_TYPE_ISCSI ); +} + +/* Returns TRUE for the networking function */ +static inline bool +be_function_is_networking (struct be_function_object *pfob) +{ +return (pfob->type ==BE_FUNCTION_TYPE_NETWORK ); +} + +static inline void +be_function_copy_stats (struct be_function_object *pfob, +struct beclib_function_stats *stats) +{ +memcpy (stats, &pfob->stats, (size_t )sizeof (pfob->stats)); + +} + +/* Returns a pointer to the parent chip object for this function. */ +static inline struct be_chip_object * +be_function_get_chip_object (struct be_function_object *pfob) +{ +return (pfob->parent_chip); +} + +#endif /* __beclib_lower__ */
drivers/message/beclib/beclib_private_ll.h new file +298 -0
298 lines not on this page · raw message
drivers/message/beclib/beclib_stats.h new file +54 -0
54 lines not on this page · raw message
drivers/message/beclib/beregister.h new file +417 -0
417 lines not on this page · raw message
drivers/message/beclib/bestatus.h new file +103 -0
103 lines not on this page · raw message
drivers/message/beclib/pch.h new file +43 -0
43 lines not on this page · raw message
Signature · 8 lines
1.5.5 ___________________________________________________________________________________ This message, together with any attachment(s), contains confidential and proprietary information of ServerEngines Corporation and is intended only for the designated recipient(s) named above. Any unauthorized review, printing, retention, copying, disclosure or distribution is strictly prohibited. If you are not the intended recipient of this message, please immediately advise the sender by reply email message and delete all copies of this message and any attachment(s). Thank you.