Linux Audio

Check our new training course

Loading...
v6.8
  1/* Broadcom NetXtreme-C/E network driver.
  2 *
  3 * Copyright (c) 2016-2018 Broadcom Limited
  4 *
  5 * This program is free software; you can redistribute it and/or modify
  6 * it under the terms of the GNU General Public License as published by
  7 * the Free Software Foundation.
  8 */
  9
 10#ifndef BNXT_ULP_H
 11#define BNXT_ULP_H
 12
 13#define BNXT_ROCE_ULP	0
 14#define BNXT_MAX_ULP	1
 
 15
 16#define BNXT_MIN_ROCE_CP_RINGS	2
 17#define BNXT_MIN_ROCE_STAT_CTXS	1
 18#define BNXT_MAX_ROCE_MSIX	9
 19#define BNXT_MAX_VF_ROCE_MSIX	2
 20
 21struct hwrm_async_event_cmpl;
 22struct bnxt;
 23
 24struct bnxt_msix_entry {
 25	u32	vector;
 26	u32	ring_idx;
 27	u32	db_offset;
 28};
 29
 30struct bnxt_ulp_ops {
 
 
 
 
 
 
 31	void (*ulp_irq_stop)(void *);
 32	void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *);
 33};
 34
 35struct bnxt_fw_msg {
 36	void	*msg;
 37	int	msg_len;
 38	void	*resp;
 39	int	resp_max_len;
 40	int	timeout;
 41};
 42
 43struct bnxt_ulp {
 44	void		*handle;
 45	struct bnxt_ulp_ops __rcu *ulp_ops;
 46	unsigned long	*async_events_bmap;
 47	u16		max_async_event_id;
 48	u16		msix_requested;
 49	u16		msix_base;
 50	atomic_t	ref_count;
 51};
 52
 53struct bnxt_en_dev {
 54	struct net_device *net;
 55	struct pci_dev *pdev;
 56	struct bnxt_msix_entry			msix_entries[BNXT_MAX_ROCE_MSIX];
 57	u32 flags;
 58	#define BNXT_EN_FLAG_ROCEV1_CAP		0x1
 59	#define BNXT_EN_FLAG_ROCEV2_CAP		0x2
 60	#define BNXT_EN_FLAG_ROCE_CAP		(BNXT_EN_FLAG_ROCEV1_CAP | \
 61						 BNXT_EN_FLAG_ROCEV2_CAP)
 62	#define BNXT_EN_FLAG_MSIX_REQUESTED	0x4
 63	#define BNXT_EN_FLAG_ULP_STOPPED	0x8
 64	#define BNXT_EN_FLAG_VF			0x10
 65#define BNXT_EN_VF(edev)	((edev)->flags & BNXT_EN_FLAG_VF)
 66
 67	struct bnxt_ulp			*ulp_tbl;
 68	int				l2_db_size;	/* Doorbell BAR size in
 69							 * bytes mapped by L2
 70							 * driver.
 71							 */
 72	int				l2_db_size_nc;	/* Doorbell BAR size in
 73							 * bytes mapped as non-
 74							 * cacheable.
 75							 */
 76	int				l2_db_offset;	/* Doorbell offset in
 77							 * bytes within
 78							 * l2_db_size_nc.
 79							 */
 80	u16				chip_num;
 81	u16				hw_ring_stats_size;
 82	u16				pf_port_id;
 83	unsigned long			en_state;	/* Could be checked in
 84							 * RoCE driver suspend
 85							 * mode only. Will be
 86							 * updated in resume.
 87							 */
 88	void __iomem                    *bar0;
 89};
 90
 91static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev)
 
 
 
 
 
 
 
 
 
 
 
 
 
 92{
 93	if (edev && edev->ulp_tbl)
 94		return true;
 95	return false;
 96}
 97
 98int bnxt_get_ulp_msix_num(struct bnxt *bp);
 99int bnxt_get_ulp_msix_base(struct bnxt *bp);
100int bnxt_get_ulp_stat_ctxs(struct bnxt *bp);
101void bnxt_ulp_stop(struct bnxt *bp);
102void bnxt_ulp_start(struct bnxt *bp, int err);
103void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs);
 
