aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-03-09 04:50:53 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-10 08:10:02 -0400
commitd32cc3d24eace8a271a39ffe8aeae1861f400d2d (patch)
tree34e15aed220242cf6b14d854b496d42747cf9418
parent0ddc110c6fef34c554999448cdffe9c174a15fc9 (diff)
netxen: small xmit optimizations
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/netxen/netxen_nic.h5
-rw-r--r--drivers/net/netxen/netxen_nic_init.c2
-rw-r--r--drivers/net/netxen/netxen_nic_main.c22
3 files changed, 17 insertions, 12 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 73cb1164457f..b5c0d66daf7e 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -358,10 +358,7 @@ struct cmd_desc_type0 {
358 __le64 addr_buffer1; 358 __le64 addr_buffer1;
359 }; 359 };
360 360
361 __le16 buffer1_length; 361 __le16 buffer_length[4];
362 __le16 buffer2_length;
363 __le16 buffer3_length;
364 __le16 buffer4_length;
365 362
366 union { 363 union {
367 struct { 364 struct {
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index f8164345e3b3..72aba634554a 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -955,6 +955,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
955 int done = 0; 955 int done = 0;
956 956
957 last_consumer = adapter->last_cmd_consumer; 957 last_consumer = adapter->last_cmd_consumer;
958 barrier(); /* cmd_consumer can change underneath */
958 consumer = le32_to_cpu(*(adapter->cmd_consumer)); 959 consumer = le32_to_cpu(*(adapter->cmd_consumer));
959 960
960 while (last_consumer != consumer) { 961 while (last_consumer != consumer) {
@@ -1005,6 +1006,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
1005 * There is still a possible race condition and the host could miss an 1006 * There is still a possible race condition and the host could miss an
1006 * interrupt. The card has to take care of this. 1007 * interrupt. The card has to take care of this.
1007 */ 1008 */
1009 barrier(); /* cmd_consumer can change underneath */
1008 consumer = le32_to_cpu(*(adapter->cmd_consumer)); 1010 consumer = le32_to_cpu(*(adapter->cmd_consumer));
1009 done = (last_consumer == consumer); 1011 done = (last_consumer == consumer);
1010 1012
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index dfd66eaed1aa..c9519843f8cb 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1212,7 +1212,16 @@ netxen_clean_tx_dma_mapping(struct pci_dev *pdev,
1212 } 1212 }
1213} 1213}
1214 1214
1215static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) 1215static inline void
1216netxen_clear_cmddesc(u64 *desc)
1217{
1218 int i;
1219 for (i = 0; i < 8; i++)
1220 desc[i] = 0ULL;
1221}
1222
1223static int
1224netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1216{ 1225{
1217 struct netxen_adapter *adapter = netdev_priv(netdev); 1226 struct netxen_adapter *adapter = netdev_priv(netdev);
1218 struct netxen_hardware_context *hw = &adapter->ahw; 1227 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 1254
1246 /* Copy the descriptors into the hardware */ 1255 /* Copy the descriptors into the hardware */
1247 hwdesc = &hw->cmd_desc_head[producer]; 1256 hwdesc = &hw->cmd_desc_head[producer];
1248 memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); 1257 netxen_clear_cmddesc((u64 *)hwdesc);
1249 /* Take skb->data itself */ 1258 /* Take skb->data itself */
1250 pbuf = &adapter->cmd_buf_arr[producer]; 1259 pbuf = &adapter->cmd_buf_arr[producer];
1251 1260
@@ -1264,7 +1273,7 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1264 netxen_set_tx_frags_len(hwdesc, frag_count, skb->len); 1273 netxen_set_tx_frags_len(hwdesc, frag_count, skb->len);
1265 netxen_set_tx_port(hwdesc, adapter->portnum); 1274 netxen_set_tx_port(hwdesc, adapter->portnum);
1266 1275
1267 hwdesc->buffer1_length = cpu_to_le16(first_seg_len); 1276 hwdesc->buffer_length[0] = cpu_to_le16(first_seg_len);
1268 hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); 1277 hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma);
1269 1278
1270 for (i = 1, k = 1; i < frag_count; i++, k++) { 1279 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 k = 0; 1286 k = 0;
1278 producer = get_next_index(producer, num_txd); 1287 producer = get_next_index(producer, num_txd);
1279 hwdesc = &hw->cmd_desc_head[producer]; 1288 hwdesc = &hw->cmd_desc_head[producer];
1280 memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); 1289 netxen_clear_cmddesc((u64 *)hwdesc);
1281 pbuf = &adapter->cmd_buf_arr[producer]; 1290 pbuf = &adapter->cmd_buf_arr[producer];
1282 pbuf->skb = NULL; 1291 pbuf->skb = NULL;
1283 } 1292 }
@@ -1297,21 +1306,18 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1297 buffrag->dma = temp_dma; 1306 buffrag->dma = temp_dma;
1298 buffrag->length = temp_len; 1307 buffrag->length = temp_len;
1299 1308
1309 hwdesc->buffer_length[k] = cpu_to_le16(temp_len);
1300 switch (k) { 1310 switch (k) {
1301 case 0: 1311 case 0:
1302 hwdesc->buffer1_length = cpu_to_le16(temp_len);
1303 hwdesc->addr_buffer1 = cpu_to_le64(temp_dma); 1312 hwdesc->addr_buffer1 = cpu_to_le64(temp_dma);
1304 break; 1313 break;
1305 case 1: 1314 case 1:
1306 hwdesc->buffer2_length = cpu_to_le16(temp_len);
1307 hwdesc->addr_buffer2 = cpu_to_le64(temp_dma); 1315 hwdesc->addr_buffer2 = cpu_to_le64(temp_dma);
1308 break; 1316 break;
1309 case 2: 1317 case 2:
1310 hwdesc->buffer3_length = cpu_to_le16(temp_len);
1311 hwdesc->addr_buffer3 = cpu_to_le64(temp_dma); 1318 hwdesc->addr_buffer3 = cpu_to_le64(temp_dma);
1312 break; 1319 break;
1313 case 3: 1320 case 3:
1314 hwdesc->buffer4_length = cpu_to_le16(temp_len);
1315 hwdesc->addr_buffer4 = cpu_to_le64(temp_dma); 1321 hwdesc->addr_buffer4 = cpu_to_le64(temp_dma);
1316 break; 1322 break;
1317 } 1323 }