src/dpdk/drivers/net/cxgbe/base/t4vf_hw.c
int t4vf_get_vfres(struct adapter *adapter)
{
	struct vf_resources *vfres = &adapter->params.vfres;
	struct fw_pfvf_cmd cmd, rpl;
	u32 word;
	int v;

	/*
	 * Execute PFVF Read command to get VF resource limits; bail out early
	 * with error on command failure.
	 */
	memset(&cmd, 0, sizeof(cmd));
	cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_PFVF_CMD) |
				    F_FW_CMD_REQUEST |
				    F_FW_CMD_READ);
	cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd));
	v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl);
	if (v != FW_SUCCESS)
		return v;

	/*
	 * Extract VF resource limits and return success.
	 */
	word = be32_to_cpu(rpl.niqflint_niq);
	vfres->niqflint = G_FW_PFVF_CMD_NIQFLINT(word);
	vfres->niq = G_FW_PFVF_CMD_NIQ(word);

	word = be32_to_cpu(rpl.type_to_neq);
	vfres->neq = G_FW_PFVF_CMD_NEQ(word);
	vfres->pmask = G_FW_PFVF_CMD_PMASK(word);

	word = be32_to_cpu(rpl.tc_to_nexactf);
	vfres->tc = G_FW_PFVF_CMD_TC(word);
	vfres->nvi = G_FW_PFVF_CMD_NVI(word);
	vfres->nexactf = G_FW_PFVF_CMD_NEXACTF(word);

	word = be32_to_cpu(rpl.r_caps_to_nethctrl);
	vfres->r_caps = G_FW_PFVF_CMD_R_CAPS(word);
	vfres->wx_caps = G_FW_PFVF_CMD_WX_CAPS(word);
	vfres->nethctrl = G_FW_PFVF_CMD_NETHCTRL(word);
	return 0;
}
/**
 * t4vf_get_vfres - retrieve VF resource limits
 * @adapter: the adapter
 *
 * Retrieves configured resource limits and capabilities for a virtual
 * function.  The results are stored in @adapter->vfres.
 */
retrieve VF resource limits
@adapter: the adapter

Retrieves configured resource limits and capabilities for a virtual
function.  The results are stored in @adapter->vfres.
retrieve VF resource limits @adapter : the adapter Retrieves configured resource limits and capabilities for a virtual function . The results are stored in @adapter - > vfres .
int t4vf_get_vfres(struct adapter *adapter)
{
	struct vf_resources *vfres = &adapter->params.vfres;
	struct fw_pfvf_cmd cmd, rpl;
	u32 word;
	int v;
	memset(&cmd, 0, sizeof(cmd));
	cmd.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_PFVF_CMD) |
				    F_FW_CMD_REQUEST |
				    F_FW_CMD_READ);
	cmd.retval_len16 = cpu_to_be32(FW_LEN16(cmd));
	v = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &rpl);
	if (v != FW_SUCCESS)
		return v;
	word = be32_to_cpu(rpl.niqflint_niq);
	vfres->niqflint = G_FW_PFVF_CMD_NIQFLINT(word);
	vfres->niq = G_FW_PFVF_CMD_NIQ(word);
	word = be32_to_cpu(rpl.type_to_neq);
	vfres->neq = G_FW_PFVF_CMD_NEQ(word);
	vfres->pmask = G_FW_PFVF_CMD_PMASK(word);
	word = be32_to_cpu(rpl.tc_to_nexactf);
	vfres->tc = G_FW_PFVF_CMD_TC(word);
	vfres->nvi = G_FW_PFVF_CMD_NVI(word);
	vfres->nexactf = G_FW_PFVF_CMD_NEXACTF(word);
	word = be32_to_cpu(rpl.r_caps_to_nethctrl);
	vfres->r_caps = G_FW_PFVF_CMD_R_CAPS(word);
	vfres->wx_caps = G_FW_PFVF_CMD_WX_CAPS(word);
	vfres->nethctrl = G_FW_PFVF_CMD_NETHCTRL(word);
	return 0;
}
int t4vf_get_vfres ( struct adapter * adapter ) { struct vf_resources * vfres = & adapter -> params . vfres ; struct fw_pfvf_cmd cmd , rpl ; u32 word ; int v ; memset ( & cmd , 0 , sizeof ( cmd ) ) ; cmd . op_to_vfn = cpu_to_be32 ( V_FW_CMD_OP ( FW_PFVF_CMD ) | F_FW_CMD_REQUEST | F_FW_CMD_READ ) ; cmd . retval_len16 = cpu_to_be32 ( FW_LEN16 ( cmd ) ) ; v = t4vf_wr_mbox ( adapter , & cmd , sizeof ( cmd ) , & rpl ) ; if ( v != FW_SUCCESS ) return v ; word = be32_to_cpu ( rpl . niqflint_niq ) ; vfres -> niqflint = G_FW_PFVF_CMD_NIQFLINT ( word ) ; vfres -> niq = G_FW_PFVF_CMD_NIQ ( word ) ; word = be32_to_cpu ( rpl . type_to_neq ) ; vfres -> neq = G_FW_PFVF_CMD_NEQ ( word ) ; vfres -> pmask = G_FW_PFVF_CMD_PMASK ( word ) ; word = be32_to_cpu ( rpl . tc_to_nexactf ) ; vfres -> tc = G_FW_PFVF_CMD_TC ( word ) ; vfres -> nvi = G_FW_PFVF_CMD_NVI ( word ) ; vfres -> nexactf = G_FW_PFVF_CMD_NEXACTF ( word ) ; word = be32_to_cpu ( rpl . r_caps_to_nethctrl ) ; vfres -> r_caps = G_FW_PFVF_CMD_R_CAPS ( word ) ; vfres -> wx_caps = G_FW_PFVF_CMD_WX_CAPS ( word ) ; vfres -> nethctrl = G_FW_PFVF_CMD_NETHCTRL ( word ) ; return 0 ; }
t4vf_get_vfres - retrieve VF resource limits
 @adapter: the adapter
t4vf_get_vfres - retrieve VF resource limits @adapter : the adapter
/*
	 * Execute PFVF Read command to get VF resource limits; bail out early
	 * with error on command failure.
	 */ /*
	 * Extract VF resource limits and return success.
	 */