Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
0004  * Copyright (c) 2014- QLogic Corporation.
0005  * All rights reserved
0006  * www.qlogic.com
0007  *
0008  * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
0009  */
0010 
0011 #ifndef __BFA_PORT_H__
0012 #define __BFA_PORT_H__
0013 
0014 #include "bfa_defs_svc.h"
0015 #include "bfa_ioc.h"
0016 #include "bfa_cs.h"
0017 
0018 typedef void (*bfa_port_stats_cbfn_t) (void *dev, bfa_status_t status);
0019 typedef void (*bfa_port_endis_cbfn_t) (void *dev, bfa_status_t status);
0020 
0021 struct bfa_port_s {
0022     void                *dev;
0023     struct bfa_ioc_s        *ioc;
0024     struct bfa_trc_mod_s        *trcmod;
0025     u32         msgtag;
0026     bfa_boolean_t           stats_busy;
0027     struct bfa_mbox_cmd_s       stats_mb;
0028     bfa_port_stats_cbfn_t       stats_cbfn;
0029     void                *stats_cbarg;
0030     bfa_status_t            stats_status;
0031     time64_t            stats_reset_time;
0032     union bfa_port_stats_u      *stats;
0033     struct bfa_dma_s        stats_dma;
0034     bfa_boolean_t           endis_pending;
0035     struct bfa_mbox_cmd_s       endis_mb;
0036     bfa_port_endis_cbfn_t       endis_cbfn;
0037     void                *endis_cbarg;
0038     bfa_status_t            endis_status;
0039     struct bfa_ioc_notify_s     ioc_notify;
0040     bfa_boolean_t           pbc_disabled;
0041     bfa_boolean_t           dport_enabled;
0042     struct bfa_mem_dma_s        port_dma;
0043 };
0044 
0045 #define BFA_MEM_PORT_DMA(__bfa)     (&((__bfa)->modules.port.port_dma))
0046 
0047 void         bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
0048                 void *dev, struct bfa_trc_mod_s *trcmod);
0049 void    bfa_port_notify(void *arg, enum bfa_ioc_event_e event);
0050 
0051 bfa_status_t bfa_port_get_stats(struct bfa_port_s *port,
0052                  union bfa_port_stats_u *stats,
0053                  bfa_port_stats_cbfn_t cbfn, void *cbarg);
0054 bfa_status_t bfa_port_clear_stats(struct bfa_port_s *port,
0055                    bfa_port_stats_cbfn_t cbfn, void *cbarg);
0056 bfa_status_t bfa_port_enable(struct bfa_port_s *port,
0057                   bfa_port_endis_cbfn_t cbfn, void *cbarg);
0058 bfa_status_t bfa_port_disable(struct bfa_port_s *port,
0059                    bfa_port_endis_cbfn_t cbfn, void *cbarg);
0060 u32     bfa_port_meminfo(void);
0061 void         bfa_port_mem_claim(struct bfa_port_s *port,
0062                  u8 *dma_kva, u64 dma_pa);
0063 void    bfa_port_set_dportenabled(struct bfa_port_s *port,
0064                   bfa_boolean_t enabled);
0065 
0066 /*
0067  * CEE declaration
0068  */
0069 typedef void (*bfa_cee_get_attr_cbfn_t) (void *dev, bfa_status_t status);
0070 typedef void (*bfa_cee_get_stats_cbfn_t) (void *dev, bfa_status_t status);
0071 typedef void (*bfa_cee_reset_stats_cbfn_t) (void *dev, bfa_status_t status);
0072 
0073 struct bfa_cee_cbfn_s {
0074     bfa_cee_get_attr_cbfn_t     get_attr_cbfn;
0075     void                *get_attr_cbarg;
0076     bfa_cee_get_stats_cbfn_t    get_stats_cbfn;
0077     void                *get_stats_cbarg;
0078     bfa_cee_reset_stats_cbfn_t  reset_stats_cbfn;
0079     void                *reset_stats_cbarg;
0080 };
0081 
0082 struct bfa_cee_s {
0083     void *dev;
0084     bfa_boolean_t       get_attr_pending;
0085     bfa_boolean_t       get_stats_pending;
0086     bfa_boolean_t       reset_stats_pending;
0087     bfa_status_t        get_attr_status;
0088     bfa_status_t        get_stats_status;
0089     bfa_status_t        reset_stats_status;
0090     struct bfa_cee_cbfn_s   cbfn;
0091     struct bfa_ioc_notify_s ioc_notify;
0092     struct bfa_trc_mod_s    *trcmod;
0093     struct bfa_cee_attr_s   *attr;
0094     struct bfa_cee_stats_s  *stats;
0095     struct bfa_dma_s    attr_dma;
0096     struct bfa_dma_s    stats_dma;
0097     struct bfa_ioc_s    *ioc;
0098     struct bfa_mbox_cmd_s   get_cfg_mb;
0099     struct bfa_mbox_cmd_s   get_stats_mb;
0100     struct bfa_mbox_cmd_s   reset_stats_mb;
0101     struct bfa_mem_dma_s    cee_dma;
0102 };
0103 
0104 #define BFA_MEM_CEE_DMA(__bfa)  (&((__bfa)->modules.cee.cee_dma))
0105 
0106 u32 bfa_cee_meminfo(void);
0107 void    bfa_cee_mem_claim(struct bfa_cee_s *cee, u8 *dma_kva, u64 dma_pa);
0108 void    bfa_cee_attach(struct bfa_cee_s *cee,
0109             struct bfa_ioc_s *ioc, void *dev);
0110 bfa_status_t    bfa_cee_get_attr(struct bfa_cee_s *cee,
0111                 struct bfa_cee_attr_s *attr,
0112                 bfa_cee_get_attr_cbfn_t cbfn, void *cbarg);
0113 bfa_status_t    bfa_cee_get_stats(struct bfa_cee_s *cee,
0114                 struct bfa_cee_stats_s *stats,
0115                 bfa_cee_get_stats_cbfn_t cbfn, void *cbarg);
0116 bfa_status_t    bfa_cee_reset_stats(struct bfa_cee_s *cee,
0117                 bfa_cee_reset_stats_cbfn_t cbfn, void *cbarg);
0118 
0119 #endif  /* __BFA_PORT_H__ */