/* * bfa_port_enable_isr() * * * @param[in] port - Pointer to the port module * status - Return status from the f/w * * @return void
*/ staticvoid
bfa_port_enable_isr(struct bfa_port_s *port, bfa_status_t status)
{
bfa_trc(port, status);
port->endis_pending = BFA_FALSE;
port->endis_cbfn(port->endis_cbarg, status);
}
/* * bfa_port_disable_isr() * * * @param[in] port - Pointer to the port module * status - Return status from the f/w * * @return void
*/ staticvoid
bfa_port_disable_isr(struct bfa_port_s *port, bfa_status_t status)
{
bfa_trc(port, status);
port->endis_pending = BFA_FALSE;
port->endis_cbfn(port->endis_cbarg, status);
}
/* * bfa_port_get_stats_isr() * * * @param[in] port - Pointer to the Port module * status - Return status from the f/w * * @return void
*/ staticvoid
bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
{
port->stats_status = status;
port->stats_busy = BFA_FALSE;
if (port->stats_cbfn) {
port->stats_cbfn(port->stats_cbarg, status);
port->stats_cbfn = NULL;
}
}
/* * bfa_port_clear_stats_isr() * * * @param[in] port - Pointer to the Port module * status - Return status from the f/w * * @return void
*/ staticvoid
bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status)
{
port->stats_status = status;
port->stats_busy = BFA_FALSE;
/* * re-initialize time stamp for stats reset
*/
port->stats_reset_time = ktime_get_seconds();
if (port->stats_cbfn) {
port->stats_cbfn(port->stats_cbarg, status);
port->stats_cbfn = NULL;
}
}
/* * bfa_port_isr() * * * @param[in] Pointer to the Port module data structure. * * @return void
*/ staticvoid
bfa_port_isr(void *cbarg, struct bfi_mbmsg_s *m)
{ struct bfa_port_s *port = (struct bfa_port_s *) cbarg; union bfi_port_i2h_msg_u *i2hmsg;
i2hmsg = (union bfi_port_i2h_msg_u *) m;
bfa_trc(port, m->mh.msg_id);
switch (m->mh.msg_id) { case BFI_PORT_I2H_ENABLE_RSP: if (port->endis_pending == BFA_FALSE) break;
bfa_port_enable_isr(port, i2hmsg->enable_rsp.status); break;
case BFI_PORT_I2H_DISABLE_RSP: if (port->endis_pending == BFA_FALSE) break;
bfa_port_disable_isr(port, i2hmsg->disable_rsp.status); break;
case BFI_PORT_I2H_GET_STATS_RSP: /* Stats busy flag is still set? (may be cmd timed out) */ if (port->stats_busy == BFA_FALSE) break;
bfa_port_get_stats_isr(port, i2hmsg->getstats_rsp.status); break;
case BFI_PORT_I2H_CLEAR_STATS_RSP: if (port->stats_busy == BFA_FALSE) break;
bfa_port_clear_stats_isr(port, i2hmsg->clearstats_rsp.status); break;
/* * bfa_port_mem_claim() * * * @param[in] port Port module pointer * dma_kva Kernel Virtual Address of Port DMA Memory * dma_pa Physical Address of Port DMA Memory * * @return void
*/ void
bfa_port_mem_claim(struct bfa_port_s *port, u8 *dma_kva, u64 dma_pa)
{
port->stats_dma.kva = dma_kva;
port->stats_dma.pa = dma_pa;
}
/* * bfa_port_enable() * * Send the Port enable request to the f/w * * @param[in] Pointer to the Port module data structure. * * @return Status
*/
bfa_status_t
bfa_port_enable(struct bfa_port_s *port, bfa_port_endis_cbfn_t cbfn, void *cbarg)
{ struct bfi_port_generic_req_s *m;
/* If port is PBC disabled, return error */ if (port->pbc_disabled) {
bfa_trc(port, BFA_STATUS_PBC); return BFA_STATUS_PBC;
}
if (bfa_ioc_is_disabled(port->ioc)) {
bfa_trc(port, BFA_STATUS_IOC_DISABLED); return BFA_STATUS_IOC_DISABLED;
}
if (!bfa_ioc_is_operational(port->ioc)) {
bfa_trc(port, BFA_STATUS_IOC_FAILURE); return BFA_STATUS_IOC_FAILURE;
}
/* if port is d-port enabled, return error */ if (port->dport_enabled) {
bfa_trc(port, BFA_STATUS_DPORT_ERR); return BFA_STATUS_DPORT_ERR;
}
if (port->endis_pending) {
bfa_trc(port, BFA_STATUS_DEVBUSY); return BFA_STATUS_DEVBUSY;
}
m = (struct bfi_port_generic_req_s *) port->endis_mb.msg;
/* * bfa_port_disable() * * Send the Port disable request to the f/w * * @param[in] Pointer to the Port module data structure. * * @return Status
*/
bfa_status_t
bfa_port_disable(struct bfa_port_s *port, bfa_port_endis_cbfn_t cbfn, void *cbarg)
{ struct bfi_port_generic_req_s *m;
/* If port is PBC disabled, return error */ if (port->pbc_disabled) {
bfa_trc(port, BFA_STATUS_PBC); return BFA_STATUS_PBC;
}
if (bfa_ioc_is_disabled(port->ioc)) {
bfa_trc(port, BFA_STATUS_IOC_DISABLED); return BFA_STATUS_IOC_DISABLED;
}
if (!bfa_ioc_is_operational(port->ioc)) {
bfa_trc(port, BFA_STATUS_IOC_FAILURE); return BFA_STATUS_IOC_FAILURE;
}
/* if port is d-port enabled, return error */ if (port->dport_enabled) {
bfa_trc(port, BFA_STATUS_DPORT_ERR); return BFA_STATUS_DPORT_ERR;
}
if (port->endis_pending) {
bfa_trc(port, BFA_STATUS_DEVBUSY); return BFA_STATUS_DEVBUSY;
}
m = (struct bfi_port_generic_req_s *) port->endis_mb.msg;
/* * bfa_port_get_stats() * * Send the request to the f/w to fetch Port statistics. * * @param[in] Pointer to the Port module data structure. * * @return Status
*/
bfa_status_t
bfa_port_get_stats(struct bfa_port_s *port, union bfa_port_stats_u *stats,
bfa_port_stats_cbfn_t cbfn, void *cbarg)
{ struct bfi_port_get_stats_req_s *m;
if (!bfa_ioc_is_operational(port->ioc)) {
bfa_trc(port, BFA_STATUS_IOC_FAILURE); return BFA_STATUS_IOC_FAILURE;
}
if (port->stats_busy) {
bfa_trc(port, BFA_STATUS_DEVBUSY); return BFA_STATUS_DEVBUSY;
}
m = (struct bfi_port_get_stats_req_s *) port->stats_mb.msg;
/* * bfa_port_attach() * * * @param[in] port - Pointer to the Port module data structure * ioc - Pointer to the ioc module data structure * dev - Pointer to the device driver module data structure * The device driver specific mbox ISR functions have * this pointer as one of the parameters. * trcmod - * * @return void
*/ void
bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, void *dev, struct bfa_trc_mod_s *trcmod)
{
WARN_ON(!port);
/* * initialize time stamp for stats reset
*/
port->stats_reset_time = ktime_get_seconds();
bfa_trc(port, 0);
}
/* * bfa_port_set_dportenabled(); * * Port module- set pbc disabled flag * * @param[in] port - Pointer to the Port module data structure * * @return void
*/ void
bfa_port_set_dportenabled(struct bfa_port_s *port, bfa_boolean_t enabled)
{
port->dport_enabled = enabled;
}
/* * CEE module specific definitions
*/
/* * bfa_cee_get_attr_isr() * * @brief CEE ISR for get-attributes responses from f/w * * @param[in] cee - Pointer to the CEE module * status - Return status from the f/w * * @return void
*/ staticvoid
bfa_cee_get_attr_isr(struct bfa_cee_s *cee, bfa_status_t status)
{ struct bfa_cee_lldp_cfg_s *lldp_cfg = &cee->attr->lldp_remote;
/* * bfa_cee_get_attr() * * @brief * Send the request to the f/w to fetch CEE attributes. * * @param[in] Pointer to the CEE module data structure. * * @return Status
*/
/* * bfa_cee_get_stats() * * @brief * Send the request to the f/w to fetch CEE statistics. * * @param[in] Pointer to the CEE module data structure. * * @return Status
*/
switch (event) { case BFA_IOC_E_DISABLED: case BFA_IOC_E_FAILED: if (cee->get_attr_pending == BFA_TRUE) {
cee->get_attr_status = BFA_STATUS_FAILED;
cee->get_attr_pending = BFA_FALSE; if (cee->cbfn.get_attr_cbfn) {
cee->cbfn.get_attr_cbfn(
cee->cbfn.get_attr_cbarg,
BFA_STATUS_FAILED);
}
} if (cee->get_stats_pending == BFA_TRUE) {
cee->get_stats_status = BFA_STATUS_FAILED;
cee->get_stats_pending = BFA_FALSE; if (cee->cbfn.get_stats_cbfn) {
cee->cbfn.get_stats_cbfn(
cee->cbfn.get_stats_cbarg,
BFA_STATUS_FAILED);
}
} if (cee->reset_stats_pending == BFA_TRUE) {
cee->reset_stats_status = BFA_STATUS_FAILED;
cee->reset_stats_pending = BFA_FALSE; if (cee->cbfn.reset_stats_cbfn) {
cee->cbfn.reset_stats_cbfn(
cee->cbfn.reset_stats_cbarg,
BFA_STATUS_FAILED);
}
} break;
default: break;
}
}
/* * bfa_cee_attach() * * @brief CEE module-attach API * * @param[in] cee - Pointer to the CEE module data structure * ioc - Pointer to the ioc module data structure * dev - Pointer to the device driver module data structure * The device driver specific mbox ISR functions have * this pointer as one of the parameters. * * @return void
*/ void
bfa_cee_attach(struct bfa_cee_s *cee, struct bfa_ioc_s *ioc, void *dev)
{
WARN_ON(cee == NULL);
cee->dev = dev;
cee->ioc = ioc;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.