Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 247427
b: refs/heads/master
c: 5c50954
h: refs/heads/master
i:
  247425: aa6912d
  247423: 823a5db
v: v3
  • Loading branch information
David S. Miller committed May 13, 2011
1 parent 70de141 commit dcdafa9
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 39 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: def57687e9579b7a797681990dff763c411f5347
refs/heads/master: 5c5095494fb545f53b80cbb7539679a10a3472a6
51 changes: 33 additions & 18 deletions trunk/drivers/net/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)

if (msecs > 4000) {
dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
be_detect_dump_ue(adapter);
if (!lancer_chip(adapter))
be_detect_dump_ue(adapter);
return -1;
}

Expand Down Expand Up @@ -729,8 +730,6 @@ int be_cmd_cq_create(struct be_adapter *adapter,
if (lancer_chip(adapter)) {
req->hdr.version = 2;
req->page_size = 1; /* 1 for 4K */
AMAP_SET_BITS(struct amap_cq_context_lancer, coalescwm, ctxt,
coalesce_wm);
AMAP_SET_BITS(struct amap_cq_context_lancer, nodelay, ctxt,
no_delay);
AMAP_SET_BITS(struct amap_cq_context_lancer, count, ctxt,
Expand Down Expand Up @@ -1405,39 +1404,55 @@ int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
/* Uses MCC for this command as it may be called in BH context
* Uses synchronous mcc
*/
int be_cmd_promiscuous_config(struct be_adapter *adapter, u8 port_num, bool en)
int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_promiscuous_config *req;
struct be_cmd_req_rx_filter *req;
struct be_dma_mem promiscous_cmd;
struct be_sge *sge;
int status;

memset(&promiscous_cmd, 0, sizeof(struct be_dma_mem));
promiscous_cmd.size = sizeof(struct be_cmd_req_rx_filter);
promiscous_cmd.va = pci_alloc_consistent(adapter->pdev,
promiscous_cmd.size, &promiscous_cmd.dma);
if (!promiscous_cmd.va) {
dev_err(&adapter->pdev->dev,
"Memory allocation failure\n");
return -ENOMEM;
}

spin_lock_bh(&adapter->mcc_lock);

wrb = wrb_from_mccq(adapter);
if (!wrb) {
status = -EBUSY;
goto err;
}
req = embedded_payload(wrb);

be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0, OPCODE_ETH_PROMISCUOUS);
req = promiscous_cmd.va;
sge = nonembedded_sgl(wrb);

be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH,
OPCODE_ETH_PROMISCUOUS, sizeof(*req));

/* In FW versions X.102.149/X.101.487 and later,
* the port setting associated only with the
* issuing pci function will take effect
*/
if (port_num)
req->port1_promiscuous = en;
else
req->port0_promiscuous = en;
be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1,
OPCODE_COMMON_NTWK_RX_FILTER);
be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_RX_FILTER, sizeof(*req));

req->if_id = cpu_to_le32(adapter->if_handle);
req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS);
if (en)
req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS);

sge->pa_hi = cpu_to_le32(upper_32_bits(promiscous_cmd.dma));
sge->pa_lo = cpu_to_le32(promiscous_cmd.dma & 0xFFFFFFFF);
sge->len = cpu_to_le32(promiscous_cmd.size);

status = be_mcc_notify_wait(adapter);

err:
spin_unlock_bh(&adapter->mcc_lock);
pci_free_consistent(adapter->pdev, promiscous_cmd.size,
promiscous_cmd.va, promiscous_cmd.dma);
return status;
}

Expand Down
24 changes: 15 additions & 9 deletions trunk/drivers/net/benet/be_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,6 @@ struct be_cmd_req_vlan_config {
u16 normal_vlan[64];
} __packed;

struct be_cmd_req_promiscuous_config {
struct be_cmd_req_hdr hdr;
u8 port0_promiscuous;
u8 port1_promiscuous;
u16 rsvd0;
} __packed;

/******************** Multicast MAC Config *******************/
#define BE_MAX_MC 64 /* set mcast promisc if > 64 */
struct macaddr {
Expand All @@ -741,6 +734,20 @@ hw_stats_from_cmd(struct be_cmd_resp_get_stats *cmd)
return &cmd->hw_stats;
}


/******************* RX FILTER ******************************/
struct be_cmd_req_rx_filter {
struct be_cmd_req_hdr hdr;
u32 global_flags_mask;
u32 global_flags;
u32 if_flags_mask;
u32 if_flags;
u32 if_id;
u32 multicast_num;
struct macaddr mac[BE_MAX_MC];
};


