aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
diff options
context:
space:
mode:
authorAriel Elior <ariele@broadcom.com>2013-01-01 00:22:34 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-02 04:45:06 -0500
commit8ca5e17e58c953b9a9dbd4974c554b25c6d70b1a (patch)
treebfb964684236920270f74b165c69b55eebd90def /drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
parentfd1fc79dd6deb88ebf38ae9673190da999b3209f (diff)
bnx2x: Support of PF driver of a VF acquire request
When a VF is probed by the VF driver, the VF driver sends an 'acquire' request over the VF <-> PF channel for the resources it needs to operate (interrupts, queues, etc). The PF driver either ratifies the request and allocates the resources, responds with the maximum values it will allow the VF to acquire, or fails the request entirely if there is a problem. Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
index 6af7bde74ddc..5248ebe207f8 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
@@ -19,9 +19,13 @@
19#ifndef BNX2X_SRIOV_H 19#ifndef BNX2X_SRIOV_H
20#define BNX2X_SRIOV_H 20#define BNX2X_SRIOV_H
21 21
22#include "bnx2x_vfpf.h"
23#include "bnx2x_cmn.h"
24
22/* The bnx2x device structure holds vfdb structure described below. 25/* The bnx2x device structure holds vfdb structure described below.
23 * The VF array is indexed by the relative vfid. 26 * The VF array is indexed by the relative vfid.
24 */ 27 */
28#define BNX2X_VF_MAX_QUEUES 16
25struct bnx2x_sriov { 29struct bnx2x_sriov {
26 u32 first_vf_in_pf; 30 u32 first_vf_in_pf;
27 31
@@ -257,6 +261,12 @@ struct bnx2x_virtf {
257#define for_each_vf(bp, var) \ 261#define for_each_vf(bp, var) \
258 for ((var) = 0; (var) < BNX2X_NR_VIRTFN(bp); (var)++) 262 for ((var) = 0; (var) < BNX2X_NR_VIRTFN(bp); (var)++)
259 263
264#define for_each_vfq(vf, var) \
265 for ((var) = 0; (var) < vf_rxq_count(vf); (var)++)
266
267#define for_each_vf_sb(vf, var) \
268 for ((var) = 0; (var) < vf_sb_count(vf); (var)++)
269
260#define HW_VF_HANDLE(bp, abs_vfid) \ 270#define HW_VF_HANDLE(bp, abs_vfid) \
261 (u16)(BP_ABS_FUNC((bp)) | (1<<3) | ((u16)(abs_vfid) << 4)) 271 (u16)(BP_ABS_FUNC((bp)) | (1<<3) | ((u16)(abs_vfid) << 4))
262 272
@@ -265,6 +275,13 @@ struct bnx2x_virtf {
265#define FW_VF_HANDLE(abs_vfid) \ 275#define FW_VF_HANDLE(abs_vfid) \
266 (abs_vfid + FW_PF_MAX_HANDLE) 276 (abs_vfid + FW_PF_MAX_HANDLE)
267 277
278/* locking and unlocking the channel mutex */
279void bnx2x_lock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
280 enum channel_tlvs tlv);
281
282void bnx2x_unlock_vf_pf_channel(struct bnx2x *bp, struct bnx2x_virtf *vf,
283 enum channel_tlvs expected_tlv);
284
268/* VF mail box (aka vf-pf channel) */ 285/* VF mail box (aka vf-pf channel) */
269 286
270/* a container for the bi-directional vf<-->pf messages. 287/* a container for the bi-directional vf<-->pf messages.
@@ -365,11 +382,32 @@ static inline struct bnx2x_vf_queue *vfq_get(struct bnx2x_virtf *vf, u8 index)
365 return &(vf->vfqs[index]); 382 return &(vf->vfqs[index]);
366} 383}
367 384
385static inline bool vfq_is_leading(struct bnx2x_vf_queue *vfq)
386{
387 return (vfq->index == 0);
388}
389
390/* FW ids */
368static inline u8 vf_igu_sb(struct bnx2x_virtf *vf, u16 sb_idx) 391static inline u8 vf_igu_sb(struct bnx2x_virtf *vf, u16 sb_idx)
369{ 392{
370 return vf->igu_base_id + sb_idx; 393 return vf->igu_base_id + sb_idx;
371} 394}
372 395
396static inline u8 vf_hc_qzone(struct bnx2x_virtf *vf, u16 sb_idx)
397{
398 return vf_igu_sb(vf, sb_idx);
399}
400
401static u8 vfq_cl_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
402{
403 return vf->igu_base_id + q->index;
404}
405
406static inline u8 vfq_qzone_id(struct bnx2x_virtf *vf, struct bnx2x_vf_queue *q)
407{
408 return vfq_cl_id(vf, q);
409}
410
373/* global iov routines */ 411/* global iov routines */
374int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line); 412int bnx2x_iov_init_ilt(struct bnx2x *bp, u16 line);
375int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, int num_vfs_param); 413int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, int num_vfs_param);
@@ -387,6 +425,10 @@ void bnx2x_iov_sp_task(struct bnx2x *bp);
387/* global vf mailbox routines */ 425/* global vf mailbox routines */
388void bnx2x_vf_mbx(struct bnx2x *bp, struct vf_pf_event_data *vfpf_event); 426void bnx2x_vf_mbx(struct bnx2x *bp, struct vf_pf_event_data *vfpf_event);
389void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid); 427void bnx2x_vf_enable_mbx(struct bnx2x *bp, u8 abs_vfid);
428/* acquire */
429int bnx2x_vf_acquire(struct bnx2x *bp, struct bnx2x_virtf *vf,
430 struct vf_pf_resc_request *resc);
431
390static inline struct bnx2x_vfop *bnx2x_vfop_cur(struct bnx2x *bp, 432static inline struct bnx2x_vfop *bnx2x_vfop_cur(struct bnx2x *bp,
391 struct bnx2x_virtf *vf) 433 struct bnx2x_virtf *vf)
392{ 434{
@@ -396,6 +438,7 @@ static inline struct bnx2x_vfop *bnx2x_vfop_cur(struct bnx2x *bp,
396} 438}
397 439
398int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp, u16 abs_vfid); 440int bnx2x_vf_idx_by_abs_fid(struct bnx2x *bp, u16 abs_vfid);
441u8 bnx2x_vf_max_queue_cnt(struct bnx2x *bp, struct bnx2x_virtf *vf);
399/* VF FLR helpers */ 442/* VF FLR helpers */
400int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid); 443int bnx2x_vf_flr_clnup_epilog(struct bnx2x *bp, u8 abs_vfid);
401void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid); 444void bnx2x_vf_enable_access(struct bnx2x *bp, u8 abs_vfid);