Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 247678
b: refs/heads/master
c: d46d4d6
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed May 17, 2011
1 parent 81deeb6 commit 8c4caf4
Show file tree
Hide file tree
Showing 11 changed files with 1,017 additions and 177 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e00cf3b9eb7839b952e434a75bff6b99e47337ac
refs/heads/master: d46d4d64a85c6ff6118b33afd5d63bcb7e4be54a
38 changes: 38 additions & 0 deletions trunk/drivers/net/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,43 @@ struct be_rx_obj {

struct be_drv_stats {
u8 be_on_die_temperature;
u64 be_tx_events;
u64 eth_red_drops;
u64 rx_drops_no_pbuf;
u64 rx_drops_no_txpb;
u64 rx_drops_no_erx_descr;
u64 rx_drops_no_tpre_descr;
u64 rx_drops_too_many_frags;
u64 rx_drops_invalid_ring;
u64 forwarded_packets;
u64 rx_drops_mtu;
u64 rx_crc_errors;
u64 rx_alignment_symbol_errors;
u64 rx_pause_frames;
u64 rx_priority_pause_frames;
u64 rx_control_frames;
u64 rx_in_range_errors;
u64 rx_out_range_errors;
u64 rx_frame_too_long;
u64 rx_address_match_errors;
u64 rx_dropped_too_small;
u64 rx_dropped_too_short;
u64 rx_dropped_header_too_small;
u64 rx_dropped_tcp_length;
u64 rx_dropped_runt;
u64 rx_ip_checksum_errs;
u64 rx_tcp_checksum_errs;
u64 rx_udp_checksum_errs;
u64 rx_switched_unicast_packets;
u64 rx_switched_multicast_packets;
u64 rx_switched_broadcast_packets;
u64 tx_pauseframes;
u64 tx_priority_pauseframes;
u64 tx_controlframes;
u64 rxpp_fifo_overflow_drop;
u64 rx_input_fifo_overflow_drop;
u64 pmem_fifo_overflow_drop;
u64 jabber_events;
};

struct be_vf_cfg {
Expand Down Expand Up @@ -483,5 +520,6 @@ extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
u16 num_popped);
extern void be_link_status_update(struct be_adapter *adapter, bool link_up);
extern void netdev_stats_update(struct be_adapter *adapter);
extern void be_parse_stats(struct be_adapter *adapter);
extern int be_load_fw(struct be_adapter *adapter, u8 *func);
#endif /* BE_H */
161 changes: 151 additions & 10 deletions trunk/drivers/net/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,38 @@ static int be_mcc_compl_process(struct be_adapter *adapter,
compl_status = (compl->status >> CQE_STATUS_COMPL_SHIFT) &
CQE_STATUS_COMPL_MASK;

if ((compl->tag0 == OPCODE_COMMON_WRITE_FLASHROM) &&
if (((compl->tag0 == OPCODE_COMMON_WRITE_FLASHROM) ||
(compl->tag0 == OPCODE_COMMON_WRITE_OBJECT)) &&
(compl->tag1 == CMD_SUBSYSTEM_COMMON)) {
adapter->flash_status = compl_status;
complete(&adapter->flash_compl);
}

if (compl_status == MCC_STATUS_SUCCESS) {
if ((compl->tag0 == OPCODE_ETH_GET_STATISTICS) &&
if (((compl->tag0 == OPCODE_ETH_GET_STATISTICS) ||
(compl->tag0 == OPCODE_ETH_GET_PPORT_STATS)) &&
(compl->tag1 == CMD_SUBSYSTEM_ETH)) {
struct be_cmd_resp_get_stats *resp =
adapter->stats_cmd.va;
be_dws_le_to_cpu(&resp->hw_stats,
sizeof(resp->hw_stats));
if (adapter->generation == BE_GEN3) {
if (lancer_chip(adapter)) {
struct lancer_cmd_resp_pport_stats
*resp = adapter->stats_cmd.va;
be_dws_le_to_cpu(&resp->pport_stats,
sizeof(resp->pport_stats));
} else {
struct be_cmd_resp_get_stats_v1 *resp =
adapter->stats_cmd.va;

be_dws_le_to_cpu(&resp->hw_stats,
sizeof(resp->hw_stats));
}
} else {
struct be_cmd_resp_get_stats_v0 *resp =
adapter->stats_cmd.va;

be_dws_le_to_cpu(&resp->hw_stats,
sizeof(resp->hw_stats));
}
be_parse_stats(adapter);
netdev_stats_update(adapter);
adapter->stats_cmd_sent = false;
}
Expand Down Expand Up @@ -1075,7 +1094,7 @@ int be_cmd_if_destroy(struct be_adapter *adapter, u32 interface_id, u32 domain)
int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_get_stats *req;
struct be_cmd_req_hdr *hdr;
struct be_sge *sge;
int status = 0;

Expand All @@ -1089,14 +1108,61 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
status = -EBUSY;
goto err;
}
req = nonemb_cmd->va;
hdr = nonemb_cmd->va;
sge = nonembedded_sgl(wrb);

be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1,
be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1,
OPCODE_ETH_GET_STATISTICS);

be_cmd_hdr_prepare(hdr, CMD_SUBSYSTEM_ETH,
OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size);

if (adapter->generation == BE_GEN3)
hdr->version = 1;

wrb->tag1 = CMD_SUBSYSTEM_ETH;
sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
sge->len = cpu_to_le32(nonemb_cmd->size);

be_mcc_notify(adapter);
adapter->stats_cmd_sent = true;

err:
spin_unlock_bh(&adapter->mcc_lock);
return status;
}

/* Lancer Stats */
int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
struct be_dma_mem *nonemb_cmd)
{

struct be_mcc_wrb *wrb;
struct lancer_cmd_req_pport_stats *req;
struct be_sge *sge;
int status = 0;

spin_lock_bh(&adapter->mcc_lock);

wrb = wrb_from_mccq(adapter);
if (!wrb) {
status = -EBUSY;
goto err;
}
req = nonemb_cmd->va;
sge = nonembedded_sgl(wrb);

be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1,
OPCODE_ETH_GET_PPORT_STATS);

be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH,
OPCODE_ETH_GET_STATISTICS, sizeof(*req));
OPCODE_ETH_GET_PPORT_STATS, nonemb_cmd->size);


