diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-04-07 18:50:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-08 18:58:25 -0400 |
commit | 1b1f789818c6be9437cfe199932ee13faafca60f (patch) | |
tree | bcaef3319a13e5f6a57bca983de97921e612c3b0 | |
parent | e98e3350c03af4187e1d5fe007c7b460e378990c (diff) |
netxen: refactor netxen_adapter
Rearrange members to align them at right offset.
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.h | 80 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ctx.c | 7 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 11 |
3 files changed, 39 insertions, 59 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 184eb6f76d55..1165f53ea2ca 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -700,14 +700,13 @@ struct netxen_hardware_context { | |||
700 | 700 | ||
701 | u8 cut_through; | 701 | u8 cut_through; |
702 | u8 revision_id; | 702 | u8 revision_id; |
703 | u8 pci_func; | ||
704 | u8 linkup; | ||
703 | u16 port_type; | 705 | u16 port_type; |
704 | int board_type; | 706 | u16 board_type; |
705 | u32 linkup; | ||
706 | /* Address of cmd ring in Phantom */ | 707 | /* Address of cmd ring in Phantom */ |
707 | struct cmd_desc_type0 *cmd_desc_head; | 708 | struct cmd_desc_type0 *cmd_desc_head; |
708 | dma_addr_t cmd_desc_phys_addr; | 709 | dma_addr_t cmd_desc_phys_addr; |
709 | struct netxen_adapter *adapter; | ||
710 | int pci_func; | ||
711 | }; | 710 | }; |
712 | 711 | ||
713 | #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */ | 712 | #define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */ |
@@ -1146,61 +1145,52 @@ struct netxen_adapter { | |||
1146 | 1145 | ||
1147 | struct net_device *netdev; | 1146 | struct net_device *netdev; |
1148 | struct pci_dev *pdev; | 1147 | struct pci_dev *pdev; |
1149 | int pci_using_dac; | ||
1150 | struct net_device_stats net_stats; | ||
1151 | int mtu; | ||
1152 | int portnum; | ||
1153 | u8 physical_port; | ||
1154 | u16 tx_context_id; | ||
1155 | |||
1156 | uint8_t mc_enabled; | ||
1157 | uint8_t max_mc_count; | ||
1158 | nx_mac_list_t *mac_list; | 1148 | nx_mac_list_t *mac_list; |
1159 | 1149 | ||
1160 | struct netxen_legacy_intr_set legacy_intr; | ||
1161 | |||
1162 | struct work_struct watchdog_task; | ||
1163 | struct timer_list watchdog_timer; | ||
1164 | struct work_struct tx_timeout_task; | ||
1165 | |||
1166 | u32 curr_window; | 1150 | u32 curr_window; |
1167 | u32 crb_win; | 1151 | u32 crb_win; |
1168 | rwlock_t adapter_lock; | 1152 | rwlock_t adapter_lock; |
1169 | 1153 | ||
1154 | spinlock_t tx_clean_lock; | ||
1170 | u32 cmd_producer; | 1155 | u32 cmd_producer; |
1171 | __le32 *cmd_consumer; | ||
1172 | u32 last_cmd_consumer; | 1156 | u32 last_cmd_consumer; |
1173 | u32 crb_addr_cmd_producer; | 1157 | u32 crb_addr_cmd_producer; |
1174 | u32 crb_addr_cmd_consumer; | 1158 | u32 crb_addr_cmd_consumer; |
1175 | spinlock_t tx_clean_lock; | 1159 | __le32 *cmd_consumer; |
1176 | 1160 | ||
1177 | u32 num_txd; | 1161 | u32 num_txd; |
1178 | u32 num_rxd; | 1162 | u32 num_rxd; |
1179 | u32 num_jumbo_rxd; | 1163 | u32 num_jumbo_rxd; |
1180 | u32 num_lro_rxd; | 1164 | u32 num_lro_rxd; |
1181 | 1165 | ||
1182 | int max_rds_rings; | 1166 | u8 max_rds_rings; |
1183 | int max_sds_rings; | 1167 | u8 max_sds_rings; |
1168 | u8 driver_mismatch; | ||
1169 | u8 msix_supported; | ||
1170 | u8 rx_csum; | ||
1171 | u8 pci_using_dac; | ||
1172 | u8 portnum; | ||
1173 | u8 physical_port; | ||
1174 | |||
1175 | u8 mc_enabled; | ||
1176 | u8 max_mc_count; | ||
1177 | u16 tx_context_id; | ||
1178 | u16 mtu; | ||
1179 | u16 is_up; | ||
1180 | u16 link_speed; | ||
1181 | u16 link_duplex; | ||
1182 | u16 link_autoneg; | ||
1183 | u16 resv1; | ||
1184 | 1184 | ||
1185 | u32 resv2; | ||
1185 | u32 flags; | 1186 | u32 flags; |
1186 | u32 irq; | 1187 | u32 irq; |
1187 | int driver_mismatch; | ||
1188 | u32 temp; | 1188 | u32 temp; |
1189 | |||
1190 | u32 fw_major; | 1189 | u32 fw_major; |
1191 | u32 fw_version; | 1190 | u32 fw_version; |
1192 | 1191 | ||
1193 | int msix_supported; | ||
1194 | struct msix_entry msix_entries[MSIX_ENTRIES_PER_ADAPTER]; | ||
1195 | |||
1196 | struct netxen_adapter_stats stats; | 1192 | struct netxen_adapter_stats stats; |
1197 | 1193 | ||
1198 | u16 link_speed; | ||
1199 | u16 link_duplex; | ||
1200 | u16 state; | ||
1201 | u16 link_autoneg; | ||
1202 | int rx_csum; | ||
1203 | |||
1204 | struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ | 1194 | struct netxen_cmd_buffer *cmd_buf_arr; /* Command buffers for xmit */ |
1205 | 1195 | ||
1206 | /* | 1196 | /* |
@@ -1209,15 +1199,9 @@ struct netxen_adapter { | |||
1209 | */ | 1199 | */ |
1210 | struct netxen_recv_context recv_ctx; | 1200 | struct netxen_recv_context recv_ctx; |
1211 | 1201 | ||
1212 | int is_up; | ||
1213 | struct netxen_dummy_dma dummy_dma; | ||
1214 | nx_nic_intr_coalesce_t coal; | ||
1215 | |||
1216 | /* Context interface shared between card and host */ | 1202 | /* Context interface shared between card and host */ |
1217 | struct netxen_ring_ctx *ctx_desc; | 1203 | struct netxen_ring_ctx *ctx_desc; |
1218 | dma_addr_t ctx_desc_phys_addr; | 1204 | dma_addr_t ctx_desc_phys_addr; |
1219 | int intr_scheme; | ||
1220 | int msi_mode; | ||
1221 | int (*enable_phy_interrupts) (struct netxen_adapter *); | 1205 | int (*enable_phy_interrupts) (struct netxen_adapter *); |
1222 | int (*disable_phy_interrupts) (struct netxen_adapter *); | 1206 | int (*disable_phy_interrupts) (struct netxen_adapter *); |
1223 | int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t); | 1207 | int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t); |
@@ -1238,7 +1222,21 @@ struct netxen_adapter { | |||
1238 | u32 (*pci_read_normalize)(struct netxen_adapter *, u64); | 1222 | u32 (*pci_read_normalize)(struct netxen_adapter *, u64); |
1239 | unsigned long (*pci_set_window)(struct netxen_adapter *, | 1223 | unsigned long (*pci_set_window)(struct netxen_adapter *, |
1240 | unsigned long long); | 1224 | unsigned long long); |
1241 | }; /* netxen_adapter structure */ | 1225 | |
1226 | struct netxen_legacy_intr_set legacy_intr; | ||
1227 | |||
1228 | struct msix_entry msix_entries[MSIX_ENTRIES_PER_ADAPTER]; | ||
1229 | |||
1230 | struct netxen_dummy_dma dummy_dma; | ||
1231 | |||
1232 | struct work_struct watchdog_task; | ||
1233 | struct timer_list watchdog_timer; | ||
1234 | struct work_struct tx_timeout_task; | ||
1235 | |||
1236 | struct net_device_stats net_stats; | ||
1237 | |||
1238 | nx_nic_intr_coalesce_t coal; | ||
1239 | }; | ||
1242 | 1240 | ||
1243 | /* | 1241 | /* |
1244 | * NetXen dma watchdog control structure | 1242 | * NetXen dma watchdog control structure |
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index 9234473bc08a..73f6debacf9c 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
@@ -624,9 +624,6 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) | |||
624 | 624 | ||
625 | 625 | ||
626 | if (adapter->fw_major >= 4) { | 626 | if (adapter->fw_major >= 4) { |
627 | adapter->intr_scheme = INTR_SCHEME_PERPORT; | ||
628 | adapter->msi_mode = MSI_MODE_MULTIFUNC; | ||
629 | |||
630 | err = nx_fw_cmd_create_rx_ctx(adapter); | 627 | err = nx_fw_cmd_create_rx_ctx(adapter); |
631 | if (err) | 628 | if (err) |
632 | goto err_out_free; | 629 | goto err_out_free; |
@@ -638,10 +635,6 @@ int netxen_alloc_hw_resources(struct netxen_adapter *adapter) | |||
638 | sds_ring->crb_sts_consumer = | 635 | sds_ring->crb_sts_consumer = |
639 | recv_crb_registers[adapter->portnum].crb_sts_consumer; | 636 | recv_crb_registers[adapter->portnum].crb_sts_consumer; |
640 | 637 | ||
641 | adapter->intr_scheme = adapter->pci_read_normalize(adapter, | ||
642 | CRB_NIC_CAPABILITIES_FW); | ||
643 | adapter->msi_mode = adapter->pci_read_normalize(adapter, | ||
644 | CRB_NIC_MSI_MODE_FW); | ||
645 | recv_ctx->sds_rings[0].crb_intr_mask = | 638 | recv_ctx->sds_rings[0].crb_intr_mask = |
646 | sw_int_mask[adapter->portnum]; | 639 | sw_int_mask[adapter->portnum]; |
647 | 640 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 85693c0f5637..853dee8057d9 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -462,8 +462,6 @@ netxen_setup_intr(struct netxen_adapter *adapter) | |||
462 | struct pci_dev *pdev = adapter->pdev; | 462 | struct pci_dev *pdev = adapter->pdev; |
463 | 463 | ||
464 | adapter->flags &= ~(NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED); | 464 | adapter->flags &= ~(NETXEN_NIC_MSI_ENABLED | NETXEN_NIC_MSIX_ENABLED); |
465 | adapter->intr_scheme = -1; | ||
466 | adapter->msi_mode = -1; | ||
467 | 465 | ||
468 | if (adapter->ahw.revision_id >= NX_P3_B0) | 466 | if (adapter->ahw.revision_id >= NX_P3_B0) |
469 | legacy_intrp = &legacy_intr[adapter->ahw.pci_func]; | 467 | legacy_intrp = &legacy_intr[adapter->ahw.pci_func]; |
@@ -726,15 +724,6 @@ netxen_nic_request_irq(struct netxen_adapter *adapter) | |||
726 | struct net_device *netdev = adapter->netdev; | 724 | struct net_device *netdev = adapter->netdev; |
727 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; | 725 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; |
728 | 726 | ||
729 | if ((adapter->msi_mode != MSI_MODE_MULTIFUNC) || | ||
730 | (adapter->intr_scheme != INTR_SCHEME_PERPORT)) { | ||
731 | printk(KERN_ERR "%s: Firmware interrupt scheme is " | ||
732 | "incompatible with driver\n", | ||
733 | netdev->name); | ||
734 | adapter->driver_mismatch = 1; | ||
735 | return -EINVAL; | ||
736 | } | ||
737 | |||
738 | if (adapter->flags & NETXEN_NIC_MSIX_ENABLED) | 727 | if (adapter->flags & NETXEN_NIC_MSIX_ENABLED) |
739 | handler = netxen_msix_intr; | 728 | handler = netxen_msix_intr; |
740 | else if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | 729 | else if (adapter->flags & NETXEN_NIC_MSI_ENABLED) |