aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 67d63eecc9cb..8416962cc9ac 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -501,45 +501,44 @@ static int nx_p3_nic_add_mac(struct netxen_adapter *adapter,
501 501
502static int 502static int
503netxen_send_cmd_descs(struct netxen_adapter *adapter, 503netxen_send_cmd_descs(struct netxen_adapter *adapter,
504 struct cmd_desc_type0 *cmd_desc_arr, int nr_elements) 504 struct cmd_desc_type0 *cmd_desc_arr, int nr_desc)
505{ 505{
506 uint32_t i, producer; 506 u32 i, producer, consumer;
507 struct netxen_cmd_buffer *pbuf; 507 struct netxen_cmd_buffer *pbuf;
508 struct cmd_desc_type0 *cmd_desc; 508 struct cmd_desc_type0 *cmd_desc;
509 509 struct nx_host_tx_ring *tx_ring;
510 if (nr_elements > MAX_PENDING_DESC_BLOCK_SIZE || nr_elements == 0) {
511 printk(KERN_WARNING "%s: Too many command descriptors in a "
512 "request\n", __func__);
513 return -EINVAL;
514 }
515 510
516 i = 0; 511 i = 0;
517 512
513 tx_ring = &adapter->tx_ring;
518 netif_tx_lock_bh(adapter->netdev); 514 netif_tx_lock_bh(adapter->netdev);
519 515
520 producer = adapter->cmd_producer; 516 producer = tx_ring->producer;
517 consumer = tx_ring->sw_consumer;
518
519 if (nr_desc > find_diff_among(producer, consumer, tx_ring->num_desc)) {
520 netif_tx_unlock_bh(adapter->netdev);
521 return -EBUSY;
522 }
523
521 do { 524 do {
522 cmd_desc = &cmd_desc_arr[i]; 525 cmd_desc = &cmd_desc_arr[i];
523 526
524 pbuf = &adapter->cmd_buf_arr[producer]; 527 pbuf = &tx_ring->cmd_buf_arr[producer];
525 pbuf->skb = NULL; 528 pbuf->skb = NULL;
526 pbuf->frag_count = 0; 529 pbuf->frag_count = 0;
527 530
528 /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ 531 memcpy(&tx_ring->desc_head[producer],
529 memcpy(&adapter->ahw.cmd_desc_head[producer],
530 &cmd_desc_arr[i], sizeof(struct cmd_desc_type0)); 532 &cmd_desc_arr[i], sizeof(struct cmd_desc_type0));
531 533
532 producer = get_next_index(producer, 534 producer = get_next_index(producer, tx_ring->num_desc);
533 adapter->num_txd);
534 i++; 535 i++;
535 536
536 } while (i != nr_elements); 537 } while (i != nr_desc);
537
538 adapter->cmd_producer = producer;
539 538
540 /* write producer index to start the xmit */ 539 tx_ring->producer = producer;
541 540
542 netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); 541 netxen_nic_update_cmd_producer(adapter, tx_ring, producer);
543 542
544 netif_tx_unlock_bh(adapter->netdev); 543 netif_tx_unlock_bh(adapter->netdev);
545 544