diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-04-07 18:50:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-08 18:58:25 -0400 |
commit | d877f1e344f5515988d9dcd6db5d4285911778a3 (patch) | |
tree | 27b711302f80335942d870655ee80b7ba6e0eac0 /drivers/net/netxen/netxen_nic.h | |
parent | 1b1f789818c6be9437cfe199932ee13faafca60f (diff) |
netxen: refactor transmit code
o move tx stuff into nx_host_tx_ring structure, this will
help managing multiple tx rings in future.
o sanitize some variable names
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 1165f53ea2ca..2aa658db103f 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -74,10 +74,10 @@ | |||
74 | (sizeof(struct netxen_rx_buffer) * rds_ring->num_desc) | 74 | (sizeof(struct netxen_rx_buffer) * rds_ring->num_desc) |
75 | #define STATUS_DESC_RINGSIZE(sds_ring) \ | 75 | #define STATUS_DESC_RINGSIZE(sds_ring) \ |
76 | (sizeof(struct status_desc) * (sds_ring)->num_desc) | 76 | (sizeof(struct status_desc) * (sds_ring)->num_desc) |
77 | #define TX_BUFF_RINGSIZE(adapter) \ | 77 | #define TX_BUFF_RINGSIZE(tx_ring) \ |
78 | (sizeof(struct netxen_cmd_buffer) * adapter->num_txd) | 78 | (sizeof(struct netxen_cmd_buffer) * tx_ring->num_desc) |
79 | #define TX_DESC_RINGSIZE(adapter) \ | 79 | #define TX_DESC_RINGSIZE(tx_ring) \ |
80 | (sizeof(struct cmd_desc_type0) * adapter->num_txd) | 80 | (sizeof(struct cmd_desc_type0) * tx_ring->num_desc) |
81 | 81 | ||
82 | #define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) | 82 | #define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) |
83 | 83 | ||
@@ -639,7 +639,7 @@ extern char netxen_nic_driver_name[]; | |||
639 | */ | 639 | */ |
640 | struct netxen_skb_frag { | 640 | struct netxen_skb_frag { |
641 | u64 dma; | 641 | u64 dma; |
642 | ulong length; | 642 | u64 length; |
643 | }; | 643 | }; |
644 | 644 | ||
645 | #define _netxen_set_bits(config_word, start, bits, val) {\ | 645 | #define _netxen_set_bits(config_word, start, bits, val) {\ |
@@ -704,9 +704,6 @@ struct netxen_hardware_context { | |||
704 | u8 linkup; | 704 | u8 linkup; |
705 | u16 port_type; | 705 | u16 port_type; |
706 | u16 board_type; | 706 | u16 board_type; |
707 | /* Address of cmd ring in Phantom */ | ||
708 | struct cmd_desc_type0 *cmd_desc_head; | ||
709 | dma_addr_t cmd_desc_phys_addr; | ||
710 | }; | 707 | }; |
711 | 708 | ||
712 | #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */ | 709 | #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */ |
@@ -752,14 +749,25 @@ struct nx_host_sds_ring { | |||
752 | struct napi_struct napi; | 749 | struct napi_struct napi; |
753 | struct list_head free_list[NUM_RCV_DESC_RINGS]; | 750 | struct list_head free_list[NUM_RCV_DESC_RINGS]; |
754 | 751 | ||
755 | u16 clean_tx; | ||
756 | u16 post_rxd; | ||
757 | int irq; | 752 | int irq; |
758 | 753 | ||
759 | dma_addr_t phys_addr; | 754 | dma_addr_t phys_addr; |
760 | char name[IFNAMSIZ+4]; | 755 | char name[IFNAMSIZ+4]; |
761 | }; | 756 | }; |
762 | 757 | ||
758 | struct nx_host_tx_ring { | ||
759 | u32 producer; | ||
760 | __le32 *hw_consumer; | ||
761 | u32 sw_consumer; | ||
762 | u32 crb_cmd_producer; | ||
763 | u32 crb_cmd_consumer; | ||
764 | u32 num_desc; | ||
765 | |||
766 | struct netxen_cmd_buffer *cmd_buf_arr; | ||
767 | struct cmd_desc_type0 *desc_head; | ||
768 | dma_addr_t phys_addr; | ||
769 | }; | ||
770 | |||
763 | /* | 771 | /* |
764 | * Receive context. There is one such structure per instance of the | 772 | * Receive context. There is one such structure per instance of the |
765 | * receive processing. Any state information that is relevant to | 773 | * receive processing. Any state information that is relevant to |
@@ -1152,11 +1160,6 @@ struct netxen_adapter { | |||
1152 | rwlock_t adapter_lock; | 1160 | rwlock_t adapter_lock; |
1153 | 1161 | ||
1154 | spinlock_t tx_clean_lock; | 1162 | spinlock_t tx_clean_lock; |
1155 | u32 cmd_producer; | ||
1156 | u32 last_cmd_consumer; | ||
1157 | u32 crb_addr_cmd_producer; | ||
1158 | u32 crb_addr_cmd_consumer; | ||
1159 | __le32 *cmd_consumer; | ||
1160 | 1163 | ||
1161 | u32 num_txd; | 1164 | u32 num_txd; |
1162 | u32 num_rxd; | 1165 | u32 num_rxd; |
@@ -1191,13 +1194,8 @@ struct netxen_adapter { | |||
1191 | 1194 | ||
1192 | struct netxen_adapter_stats stats; | 1195 | struct netxen_adapter_stats stats; |
1193 | 1196 | ||
1194 | struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ | ||
1195 | |||
1196 | /* | ||
1197 | * Receive instances. These can be either one per port, | ||
1198 | * or one per peg, etc. | ||
1199 | */ | ||
1200 | struct netxen_recv_context recv_ctx; | 1197 | struct netxen_recv_context recv_ctx; |
1198 | struct nx_host_tx_ring tx_ring; | ||
1201 | 1199 | ||
1202 | /* Context interface shared between card and host */ | 1200 | /* Context interface shared between card and host */ |
1203 | struct netxen_ring_ctx *ctx_desc; | 1201 | struct netxen_ring_ctx *ctx_desc; |
@@ -1409,7 +1407,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p); | |||
1409 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev); | 1407 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev); |
1410 | 1408 | ||
1411 | void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, | 1409 | void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter, |
1412 | uint32_t crb_producer); | 1410 | struct nx_host_tx_ring *tx_ring, uint32_t crb_producer); |
1413 | 1411 | ||
1414 | /* | 1412 | /* |
1415 | * NetXen Board information | 1413 | * NetXen Board information |