diff options
author | Mithlesh Thukral <mithlesh@netxen.com> | 2007-04-20 10:55:26 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 11:01:06 -0400 |
commit | 6c80b18df3537d1221ab34555c150bccbfd90260 (patch) | |
tree | b82c057feb8a4c5c4ba0171b268599ea357eb2a9 /drivers/net/netxen/netxen_nic_hw.c | |
parent | 5d512f5594f9f4829b099c87f7bc6f683ef146ca (diff) |
NetXen: Port swap feature for multi port cards
NetXen: Port Swap feature
This patch will allow a port numbers on the card to be swapped in
host driver. This feature is applicable to cards having more than
1 port.
Signed-off by: Milan Bag <mbag@netxen.com>
Signed-off by: Mithlesh Thukral <mithlesh@netxen.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 67 |
1 files changed, 13 insertions, 54 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 74517b640c2b..3f4853fdba7b 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -145,7 +145,7 @@ struct netxen_recv_crb recv_crb_registers[] = { | |||
145 | NETXEN_NIC_REG(0x184), | 145 | NETXEN_NIC_REG(0x184), |
146 | }, | 146 | }, |
147 | /* | 147 | /* |
148 | * Instance 3, | 148 | * Instance 2, |
149 | */ | 149 | */ |
150 | { | 150 | { |
151 | { | 151 | { |
@@ -194,7 +194,7 @@ struct netxen_recv_crb recv_crb_registers[] = { | |||
194 | NETXEN_NIC_REG(0x228), | 194 | NETXEN_NIC_REG(0x228), |
195 | }, | 195 | }, |
196 | /* | 196 | /* |
197 | * Instance 4, | 197 | * Instance 3, |
198 | */ | 198 | */ |
199 | { | 199 | { |
200 | { | 200 | { |
@@ -310,7 +310,6 @@ void netxen_nic_set_multi(struct net_device *netdev) | |||
310 | { | 310 | { |
311 | struct netxen_adapter *adapter = netdev_priv(netdev); | 311 | struct netxen_adapter *adapter = netdev_priv(netdev); |
312 | struct dev_mc_list *mc_ptr; | 312 | struct dev_mc_list *mc_ptr; |
313 | __u32 netxen_mac_addr_cntl_data = 0; | ||
314 | 313 | ||
315 | mc_ptr = netdev->mc_list; | 314 | mc_ptr = netdev->mc_list; |
316 | if (netdev->flags & IFF_PROMISC) { | 315 | if (netdev->flags & IFF_PROMISC) { |
@@ -318,43 +317,10 @@ void netxen_nic_set_multi(struct net_device *netdev) | |||
318 | adapter->set_promisc(adapter, | 317 | adapter->set_promisc(adapter, |
319 | NETXEN_NIU_PROMISC_MODE); | 318 | NETXEN_NIU_PROMISC_MODE); |
320 | } else { | 319 | } else { |
321 | if (adapter->unset_promisc && | 320 | if (adapter->unset_promisc) |
322 | adapter->ahw.boardcfg.board_type | ||
323 | != NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) | ||
324 | adapter->unset_promisc(adapter, | 321 | adapter->unset_promisc(adapter, |
325 | NETXEN_NIU_NON_PROMISC_MODE); | 322 | NETXEN_NIU_NON_PROMISC_MODE); |
326 | } | 323 | } |
327 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | ||
328 | netxen_nic_mcr_set_mode_select(netxen_mac_addr_cntl_data, 0x03); | ||
329 | netxen_nic_mcr_set_id_pool0(netxen_mac_addr_cntl_data, 0x00); | ||
330 | netxen_nic_mcr_set_id_pool1(netxen_mac_addr_cntl_data, 0x00); | ||
331 | netxen_nic_mcr_set_id_pool2(netxen_mac_addr_cntl_data, 0x00); | ||
332 | netxen_nic_mcr_set_id_pool3(netxen_mac_addr_cntl_data, 0x00); | ||
333 | netxen_nic_mcr_set_enable_xtnd0(netxen_mac_addr_cntl_data); | ||
334 | netxen_nic_mcr_set_enable_xtnd1(netxen_mac_addr_cntl_data); | ||
335 | netxen_nic_mcr_set_enable_xtnd2(netxen_mac_addr_cntl_data); | ||
336 | netxen_nic_mcr_set_enable_xtnd3(netxen_mac_addr_cntl_data); | ||
337 | } else { | ||
338 | netxen_nic_mcr_set_mode_select(netxen_mac_addr_cntl_data, 0x00); | ||
339 | netxen_nic_mcr_set_id_pool0(netxen_mac_addr_cntl_data, 0x00); | ||
340 | netxen_nic_mcr_set_id_pool1(netxen_mac_addr_cntl_data, 0x01); | ||
341 | netxen_nic_mcr_set_id_pool2(netxen_mac_addr_cntl_data, 0x02); | ||
342 | netxen_nic_mcr_set_id_pool3(netxen_mac_addr_cntl_data, 0x03); | ||
343 | } | ||
344 | writel(netxen_mac_addr_cntl_data, | ||
345 | NETXEN_CRB_NORMALIZE(adapter, NETXEN_MAC_ADDR_CNTL_REG)); | ||
346 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | ||
347 | writel(netxen_mac_addr_cntl_data, | ||
348 | NETXEN_CRB_NORMALIZE(adapter, | ||
349 | NETXEN_MULTICAST_ADDR_HI_0)); | ||
350 | } else { | ||
351 | writel(netxen_mac_addr_cntl_data, | ||
352 | NETXEN_CRB_NORMALIZE(adapter, | ||
353 | NETXEN_MULTICAST_ADDR_HI_1)); | ||
354 | } | ||
355 | netxen_mac_addr_cntl_data = 0; | ||
356 | writel(netxen_mac_addr_cntl_data, | ||
357 | NETXEN_CRB_NORMALIZE(adapter, NETXEN_NIU_GB_DROP_WRONGADDR)); | ||
358 | } | 324 | } |
359 | 325 | ||
360 | /* | 326 | /* |
@@ -390,7 +356,6 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
390 | void *addr; | 356 | void *addr; |
391 | int loops = 0, err = 0; | 357 | int loops = 0, err = 0; |
392 | int ctx, ring; | 358 | int ctx, ring; |
393 | u32 card_cmdring = 0; | ||
394 | struct netxen_recv_context *recv_ctx; | 359 | struct netxen_recv_context *recv_ctx; |
395 | struct netxen_rcv_desc_ctx *rcv_desc; | 360 | struct netxen_rcv_desc_ctx *rcv_desc; |
396 | int func_id = adapter->portnum; | 361 | int func_id = adapter->portnum; |
@@ -402,11 +367,6 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
402 | DPRINTK(INFO, "cam RAM: %lx %x", NETXEN_CAM_RAM_BASE, | 367 | DPRINTK(INFO, "cam RAM: %lx %x", NETXEN_CAM_RAM_BASE, |
403 | pci_base_offset(adapter, NETXEN_CAM_RAM_BASE)); | 368 | pci_base_offset(adapter, NETXEN_CAM_RAM_BASE)); |
404 | 369 | ||
405 | /* Window 1 call */ | ||
406 | card_cmdring = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_CMDRING)); | ||
407 | |||
408 | DPRINTK(INFO, "Command Peg sends 0x%x for cmdring base\n", | ||
409 | card_cmdring); | ||
410 | 370 | ||
411 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 371 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { |
412 | DPRINTK(INFO, "Command Peg ready..waiting for rcv peg\n"); | 372 | DPRINTK(INFO, "Command Peg ready..waiting for rcv peg\n"); |
@@ -449,7 +409,7 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter) | |||
449 | } | 409 | } |
450 | memset(addr, 0, sizeof(struct netxen_ring_ctx)); | 410 | memset(addr, 0, sizeof(struct netxen_ring_ctx)); |
451 | adapter->ctx_desc = (struct netxen_ring_ctx *)addr; | 411 | adapter->ctx_desc = (struct netxen_ring_ctx *)addr; |
452 | adapter->ctx_desc->ctx_id = adapter->portnum; | 412 | adapter->ctx_desc->ctx_id = cpu_to_le32(adapter->portnum); |
453 | adapter->ctx_desc->cmd_consumer_offset = | 413 | adapter->ctx_desc->cmd_consumer_offset = |
454 | cpu_to_le64(adapter->ctx_desc_phys_addr + | 414 | cpu_to_le64(adapter->ctx_desc_phys_addr + |
455 | sizeof(struct netxen_ring_ctx)); | 415 | sizeof(struct netxen_ring_ctx)); |
@@ -551,10 +511,6 @@ void netxen_free_hw_resources(struct netxen_adapter *adapter) | |||
551 | adapter->ahw.cmd_desc_phys_addr); | 511 | adapter->ahw.cmd_desc_phys_addr); |
552 | adapter->ahw.cmd_desc_head = NULL; | 512 | adapter->ahw.cmd_desc_head = NULL; |
553 | } | 513 | } |
554 | /* Special handling: there are 2 ports on this board */ | ||
555 | if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) { | ||
556 | adapter->ahw.max_ports = 2; | ||
557 | } | ||
558 | 514 | ||
559 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { | 515 | for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { |
560 | recv_ctx = &adapter->recv_ctx[ctx]; | 516 | recv_ctx = &adapter->recv_ctx[ctx]; |
@@ -735,7 +691,10 @@ void netxen_nic_pci_change_crbwindow(struct netxen_adapter *adapter, u32 wndw) | |||
735 | count++; | 691 | count++; |
736 | } | 692 | } |
737 | 693 | ||
738 | adapter->curr_window = wndw; | 694 | if (wndw == NETXEN_WINDOW_ONE) |
695 | adapter->curr_window = 1; | ||
696 | else | ||
697 | adapter->curr_window = 0; | ||
739 | } | 698 | } |
740 | 699 | ||
741 | void netxen_load_firmware(struct netxen_adapter *adapter) | 700 | void netxen_load_firmware(struct netxen_adapter *adapter) |
@@ -1055,18 +1014,18 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
1055 | int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu) | 1014 | int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu) |
1056 | { | 1015 | { |
1057 | netxen_nic_write_w0(adapter, | 1016 | netxen_nic_write_w0(adapter, |
1058 | NETXEN_NIU_GB_MAX_FRAME_SIZE(adapter->portnum), | 1017 | NETXEN_NIU_GB_MAX_FRAME_SIZE( |
1059 | new_mtu); | 1018 | physical_port[adapter->portnum]), new_mtu); |
1060 | return 0; | 1019 | return 0; |
1061 | } | 1020 | } |
1062 | 1021 | ||
1063 | int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) | 1022 | int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) |
1064 | { | 1023 | { |
1065 | new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; | 1024 | new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; |
1066 | if (adapter->portnum == 0) | 1025 | if (physical_port[adapter->portnum] == 0) |
1067 | netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, | 1026 | netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, |
1068 | new_mtu); | 1027 | new_mtu); |
1069 | else if (adapter->portnum == 1) | 1028 | else |
1070 | netxen_nic_write_w0(adapter, NETXEN_NIU_XG1_MAX_FRAME_SIZE, | 1029 | netxen_nic_write_w0(adapter, NETXEN_NIU_XG1_MAX_FRAME_SIZE, |
1071 | new_mtu); | 1030 | new_mtu); |
1072 | return 0; | 1031 | return 0; |
@@ -1074,7 +1033,7 @@ int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) | |||
1074 | 1033 | ||
1075 | void netxen_nic_init_niu_gb(struct netxen_adapter *adapter) | 1034 | void netxen_nic_init_niu_gb(struct netxen_adapter *adapter) |
1076 | { | 1035 | { |
1077 | netxen_niu_gbe_init_port(adapter, adapter->portnum); | 1036 | netxen_niu_gbe_init_port(adapter, physical_port[adapter->portnum]); |
1078 | } | 1037 | } |
1079 | 1038 | ||
1080 | void | 1039 | void |