svm: Add support for thresh dequeue notification
Add the ability to set a threshold on the fifo that will be used to notify caller when de-queue from the fifo reached a value that is less than or equal to the threshold. Type: feature Change-Id: I70ba1a05f783ce5247409e9beebe4e336b7c1eb5 Signed-off-by: Michal Kalderon <mkalderon@marvell.com> Signed-off-by: Yuval Caduri <cyuval@marvell.com>
This commit is contained in:

committed by
Florin Coras

parent
89618da2f7
commit
fb079585cf
@ -78,6 +78,7 @@ typedef struct svm_fifo_shr_
|
|||||||
u32 head; /**< fifo head position/byte */
|
u32 head; /**< fifo head position/byte */
|
||||||
volatile u32 want_deq_ntf; /**< producer wants nudge */
|
volatile u32 want_deq_ntf; /**< producer wants nudge */
|
||||||
volatile u32 has_deq_ntf;
|
volatile u32 has_deq_ntf;
|
||||||
|
u32 deq_thresh; /**< fifo threshold used for notifications */
|
||||||
|
|
||||||
CLIB_CACHE_LINE_ALIGN_MARK (producer);
|
CLIB_CACHE_LINE_ALIGN_MARK (producer);
|
||||||
u32 tail; /**< fifo tail position/byte */
|
u32 tail; /**< fifo tail position/byte */
|
||||||
|
@ -35,6 +35,8 @@ typedef enum svm_fifo_deq_ntf_
|
|||||||
SVM_FIFO_WANT_DEQ_NOTIF = 1, /**< Notify on dequeue */
|
SVM_FIFO_WANT_DEQ_NOTIF = 1, /**< Notify on dequeue */
|
||||||
SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL = 2, /**< Notify on transition from full */
|
SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL = 2, /**< Notify on transition from full */
|
||||||
SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY = 4, /**< Notify on transition to empty */
|
SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY = 4, /**< Notify on transition to empty */
|
||||||
|
SVM_FIFO_WANT_DEQ_NOTIF_IF_LEQ_THRESH = 5, /**< Notify on transition to less
|
||||||
|
than or equal threshold */
|
||||||
} svm_fifo_deq_ntf_t;
|
} svm_fifo_deq_ntf_t;
|
||||||
|
|
||||||
typedef enum svm_fifo_flag_
|
typedef enum svm_fifo_flag_
|
||||||
@ -793,7 +795,8 @@ svm_fifo_clear_deq_ntf (svm_fifo_t * f)
|
|||||||
/* Set the flag if want_notif_if_full was the only ntf requested */
|
/* Set the flag if want_notif_if_full was the only ntf requested */
|
||||||
f->shr->has_deq_ntf =
|
f->shr->has_deq_ntf =
|
||||||
f->shr->want_deq_ntf == SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL;
|
f->shr->want_deq_ntf == SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL;
|
||||||
svm_fifo_del_want_deq_ntf (f, SVM_FIFO_WANT_DEQ_NOTIF);
|
svm_fifo_del_want_deq_ntf (f, SVM_FIFO_WANT_DEQ_NOTIF |
|
||||||
|
SVM_FIFO_WANT_DEQ_NOTIF_IF_LEQ_THRESH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -843,9 +846,27 @@ svm_fifo_needs_deq_ntf (svm_fifo_t * f, u32 n_last_deq)
|
|||||||
if (!f->shr->has_deq_ntf && svm_fifo_is_empty (f))
|
if (!f->shr->has_deq_ntf && svm_fifo_is_empty (f))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (want_ntf & SVM_FIFO_WANT_DEQ_NOTIF_IF_LEQ_THRESH)
|
||||||
|
{
|
||||||
|
if (!f->shr->has_deq_ntf &&
|
||||||
|
(svm_fifo_max_dequeue (f) <= f->shr->deq_thresh))
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the fifo dequeue threshold which will be used for notifications.
|
||||||
|
*
|
||||||
|
* Note: If not set, by default threshold is zero, equivalent to
|
||||||
|
* empty.
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
svm_fifo_set_deq_thresh (svm_fifo_t *f, u32 thresh)
|
||||||
|
{
|
||||||
|
f->shr->deq_thresh = thresh;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __included_ssvm_fifo_h__ */
|
#endif /* __included_ssvm_fifo_h__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user