104void bnxt_ulp_irq_stop(struct bnxt *bp);
105void bnxt_ulp_irq_restart(struct bnxt *bp, int err);
106void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl);
107void bnxt_rdma_aux_device_uninit(struct bnxt *bp);
108void bnxt_rdma_aux_device_init(struct bnxt *bp);
109int bnxt_register_dev(struct bnxt_en_dev *edev, struct bnxt_ulp_ops *ulp_ops,
110		      void *handle);
111void bnxt_unregister_dev(struct bnxt_en_dev *edev);
112int bnxt_send_msg(struct bnxt_en_dev *edev, struct bnxt_fw_msg *fw_msg);
113int bnxt_register_async_events(struct bnxt_en_dev *edev,
114			       unsigned long *events_bmap, u16 max_id);
115#endif
v5.9
  1/* Broadcom NetXtreme-C/E network driver.
  2 *
  3 * Copyright (c) 2016-2018 Broadcom Limited
  4 *
  5 * This program is free software; you can redistribute it and/or modify
  6 * it under the terms of the GNU General Public License as published by
  7 * the Free Software Foundation.
  8 */
  9
 10#ifndef BNXT_ULP_H
 11#define BNXT_ULP_H
 12
 13#define BNXT_ROCE_ULP	0
 14#define BNXT_OTHER_ULP	1
 15#define BNXT_MAX_ULP	2
 16
 17#define BNXT_MIN_ROCE_CP_RINGS	2
 18#define BNXT_MIN_ROCE_STAT_CTXS	1
 
 
 19
 20struct hwrm_async_event_cmpl;
 21struct bnxt;
 22
 23struct bnxt_msix_entry {
 24	u32	vector;
 25	u32	ring_idx;
 26	u32	db_offset;
 27};
 28
 29struct bnxt_ulp_ops {
 30	/* async_notifier() cannot sleep (in BH context) */
 31	void (*ulp_async_notifier)(void *, struct hwrm_async_event_cmpl *);
 32	void (*ulp_stop)(void *);
 33	void (*ulp_start)(void *);
 34	void (*ulp_sriov_config)(void *, int);
 35	void (*ulp_shutdown)(void *);
 36	void (*ulp_irq_stop)(void *);
 37	void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *);
 38};
 39
 40struct bnxt_fw_msg {
 41	void	*msg;
 42	int	msg_len;
 43	void	*resp;
 44	int	resp_max_len;
 45	int	timeout;
 46};
 47
 48struct bnxt_ulp {
 49	void		*handle;
 50	struct bnxt_ulp_ops __rcu *ulp_ops;
 51	unsigned long	*async_events_bmap;
 52	u16		max_async_event_id;
 53	u16		msix_requested;
 54	u16		msix_base;
 55	atomic_t	ref_count;
 56};
 57
 58struct bnxt_en_dev {
 59	struct net_device *net;
 60	struct pci_dev *pdev;
 
 61	u32 flags;
 62	#define BNXT_EN_FLAG_ROCEV1_CAP		0x1
 63	#define BNXT_EN_FLAG_ROCEV2_CAP		0x2
 64	#define BNXT_EN_FLAG_ROCE_CAP		(BNXT_EN_FLAG_ROCEV1_CAP | \
 65						 BNXT_EN_FLAG_ROCEV2_CAP)
 66	#define BNXT_EN_FLAG_MSIX_REQUESTED	0x4
 67	#define BNXT_EN_FLAG_ULP_STOPPED	0x8
 68	const struct bnxt_en_ops	*en_ops;
 69	struct bnxt_ulp			ulp_tbl[BNXT_MAX_ULP];
 
 
 70	int				l2_db_size;	/* Doorbell BAR size in
 71							 * bytes mapped by L2
 72							 * driver.
 73							 */
 74	int				l2_db_size_nc;	/* Doorbell BAR size in
 75							 * bytes mapped as non-
 76							 * cacheable.
 77							 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 78};
 79
 80struct bnxt_en_ops {
 81	int (*bnxt_register_device)(struct bnxt_en_dev *, int,
 82				    struct bnxt_ulp_ops *, void *);
 83	int (*bnxt_unregister_device)(struct bnxt_en_dev *, int);
 84	int (*bnxt_request_msix)(struct bnxt_en_dev *, int,
 85				 struct bnxt_msix_entry *, int);
 86	int (*bnxt_free_msix)(struct bnxt_en_dev *, int);
 87	int (*bnxt_send_fw_msg)(struct bnxt_en_dev *, int,
 88				struct bnxt_fw_msg *);
 89	int (*bnxt_register_fw_async_events)(struct bnxt_en_dev *, int,
 90					     unsigned long *, u16);
 91};
 92
 93static inline bool bnxt_ulp_registered(struct bnxt_en_dev *edev, int ulp_id)
 94{
 95	if (edev && rcu_access_pointer(edev->ulp_tbl[ulp_id].ulp_ops))
 96		return true;
 97	return false;
 98}
 99
100int bnxt_get_ulp_msix_num(struct bnxt *bp);
101int bnxt_get_ulp_msix_base(struct bnxt *bp);
102int bnxt_get_ulp_stat_ctxs(struct bnxt *bp);
103void bnxt_ulp_stop(struct bnxt *bp);
104void bnxt_ulp_start(struct bnxt *bp, int err);
105void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs);
106void bnxt_ulp_shutdown(struct bnxt *bp);
107void bnxt_ulp_irq_stop(struct bnxt *bp);
108void bnxt_ulp_irq_restart(struct bnxt *bp, int err);
109void bnxt_ulp_async_events(struct bnxt *bp, struct hwrm_async_event_cmpl *cmpl);
110struct bnxt_en_dev *bnxt_ulp_probe(struct net_device *dev);
111
 
 
 
 
 
 
112#endif