/******************** Link Status Query *******************/
struct be_cmd_req_link_status {
struct be_cmd_req_hdr hdr;
Expand Down Expand Up @@ -1122,8 +1129,7 @@ extern int be_cmd_modify_eqd(struct be_adapter *adapter, u32 eq_id, u32 eqd);
extern int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id,
u16 *vtag_array, u32 num, bool untagged,
bool promiscuous);
extern int be_cmd_promiscuous_config(struct be_adapter *adapter,
u8 port_num, bool en);
extern int be_cmd_promiscuous_config(struct be_adapter *adapter, bool en);
extern int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id,
struct net_device *netdev, struct be_dma_mem *mem);
extern int be_cmd_set_flow_control(struct be_adapter *adapter,
Expand Down
29 changes: 18 additions & 11 deletions trunk/drivers/net/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,15 +698,15 @@ static void be_set_multicast_list(struct net_device *netdev)
struct be_adapter *adapter = netdev_priv(netdev);

if (netdev->flags & IFF_PROMISC) {
be_cmd_promiscuous_config(adapter, adapter->port_num, 1);
be_cmd_promiscuous_config(adapter, true);
adapter->promiscuous = true;
goto done;
}

/* BE was previously in promiscuous mode; disable it */
if (adapter->promiscuous) {
adapter->promiscuous = false;
be_cmd_promiscuous_config(adapter, adapter->port_num, 0);
be_cmd_promiscuous_config(adapter, false);
}

/* Enable multicast promisc if num configured exceeds what we support */
Expand Down Expand Up @@ -1275,7 +1275,7 @@ static struct be_eth_tx_compl *be_tx_compl_get(struct be_queue_info *tx_cq)
return txcp;
}

static void be_tx_compl_process(struct be_adapter *adapter, u16 last_index)
static u16 be_tx_compl_process(struct be_adapter *adapter, u16 last_index)
{
struct be_queue_info *txq = &adapter->tx_obj.q;
struct be_eth_wrb *wrb;
Expand All @@ -1302,9 +1302,8 @@ static void be_tx_compl_process(struct be_adapter *adapter, u16 last_index)
queue_tail_inc(txq);
} while (cur_index != last_index);

atomic_sub(num_wrbs, &txq->used);

kfree_skb(sent_skb);
return num_wrbs;
}

static inline struct be_eq_entry *event_get(struct be_eq_obj *eq_obj)
Expand Down Expand Up @@ -1387,7 +1386,7 @@ static void be_tx_compl_clean(struct be_adapter *adapter)
struct be_queue_info *tx_cq = &adapter->tx_obj.cq;
struct be_queue_info *txq = &adapter->tx_obj.q;
struct be_eth_tx_compl *txcp;
u16 end_idx, cmpl = 0, timeo = 0;
u16 end_idx, cmpl = 0, timeo = 0, num_wrbs = 0;
struct sk_buff **sent_skbs = adapter->tx_obj.sent_skb_list;
struct sk_buff *sent_skb;
bool dummy_wrb;
Expand All @@ -1397,12 +1396,14 @@ static void be_tx_compl_clean(struct be_adapter *adapter)
while ((txcp = be_tx_compl_get(tx_cq))) {
end_idx = AMAP_GET_BITS(struct amap_eth_tx_compl,
wrb_index, txcp);
be_tx_compl_process(adapter, end_idx);
num_wrbs += be_tx_compl_process(adapter, end_idx);
cmpl++;
}
if (cmpl) {
be_cq_notify(adapter, tx_cq->id, false, cmpl);
atomic_sub(num_wrbs, &txq->used);
cmpl = 0;
num_wrbs = 0;
}

if (atomic_read(&txq->used) == 0 || ++timeo > 200)
Expand All @@ -1422,7 +1423,8 @@ static void be_tx_compl_clean(struct be_adapter *adapter)
index_adv(&end_idx,
wrb_cnt_for_skb(adapter, sent_skb, &dummy_wrb) - 1,
txq->len);
be_tx_compl_process(adapter, end_idx);
num_wrbs = be_tx_compl_process(adapter, end_idx);
atomic_sub(num_wrbs, &txq->used);
}
}

Expand Down Expand Up @@ -1757,12 +1759,15 @@ static int be_poll_rx(struct napi_struct *napi, int budget)
break;

/* Ignore flush completions */
if (rxcp->num_rcvd) {
if (rxcp->num_rcvd && rxcp->pkt_size) {
if (do_gro(rxcp))
be_rx_compl_process_gro(adapter, rxo, rxcp);
else
be_rx_compl_process(adapter, rxo, rxcp);
} else if (rxcp->pkt_size == 0) {
be_rx_compl_discard(adapter, rxo, rxcp);
}

be_rx_stats_update(rxo, rxcp);
}

Expand Down Expand Up @@ -1793,12 +1798,12 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
struct be_queue_info *tx_cq = &adapter->tx_obj.cq;
struct be_eth_tx_compl *txcp;
int tx_compl = 0, mcc_compl, status = 0;
u16 end_idx;
u16 end_idx, num_wrbs = 0;

while ((txcp = be_tx_compl_get(tx_cq))) {
end_idx = AMAP_GET_BITS(struct amap_eth_tx_compl,
wrb_index, txcp);
be_tx_compl_process(adapter, end_idx);
num_wrbs += be_tx_compl_process(adapter, end_idx);
tx_compl++;
}

Expand All @@ -1814,6 +1819,8 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget)
if (tx_compl) {
be_cq_notify(adapter, adapter->tx_obj.cq.id, true, tx_compl);

atomic_sub(num_wrbs, &txq->used);

/* As Tx wrbs have been freed up, wake up netdev queue if
* it was stopped due to lack of tx wrbs.
*/
Expand Down

0 comments on commit dcdafa9

Please sign in to comment.