2 * QLogic qlcnic NIC Driver
3 * Copyright (c) 2009-2013 QLogic Corporation
5 * See LICENSE.qlcnic for copyright and licensing details.
8 #ifndef __QLCNIC_DCBX_H
9 #define __QLCNIC_DCBX_H
11 #define QLCNIC_DCB_STATE 0
12 #define QLCNIC_DCB_AEN_MODE 1
14 #ifdef CONFIG_QLCNIC_DCB
15 int qlcnic_register_dcb(struct qlcnic_adapter *);
17 static inline int qlcnic_register_dcb(struct qlcnic_adapter *adapter)
23 struct qlcnic_dcb_ops {
24 int (*query_hw_capability) (struct qlcnic_dcb *, char *);
25 int (*get_hw_capability) (struct qlcnic_dcb *);
26 int (*query_cee_param) (struct qlcnic_dcb *, char *, u8);
27 void (*init_dcbnl_ops) (struct qlcnic_dcb *);
28 void (*aen_handler) (struct qlcnic_dcb *, void *);
29 int (*get_cee_cfg) (struct qlcnic_dcb *);
30 void (*get_info) (struct qlcnic_dcb *);
31 int (*attach) (struct qlcnic_dcb *);
32 void (*free) (struct qlcnic_dcb *);
36 struct qlcnic_dcb_mbx_params *param;
37 struct qlcnic_adapter *adapter;
38 struct delayed_work aen_work;
39 struct workqueue_struct *wq;
40 struct qlcnic_dcb_ops *ops;
41 struct qlcnic_dcb_cfg *cfg;
45 static inline void qlcnic_clear_dcb_ops(struct qlcnic_dcb *dcb)
51 static inline int qlcnic_dcb_get_hw_capability(struct qlcnic_dcb *dcb)
53 if (dcb && dcb->ops->get_hw_capability)
54 return dcb->ops->get_hw_capability(dcb);
59 static inline void qlcnic_dcb_free(struct qlcnic_dcb *dcb)
61 if (dcb && dcb->ops->free)
65 static inline int qlcnic_dcb_attach(struct qlcnic_dcb *dcb)
67 if (dcb && dcb->ops->attach)
68 return dcb->ops->attach(dcb);
74 qlcnic_dcb_query_hw_capability(struct qlcnic_dcb *dcb, char *buf)
76 if (dcb && dcb->ops->query_hw_capability)
77 return dcb->ops->query_hw_capability(dcb, buf);
82 static inline void qlcnic_dcb_get_info(struct qlcnic_dcb *dcb)
84 if (dcb && dcb->ops->get_info)
85 dcb->ops->get_info(dcb);
89 qlcnic_dcb_query_cee_param(struct qlcnic_dcb *dcb, char *buf, u8 type)
91 if (dcb && dcb->ops->query_cee_param)
92 return dcb->ops->query_cee_param(dcb, buf, type);
97 static inline int qlcnic_dcb_get_cee_cfg(struct qlcnic_dcb *dcb)
99 if (dcb && dcb->ops->get_cee_cfg)
100 return dcb->ops->get_cee_cfg(dcb);
105 static inline void qlcnic_dcb_aen_handler(struct qlcnic_dcb *dcb, void *msg)
107 if (dcb && dcb->ops->aen_handler)
108 dcb->ops->aen_handler(dcb, msg);
111 static inline void qlcnic_dcb_init_dcbnl_ops(struct qlcnic_dcb *dcb)
113 if (dcb && dcb->ops->init_dcbnl_ops)
114 dcb->ops->init_dcbnl_ops(dcb);
117 static inline void qlcnic_dcb_enable(struct qlcnic_dcb *dcb)
119 if (dcb && qlcnic_dcb_attach(dcb))
120 qlcnic_clear_dcb_ops(dcb);