src/dpdk/drivers/net/cxgbe/base/t4_hw.c
int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
		  int mtu, int promisc, int all_multi, int bcast, int vlanex,
		  bool sleep_ok)
{
	struct fw_vi_rxmode_cmd c;

	/* convert to FW values */
	if (mtu < 0)
		mtu = M_FW_VI_RXMODE_CMD_MTU;
	if (promisc < 0)
		promisc = M_FW_VI_RXMODE_CMD_PROMISCEN;
	if (all_multi < 0)
		all_multi = M_FW_VI_RXMODE_CMD_ALLMULTIEN;
	if (bcast < 0)
		bcast = M_FW_VI_RXMODE_CMD_BROADCASTEN;
	if (vlanex < 0)
		vlanex = M_FW_VI_RXMODE_CMD_VLANEXEN;

	memset(&c, 0, sizeof(c));
	c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_RXMODE_CMD) |
				   F_FW_CMD_REQUEST | F_FW_CMD_WRITE |
				   V_FW_VI_RXMODE_CMD_VIID(viid));
	c.retval_len16 = cpu_to_be32(FW_LEN16(c));
	c.mtu_to_vlanexen = cpu_to_be32(V_FW_VI_RXMODE_CMD_MTU(mtu) |
			    V_FW_VI_RXMODE_CMD_PROMISCEN(promisc) |
			    V_FW_VI_RXMODE_CMD_ALLMULTIEN(all_multi) |
			    V_FW_VI_RXMODE_CMD_BROADCASTEN(bcast) |
			    V_FW_VI_RXMODE_CMD_VLANEXEN(vlanex));
	if (is_pf4(adap))
		return t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), NULL,
				       sleep_ok);
	else
		return t4vf_wr_mbox(adap, &c, sizeof(c), NULL);
}
/**
 * t4_set_rxmode - set Rx properties of a virtual interface
 * @adap: the adapter
 * @mbox: mailbox to use for the FW command
 * @viid: the VI id
 * @mtu: the new MTU or -1
 * @promisc: 1 to enable promiscuous mode, 0 to disable it, -1 no change
 * @all_multi: 1 to enable all-multi mode, 0 to disable it, -1 no change
 * @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change
 * @vlanex: 1 to enable hardware VLAN Tag extraction, 0 to disable it,
 *          -1 no change
 * @sleep_ok: if true we may sleep while awaiting command completion
 *
 * Sets Rx properties of a virtual interface.
 */


Sets Rx properties of a virtual interface.
Sets Rx properties of a virtual interface .
int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
		  int mtu, int promisc, int all_multi, int bcast, int vlanex,
		  bool sleep_ok)
{
	struct fw_vi_rxmode_cmd c;
	if (mtu < 0)
		mtu = M_FW_VI_RXMODE_CMD_MTU;
	if (promisc < 0)
		promisc = M_FW_VI_RXMODE_CMD_PROMISCEN;
	if (all_multi < 0)
		all_multi = M_FW_VI_RXMODE_CMD_ALLMULTIEN;
	if (bcast < 0)
		bcast = M_FW_VI_RXMODE_CMD_BROADCASTEN;
	if (vlanex < 0)
		vlanex = M_FW_VI_RXMODE_CMD_VLANEXEN;
	memset(&c, 0, sizeof(c));
	c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_RXMODE_CMD) |
				   F_FW_CMD_REQUEST | F_FW_CMD_WRITE |
				   V_FW_VI_RXMODE_CMD_VIID(viid));
	c.retval_len16 = cpu_to_be32(FW_LEN16(c));
	c.mtu_to_vlanexen = cpu_to_be32(V_FW_VI_RXMODE_CMD_MTU(mtu) |
			    V_FW_VI_RXMODE_CMD_PROMISCEN(promisc) |
			    V_FW_VI_RXMODE_CMD_ALLMULTIEN(all_multi) |
			    V_FW_VI_RXMODE_CMD_BROADCASTEN(bcast) |
			    V_FW_VI_RXMODE_CMD_VLANEXEN(vlanex));
	if (is_pf4(adap))
		return t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), NULL,
				       sleep_ok);
	else
		return t4vf_wr_mbox(adap, &c, sizeof(c), NULL);
}
int t4_set_rxmode ( struct adapter * adap , unsigned int mbox , unsigned int viid , int mtu , int promisc , int all_multi , int bcast , int vlanex , bool sleep_ok ) { struct fw_vi_rxmode_cmd c ; if ( mtu < 0 ) mtu = M_FW_VI_RXMODE_CMD_MTU ; if ( promisc < 0 ) promisc = M_FW_VI_RXMODE_CMD_PROMISCEN ; if ( all_multi < 0 ) all_multi = M_FW_VI_RXMODE_CMD_ALLMULTIEN ; if ( bcast < 0 ) bcast = M_FW_VI_RXMODE_CMD_BROADCASTEN ; if ( vlanex < 0 ) vlanex = M_FW_VI_RXMODE_CMD_VLANEXEN ; memset ( & c , 0 , sizeof ( c ) ) ; c . op_to_viid = cpu_to_be32 ( V_FW_CMD_OP ( FW_VI_RXMODE_CMD ) | F_FW_CMD_REQUEST | F_FW_CMD_WRITE | V_FW_VI_RXMODE_CMD_VIID ( viid ) ) ; c . retval_len16 = cpu_to_be32 ( FW_LEN16 ( c ) ) ; c . mtu_to_vlanexen = cpu_to_be32 ( V_FW_VI_RXMODE_CMD_MTU ( mtu ) | V_FW_VI_RXMODE_CMD_PROMISCEN ( promisc ) | V_FW_VI_RXMODE_CMD_ALLMULTIEN ( all_multi ) | V_FW_VI_RXMODE_CMD_BROADCASTEN ( bcast ) | V_FW_VI_RXMODE_CMD_VLANEXEN ( vlanex ) ) ; if ( is_pf4 ( adap ) ) return t4_wr_mbox_meat ( adap , mbox , & c , sizeof ( c ) , NULL , sleep_ok ) ; else return t4vf_wr_mbox ( adap , & c , sizeof ( c ) , NULL ) ; }
t4_set_rxmode - set Rx properties of a virtual interface
 @adap: the adapter
 @mbox: mailbox to use for the FW command
 @viid: the VI id
 @mtu: the new MTU or -1
 @promisc: 1 to enable promiscuous mode, 0 to disable it, -1 no change
 @all_multi: 1 to enable all-multi mode, 0 to disable it, -1 no change
 @bcast: 1 to enable broadcast Rx, 0 to disable it, -1 no change
 @vlanex: 1 to enable hardware VLAN Tag extraction, 0 to disable it,
          -1 no change
 @sleep_ok: if true we may sleep while awaiting command completion
t4_set_rxmode - set Rx properties of a virtual interface @adap : the adapter @mbox : mailbox to use for the FW command @viid : the VI id @mtu : the new MTU or - 1 @promisc : 1 to enable promiscuous mode 0 to disable it - 1 no change @all_multi : 1 to enable all - multi mode 0 to disable it - 1 no change @bcast : 1 to enable broadcast Rx 0 to disable it - 1 no change @vlanex : 1 to enable hardware VLAN Tag extraction 0 to disable it - 1 no change @sleep_ok : if true we may sleep while awaiting command completion
/* convert to FW values */