Commit d32cc3d2 authored by Dhananjay Phadke's avatar Dhananjay Phadke Committed by David S. Miller

netxen: small xmit optimizations

Signed-off-by: default avatarDhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0ddc110c
...@@ -358,10 +358,7 @@ struct cmd_desc_type0 { ...@@ -358,10 +358,7 @@ struct cmd_desc_type0 {
__le64 addr_buffer1; __le64 addr_buffer1;
}; };
__le16 buffer1_length; __le16 buffer_length[4];
__le16 buffer2_length;
__le16 buffer3_length;
__le16 buffer4_length;
union { union {
struct { struct {
......
...@@ -955,6 +955,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter) ...@@ -955,6 +955,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
int done = 0; int done = 0;
last_consumer = adapter->last_cmd_consumer; last_consumer = adapter->last_cmd_consumer;
barrier(); /* cmd_consumer can change underneath */
consumer = le32_to_cpu(*(adapter->cmd_consumer)); consumer = le32_to_cpu(*(adapter->cmd_consumer));
while (last_consumer != consumer) { while (last_consumer != consumer) {
...@@ -1005,6 +1006,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter) ...@@ -1005,6 +1006,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
* There is still a possible race condition and the host could miss an * There is still a possible race condition and the host could miss an
* interrupt. The card has to take care of this. * interrupt. The card has to take care of this.
*/ */
barrier(); /* cmd_consumer can change underneath */
consumer = le32_to_cpu(*(adapter->cmd_consumer)); consumer = le32_to_cpu(*(adapter->cmd_consumer));
done = (last_consumer == consumer); done = (last_consumer == consumer);
......
...@@ -1212,7 +1212,16 @@ netxen_clean_tx_dma_mapping(struct pci_dev *pdev, ...@@ -1212,7 +1212,16 @@ netxen_clean_tx_dma_mapping(struct pci_dev *pdev,
} }
} }
static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) static inline void
netxen_clear_cmddesc(u64 *desc)
{
int i;
for (i = 0; i < 8; i++)
desc[i] = 0ULL;
}
static int
netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
{ {
struct netxen_adapter *adapter = netdev_priv(netdev); struct netxen_adapter *adapter = netdev_priv(netdev);
struct netxen_hardware_context *hw = &adapter->ahw; struct netxen_hardware_context *hw = &adapter->ahw;
...@@ -1245,7 +1254,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1245,7 +1254,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
/* Copy the descriptors into the hardware */ /* Copy the descriptors into the hardware */
hwdesc = &hw->cmd_desc_head[producer]; hwdesc = &hw->cmd_desc_head[producer];
memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); netxen_clear_cmddesc((u64 *)hwdesc);
/* Take skb->data itself */ /* Take skb->data itself */
pbuf = &adapter->cmd_buf_arr[producer]; pbuf = &adapter->cmd_buf_arr[producer];
...@@ -1264,7 +1273,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1264,7 +1273,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
netxen_set_tx_frags_len(hwdesc, frag_count, skb->len); netxen_set_tx_frags_len(hwdesc, frag_count, skb->len);
netxen_set_tx_port(hwdesc, adapter->portnum); netxen_set_tx_port(hwdesc, adapter->portnum);
hwdesc->buffer1_length = cpu_to_le16(first_seg_len); hwdesc->buffer_length[0] = cpu_to_le16(first_seg_len);
hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma);
for (i = 1, k = 1; i < frag_count; i++, k++) { for (i = 1, k = 1; i < frag_count; i++, k++) {
...@@ -1277,7 +1286,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1277,7 +1286,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
k = 0; k = 0;
producer = get_next_index(producer, num_txd); producer = get_next_index(producer, num_txd);
hwdesc = &hw->cmd_desc_head[producer]; hwdesc = &hw->cmd_desc_head[producer];
memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); netxen_clear_cmddesc((u64 *)hwdesc);
pbuf = &adapter->cmd_buf_arr[producer]; pbuf = &adapter->cmd_buf_arr[producer];
pbuf->skb = NULL; pbuf->skb = NULL;
} }
...@@ -1297,21 +1306,18 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -1297,21 +1306,18 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
buffrag->dma = temp_dma; buffrag->dma = temp_dma;
buffrag->length = temp_len; buffrag->length = temp_len;
hwdesc->buffer_length[k] = cpu_to_le16(temp_len);
switch (k) { switch (k) {
case 0: case 0:
hwdesc->buffer1_length = cpu_to_le16(temp_len);
hwdesc->addr_buffer1 = cpu_to_le64(temp_dma); hwdesc->addr_buffer1 = cpu_to_le64(temp_dma);
break; break;
case 1: case 1:
hwdesc->buffer2_length = cpu_to_le16(temp_len);
hwdesc->addr_buffer2 = cpu_to_le64(temp_dma); hwdesc->addr_buffer2 = cpu_to_le64(temp_dma);
break; break;
case 2: case 2:
hwdesc->buffer3_length = cpu_to_le16(temp_len);
hwdesc->addr_buffer3 = cpu_to_le64(temp_dma); hwdesc->addr_buffer3 = cpu_to_le64(temp_dma);
break; break;
case 3: case 3:
hwdesc->buffer4_length = cpu_to_le16(temp_len);
hwdesc->addr_buffer4 = cpu_to_le64(temp_dma); hwdesc->addr_buffer4 = cpu_to_le64(temp_dma);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment