bus/dpaa: support scatter/gather config

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
Hemant Agrawal 2018-07-06 13:40:12 +05:30 committed by Thomas Monjalon
parent e507498d81
commit be20a3a423
3 changed files with 50 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include <fsl_fman_crc64.h>
#include <fsl_bman.h>
#define FMAN_SP_SG_DISABLE 0x80000000
#define FMAN_SP_EXT_BUF_MARG_START_SHIFT 16
/* Instantiate the global variable that the inline CRC64 implementation (in
@ -538,6 +539,47 @@ fman_if_get_maxfrm(struct fman_if *fm_if)
return (in_be32(reg_maxfrm) | 0x0000FFFF);
}
/* MSB in fmbm_rebm register
* 0 - If BMI cannot store the frame in a single buffer it may select a buffer
* of smaller size and store the frame in scatter gather (S/G) buffers
* 1 - Scatter gather format is not enabled for frame storage. If BMI cannot
* store the frame in a single buffer, the frame is discarded.
*/
int
fman_if_get_sg_enable(struct fman_if *fm_if)
{
u32 fmbm_rebm;
struct __fman_if *__if = container_of(fm_if, struct __fman_if, __if);
assert(fman_ccsr_map_fd != -1);
fmbm_rebm = in_be32(&((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rebm);
return (fmbm_rebm & FMAN_SP_SG_DISABLE) ? 0 : 1;
}
void
fman_if_set_sg(struct fman_if *fm_if, int enable)
{
struct __fman_if *__if = container_of(fm_if, struct __fman_if, __if);
unsigned int *fmbm_rebm;
int val;
int fmbm_mask = FMAN_SP_SG_DISABLE;
if (enable)
val = 0;
else
val = FMAN_SP_SG_DISABLE;
assert(fman_ccsr_map_fd != -1);
fmbm_rebm = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rebm;
out_be32(fmbm_rebm, (in_be32(fmbm_rebm) & ~fmbm_mask) | val);
}
void
fman_if_set_dnia(struct fman_if *fm_if, uint32_t nia)
{

View File

@ -108,6 +108,12 @@ int fman_if_get_fdoff(struct fman_if *fm_if);
/* Set interface fd->offset value */
void fman_if_set_fdoff(struct fman_if *fm_if, uint32_t fd_offset);
/* Get interface SG enable status value */
int fman_if_get_sg_enable(struct fman_if *fm_if);
/* Set interface SG support mode */
void fman_if_set_sg(struct fman_if *fm_if, int enable);
/* Get interface Max Frame length (MTU) */
uint16_t fman_if_get_maxfrm(struct fman_if *fm_if);

View File

@ -96,6 +96,8 @@ DPDK_18.02 {
DPDK_18.08 {
global:
fman_if_get_sg_enable;
fman_if_set_sg;
of_get_mac_address;
local: *;