* All rights reserved.
*/
-#include <rte_ethdev_driver.h>
+#include <ethdev_driver.h>
#include <rte_ether.h>
#include "common.h"
u32 mbox_addr)
{
for ( ; nflit; nflit--, mbox_addr += 8)
- *rpl++ = htobe64(t4_read_reg64(adap, mbox_addr));
+ *rpl++ = cpu_to_be64(t4_read_reg64(adap, mbox_addr));
}
/**
/*
* Translate firmware statistics into host native statistics.
*/
+ p->tx_octets = be64_to_cpu(fwstats.tx_bcast_bytes) +
+ be64_to_cpu(fwstats.tx_mcast_bytes) +
+ be64_to_cpu(fwstats.tx_ucast_bytes);
p->tx_bcast_frames = be64_to_cpu(fwstats.tx_bcast_frames);
p->tx_mcast_frames = be64_to_cpu(fwstats.tx_mcast_frames);
p->tx_ucast_frames = be64_to_cpu(fwstats.tx_ucast_frames);
#define GET_STAT(name) \
t4_read_reg64(adapter, \
T4VF_MPS_BASE_ADDR + A_MPS_VF_STAT_##name##_L)
+ p->tx_octets = GET_STAT(TX_VF_BCAST_BYTES) +
+ GET_STAT(TX_VF_MCAST_BYTES) +
+ GET_STAT(TX_VF_UCAST_BYTES);
p->tx_bcast_frames = GET_STAT(TX_VF_BCAST_FRAMES);
p->tx_mcast_frames = GET_STAT(TX_VF_MCAST_FRAMES);
p->tx_ucast_frames = GET_STAT(TX_VF_UCAST_FRAMES);
int t4vf_port_init(struct adapter *adapter)
{
- unsigned int fw_caps = adapter->params.fw_caps_support;
- struct fw_port_cmd port_cmd, port_rpl;
+ struct fw_port_cmd port_cmd, port_rpl, rpl;
struct fw_vi_cmd vi_cmd, vi_rpl;
- fw_port_cap32_t pcaps, acaps;
+ u32 param, val, pcaps, acaps;
enum fw_port_type port_type;
int mdio_addr;
int ret, i;
+ param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) |
+ V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_PFVF_PORT_CAPS32));
+ val = 1;
+ ret = t4vf_set_params(adapter, 1, ¶m, &val);
+ if (ret < 0)
+ return ret;
+
for_each_port(adapter, i) {
struct port_info *p = adap2pinfo(adapter, i);
-
- /*
- * If we haven't yet determined if we're talking to Firmware
- * which knows the new 32-bit Port Caps, it's time to find
- * out now. This will also tell new Firmware to send us Port
- * Status Updates using the new 32-bit Port Capabilities
- * version of the Port Information message.
- */
- if (fw_caps == FW_CAPS_UNKNOWN) {
- u32 param, val;
-
- param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_PFVF) |
- V_FW_PARAMS_PARAM_X
- (FW_PARAMS_PARAM_PFVF_PORT_CAPS32));
- val = 1;
- ret = t4vf_set_params(adapter, 1, ¶m, &val);
- fw_caps = (ret == 0 ? FW_CAPS32 : FW_CAPS16);
- adapter->params.fw_caps_support = fw_caps;
- }
+ u32 lstatus32;
ret = t4vf_alloc_vi(adapter, p->port_id);
if (ret < 0) {
return 0;
memset(&port_cmd, 0, sizeof(port_cmd));
- port_cmd.op_to_portid = cpu_to_be32
- (V_FW_CMD_OP(FW_PORT_CMD) | F_FW_CMD_REQUEST |
- F_FW_CMD_READ |
- V_FW_PORT_CMD_PORTID(p->port_id));
- port_cmd.action_to_len16 = cpu_to_be32
- (V_FW_PORT_CMD_ACTION(fw_caps == FW_CAPS16 ?
- FW_PORT_ACTION_GET_PORT_INFO :
- FW_PORT_ACTION_GET_PORT_INFO32) |
- FW_LEN16(port_cmd));
+ port_cmd.op_to_portid =
+ cpu_to_be32(V_FW_CMD_OP(FW_PORT_CMD) |
+ F_FW_CMD_REQUEST | F_FW_CMD_READ |
+ V_FW_PORT_CMD_PORTID(p->port_id));
+ val = FW_PORT_ACTION_GET_PORT_INFO32;
+ port_cmd.action_to_len16 =
+ cpu_to_be32(V_FW_PORT_CMD_ACTION(val) |
+ FW_LEN16(port_cmd));
ret = t4vf_wr_mbox(adapter, &port_cmd, sizeof(port_cmd),
&port_rpl);
if (ret != FW_SUCCESS)
/*
* Extract the various fields from the Port Information message.
*/
- if (fw_caps == FW_CAPS16) {
- u32 lstatus = be32_to_cpu
- (port_rpl.u.info.lstatus_to_modtype);
-
- port_type = G_FW_PORT_CMD_PTYPE(lstatus);
- mdio_addr = ((lstatus & F_FW_PORT_CMD_MDIOCAP) ?
- (int)G_FW_PORT_CMD_MDIOADDR(lstatus) :
- -1);
- pcaps = fwcaps16_to_caps32
- (be16_to_cpu(port_rpl.u.info.pcap));
- acaps = fwcaps16_to_caps32
- (be16_to_cpu(port_rpl.u.info.acap));
- } else {
- u32 lstatus32 = be32_to_cpu
- (port_rpl.u.info32.lstatus32_to_cbllen32);
-
- port_type = G_FW_PORT_CMD_PORTTYPE32(lstatus32);
- mdio_addr = ((lstatus32 & F_FW_PORT_CMD_MDIOCAP32) ?
- (int)G_FW_PORT_CMD_MDIOADDR32(lstatus32) :
- -1);
- pcaps = be32_to_cpu(port_rpl.u.info32.pcaps32);
- acaps = be32_to_cpu(port_rpl.u.info32.acaps32);
- }
+ rpl = port_rpl;
+ lstatus32 = be32_to_cpu(rpl.u.info32.lstatus32_to_cbllen32);
+
+ port_type = G_FW_PORT_CMD_PORTTYPE32(lstatus32);
+ mdio_addr = (lstatus32 & F_FW_PORT_CMD_MDIOCAP32) ?
+ (int)G_FW_PORT_CMD_MDIOADDR32(lstatus32) : -1;
+ pcaps = be32_to_cpu(port_rpl.u.info32.pcaps32);
+ acaps = be32_to_cpu(port_rpl.u.info32.acaps32);
- p->port_type = port_type;
- p->mdio_addr = mdio_addr;
- p->mod_type = FW_PORT_MOD_TYPE_NA;
- init_link_config(&p->link_cfg, pcaps, acaps);
+ t4_init_link_config(p, pcaps, acaps, mdio_addr, port_type,
+ FW_PORT_MOD_TYPE_NA);
}
return 0;
}