req->cmd_params.params.pport_num = cpu_to_le16(adapter->port_num);
req->cmd_params.params.reset_stats = 0;

wrb->tag1 = CMD_SUBSYSTEM_ETH;
sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
Expand Down Expand Up @@ -1736,6 +1802,81 @@ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state)
return status;
}

int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 data_size, u32 data_offset, const char *obj_name,
u32 *data_written, u8 *addn_status)
{
struct be_mcc_wrb *wrb;
struct lancer_cmd_req_write_object *req;
struct lancer_cmd_resp_write_object *resp;
void *ctxt = NULL;
int status;

spin_lock_bh(&adapter->mcc_lock);
adapter->flash_status = 0;

wrb = wrb_from_mccq(adapter);
if (!wrb) {
status = -EBUSY;
goto err_unlock;
}

req = embedded_payload(wrb);

be_wrb_hdr_prepare(wrb, sizeof(struct lancer_cmd_req_write_object),
true, 1, OPCODE_COMMON_WRITE_OBJECT);
wrb->tag1 = CMD_SUBSYSTEM_COMMON;

be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_WRITE_OBJECT,
sizeof(struct lancer_cmd_req_write_object));

ctxt = &req->context;
AMAP_SET_BITS(struct amap_lancer_write_obj_context,
write_length, ctxt, data_size);

if (data_size == 0)
AMAP_SET_BITS(struct amap_lancer_write_obj_context,
eof, ctxt, 1);
else
AMAP_SET_BITS(struct amap_lancer_write_obj_context,
eof, ctxt, 0);

be_dws_cpu_to_le(ctxt, sizeof(req->context));
req->write_offset = cpu_to_le32(data_offset);
strcpy(req->object_name, obj_name);
req->descriptor_count = cpu_to_le32(1);
req->buf_len = cpu_to_le32(data_size);
req->addr_low = cpu_to_le32((cmd->dma +
sizeof(struct lancer_cmd_req_write_object))
& 0xFFFFFFFF);
req->addr_high = cpu_to_le32(upper_32_bits(cmd->dma +
sizeof(struct lancer_cmd_req_write_object)));

be_mcc_notify(adapter);
spin_unlock_bh(&adapter->mcc_lock);

if (!wait_for_completion_timeout(&adapter->flash_compl,
msecs_to_jiffies(12000)))
status = -1;
else
status = adapter->flash_status;

resp = embedded_payload(wrb);
if (!status) {
*data_written = le32_to_cpu(resp->actual_write_len);
} else {
*addn_status = resp->additional_status;
status = resp->status;
}

return status;

err_unlock:
spin_unlock_bh(&adapter->mcc_lock);
return status;
}

int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 flash_type, u32 flash_opcode, u32 buf_size)
{
Expand Down
Loading

0 comments on commit 8c4caf4

Please sign in to comment.