aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxge
diff options
context:
space:
mode:
authorJon Mason <jon.mason@exar.com>2010-11-10 23:26:00 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-11 12:30:22 -0500
commite7935c9669c27c5d530bff634c0c15f7a602d697 (patch)
tree5f2d6eded542d81bc7cae1a012ee5a0bbbe3d7ec /drivers/net/vxge
parentc3150eac9f2e5f770b09d371f7716540219a46f6 (diff)
vxge: Titan1A detection
Detect if the adapter is Titan or Titan1A, and tune the driver for this hardware. Also, remove unnecessary function __vxge_hw_device_id_get. Signed-off-by: Jon Mason <jon.mason@exar.com> Signed-off-by: Ram Vepa <ram.vepa@exar.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxge')
-rw-r--r--drivers/net/vxge/vxge-config.c40
-rw-r--r--drivers/net/vxge/vxge-config.h6
-rw-r--r--drivers/net/vxge/vxge-main.c45
-rw-r--r--drivers/net/vxge/vxge-main.h51
4 files changed, 87 insertions, 55 deletions
diff --git a/drivers/net/vxge/vxge-config.c b/drivers/net/vxge/vxge-config.c
index 388e6c48696b..5903b2e9a6e9 100644
--- a/drivers/net/vxge/vxge-config.c
+++ b/drivers/net/vxge/vxge-config.c
@@ -99,9 +99,6 @@ static enum vxge_hw_status
99__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config); 99__vxge_hw_device_config_check(struct vxge_hw_device_config *new_config);
100 100
101static void 101static void
102__vxge_hw_device_id_get(struct __vxge_hw_device *hldev);
103
104static void
105__vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev); 102__vxge_hw_device_host_info_get(struct __vxge_hw_device *hldev);
106 103
107static enum vxge_hw_status 104static enum vxge_hw_status
@@ -806,26 +803,6 @@ exit:
806} 803}
807 804
808/* 805/*
809 * __vxge_hw_device_id_get
810 * This routine returns sets the device id and revision numbers into the device
811 * structure
812 */
813void __vxge_hw_device_id_get(struct __vxge_hw_device *hldev)
814{
815 u64 val64;
816
817 val64 = readq(&hldev->common_reg->titan_asic_id);
818 hldev->device_id =
819 (u16)VXGE_HW_TITAN_ASIC_ID_GET_INITIAL_DEVICE_ID(val64);
820
821 hldev->major_revision =
822 (u8)VXGE_HW_TITAN_ASIC_ID_GET_INITIAL_MAJOR_REVISION(val64);
823
824 hldev->minor_revision =
825 (u8)VXGE_HW_TITAN_ASIC_ID_GET_INITIAL_MINOR_REVISION(val64);
826}
827
828/*
829 * __vxge_hw_device_access_rights_get: Get Access Rights of the driver 806 * __vxge_hw_device_access_rights_get: Get Access Rights of the driver
830 * This routine returns the Access Rights of the driver 807 * This routine returns the Access Rights of the driver
831 */ 808 */
@@ -1327,7 +1304,6 @@ vxge_hw_device_initialize(
1327 vfree(hldev); 1304 vfree(hldev);
1328 goto exit; 1305 goto exit;
1329 } 1306 }
1330 __vxge_hw_device_id_get(hldev);
1331 1307
1332 __vxge_hw_device_host_info_get(hldev); 1308 __vxge_hw_device_host_info_get(hldev);
1333 1309
@@ -4442,16 +4418,18 @@ vpath_open_exit1:
4442void 4418void
4443vxge_hw_vpath_rx_doorbell_init(struct __vxge_hw_vpath_handle *vp) 4419vxge_hw_vpath_rx_doorbell_init(struct __vxge_hw_vpath_handle *vp)
4444{ 4420{
4445 struct __vxge_hw_virtualpath *vpath = NULL; 4421 struct __vxge_hw_virtualpath *vpath = vp->vpath;
4422 struct __vxge_hw_ring *ring = vpath->ringh;
4423 struct vxgedev *vdev = netdev_priv(vpath->hldev->ndev);
4446 u64 new_count, val64, val164; 4424 u64 new_count, val64, val164;
4447 struct __vxge_hw_ring *ring;
4448 4425
4449 vpath = vp->vpath; 4426 if (vdev->titan1) {
4450 ring = vpath->ringh; 4427 new_count = readq(&vpath->vp_reg->rxdmem_size);
4428 new_count &= 0x1fff;
4429 } else
4430 new_count = ring->config->ring_blocks * VXGE_HW_BLOCK_SIZE / 8;
4451 4431
4452 new_count = readq(&vpath->vp_reg->rxdmem_size); 4432 val164 = VXGE_HW_RXDMEM_SIZE_PRC_RXDMEM_SIZE(new_count);
4453 new_count &= 0x1fff;
4454 val164 = (VXGE_HW_RXDMEM_SIZE_PRC_RXDMEM_SIZE(new_count));
4455 4433
4456 writeq(VXGE_HW_PRC_RXD_DOORBELL_NEW_QW_CNT(val164), 4434 writeq(VXGE_HW_PRC_RXD_DOORBELL_NEW_QW_CNT(val164),
4457 &vpath->vp_reg->prc_rxd_doorbell); 4435 &vpath->vp_reg->prc_rxd_doorbell);
diff --git a/drivers/net/vxge/vxge-config.h b/drivers/net/vxge/vxge-config.h
index 95230bda0653..5b2c8313426d 100644
--- a/drivers/net/vxge/vxge-config.h
+++ b/drivers/net/vxge/vxge-config.h
@@ -713,9 +713,6 @@ struct __vxge_hw_vpath_handle{
713/** 713/**
714 * struct __vxge_hw_device - Hal device object 714 * struct __vxge_hw_device - Hal device object
715 * @magic: Magic Number 715 * @magic: Magic Number
716 * @device_id: PCI Device Id of the adapter
717 * @major_revision: PCI Device major revision
718 * @minor_revision: PCI Device minor revision
719 * @bar0: BAR0 virtual address. 716 * @bar0: BAR0 virtual address.
720 * @pdev: Physical device handle 717 * @pdev: Physical device handle
721 * @config: Confguration passed by the LL driver at initialization 718 * @config: Confguration passed by the LL driver at initialization
@@ -727,9 +724,6 @@ struct __vxge_hw_device {
727 u32 magic; 724 u32 magic;
728#define VXGE_HW_DEVICE_MAGIC 0x12345678 725#define VXGE_HW_DEVICE_MAGIC 0x12345678
729#define VXGE_HW_DEVICE_DEAD 0xDEADDEAD 726#define VXGE_HW_DEVICE_DEAD 0xDEADDEAD
730 u16 device_id;
731 u8 major_revision;
732 u8 minor_revision;
733 void __iomem *bar0; 727 void __iomem *bar0;
734 struct pci_dev *pdev; 728 struct pci_dev *pdev;
735 struct net_device *ndev; 729 struct net_device *ndev;
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index ea303a2af3aa..b8806a15bcaf 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -2012,8 +2012,23 @@ static int vxge_open_vpaths(struct vxgedev *vdev)
2012 2012
2013 for (i = 0; i < vdev->no_of_vpath; i++) { 2013 for (i = 0; i < vdev->no_of_vpath; i++) {
2014 vpath = &vdev->vpaths[i]; 2014 vpath = &vdev->vpaths[i];
2015
2016 vxge_assert(vpath->is_configured); 2015 vxge_assert(vpath->is_configured);
2016
2017 if (!vdev->titan1) {
2018 struct vxge_hw_vp_config *vcfg;
2019 vcfg = &vdev->devh->config.vp_config[vpath->device_id];
2020
2021 vcfg->rti.urange_a = RTI_T1A_RX_URANGE_A;
2022 vcfg->rti.urange_b = RTI_T1A_RX_URANGE_B;
2023 vcfg->rti.urange_c = RTI_T1A_RX_URANGE_C;
2024 vcfg->tti.uec_a = TTI_T1A_TX_UFC_A;
2025 vcfg->tti.uec_b = TTI_T1A_TX_UFC_B;
2026 vcfg->tti.uec_c = TTI_T1A_TX_UFC_C(vdev->mtu);
2027 vcfg->tti.uec_d = TTI_T1A_TX_UFC_D(vdev->mtu);
2028 vcfg->tti.ltimer_val = VXGE_T1A_TTI_LTIMER_VAL;
2029 vcfg->tti.rtimer_val = VXGE_T1A_TTI_RTIMER_VAL;
2030 }
2031
2017 attr.vp_id = vpath->device_id; 2032 attr.vp_id = vpath->device_id;
2018 attr.fifo_attr.callback = vxge_xmit_compl; 2033 attr.fifo_attr.callback = vxge_xmit_compl;
2019 attr.fifo_attr.txdl_term = vxge_tx_term; 2034 attr.fifo_attr.txdl_term = vxge_tx_term;
@@ -2710,9 +2725,10 @@ vxge_open(struct net_device *dev)
2710 vxge_os_timer(vdev->vp_reset_timer, 2725 vxge_os_timer(vdev->vp_reset_timer,
2711 vxge_poll_vp_reset, vdev, (HZ/2)); 2726 vxge_poll_vp_reset, vdev, (HZ/2));
2712 2727
2713 if (vdev->vp_lockup_timer.function == NULL) 2728 /* There is no need to check for RxD leak and RxD lookup on Titan1A */
2714 vxge_os_timer(vdev->vp_lockup_timer, 2729 if (vdev->titan1 && vdev->vp_lockup_timer.function == NULL)
2715 vxge_poll_vp_lockup, vdev, (HZ/2)); 2730 vxge_os_timer(vdev->vp_lockup_timer, vxge_poll_vp_lockup, vdev,
2731 HZ / 2);
2716 2732
2717 set_bit(__VXGE_STATE_CARD_UP, &vdev->state); 2733 set_bit(__VXGE_STATE_CARD_UP, &vdev->state);
2718 2734
@@ -2844,7 +2860,9 @@ static int do_vxge_close(struct net_device *dev, int do_io)
2844 2860
2845 smp_wmb(); 2861 smp_wmb();
2846 } 2862 }
2847 del_timer_sync(&vdev->vp_lockup_timer); 2863
2864 if (vdev->titan1)
2865 del_timer_sync(&vdev->vp_lockup_timer);
2848 2866
2849 del_timer_sync(&vdev->vp_reset_timer); 2867 del_timer_sync(&vdev->vp_reset_timer);
2850 2868
@@ -3262,6 +3280,19 @@ static const struct net_device_ops vxge_netdev_ops = {
3262#endif 3280#endif
3263}; 3281};
3264 3282
3283static int __devinit vxge_device_revision(struct vxgedev *vdev)
3284{
3285 int ret;
3286 u8 revision;
3287
3288 ret = pci_read_config_byte(vdev->pdev, PCI_REVISION_ID, &revision);
3289 if (ret)
3290 return -EIO;
3291
3292 vdev->titan1 = (revision == VXGE_HW_TITAN1_PCI_REVISION);
3293 return 0;
3294}
3295
3265static int __devinit vxge_device_register(struct __vxge_hw_device *hldev, 3296static int __devinit vxge_device_register(struct __vxge_hw_device *hldev,
3266 struct vxge_config *config, 3297 struct vxge_config *config,
3267 int high_dma, int no_of_vpath, 3298 int high_dma, int no_of_vpath,
@@ -3302,6 +3333,10 @@ static int __devinit vxge_device_register(struct __vxge_hw_device *hldev,
3302 vdev->rx_csum = 1; /* Enable Rx CSUM by default. */ 3333 vdev->rx_csum = 1; /* Enable Rx CSUM by default. */
3303 vdev->rx_hwts = 0; 3334 vdev->rx_hwts = 0;
3304 3335
3336 ret = vxge_device_revision(vdev);
3337 if (ret < 0)
3338 goto _out1;
3339
3305 SET_NETDEV_DEV(ndev, &vdev->pdev->dev); 3340 SET_NETDEV_DEV(ndev, &vdev->pdev->dev);
3306 3341
3307 ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX | 3342 ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
diff --git a/drivers/net/vxge/vxge-main.h b/drivers/net/vxge/vxge-main.h
index 6f6e9ce0bf20..953cb0ded3e1 100644
--- a/drivers/net/vxge/vxge-main.h
+++ b/drivers/net/vxge/vxge-main.h
@@ -29,6 +29,9 @@
29 29
30#define PCI_DEVICE_ID_TITAN_WIN 0x5733 30#define PCI_DEVICE_ID_TITAN_WIN 0x5733
31#define PCI_DEVICE_ID_TITAN_UNI 0x5833 31#define PCI_DEVICE_ID_TITAN_UNI 0x5833
32#define VXGE_HW_TITAN1_PCI_REVISION 1
33#define VXGE_HW_TITAN1A_PCI_REVISION 2
34
32#define VXGE_USE_DEFAULT 0xffffffff 35#define VXGE_USE_DEFAULT 0xffffffff
33#define VXGE_HW_VPATH_MSIX_ACTIVE 4 36#define VXGE_HW_VPATH_MSIX_ACTIVE 4
34#define VXGE_ALARM_MSIX_ID 2 37#define VXGE_ALARM_MSIX_ID 2
@@ -53,11 +56,13 @@
53 56
54#define VXGE_TTI_BTIMER_VAL 250000 57#define VXGE_TTI_BTIMER_VAL 250000
55 58
56#define VXGE_TTI_LTIMER_VAL 1000 59#define VXGE_TTI_LTIMER_VAL 1000
57#define VXGE_TTI_RTIMER_VAL 0 60#define VXGE_T1A_TTI_LTIMER_VAL 80
58#define VXGE_RTI_BTIMER_VAL 250 61#define VXGE_TTI_RTIMER_VAL 0
59#define VXGE_RTI_LTIMER_VAL 100 62#define VXGE_T1A_TTI_RTIMER_VAL 400
60#define VXGE_RTI_RTIMER_VAL 0 63#define VXGE_RTI_BTIMER_VAL 250
64#define VXGE_RTI_LTIMER_VAL 100
65#define VXGE_RTI_RTIMER_VAL 0
61#define VXGE_FIFO_INDICATE_MAX_PKTS VXGE_DEF_FIFO_LENGTH 66#define VXGE_FIFO_INDICATE_MAX_PKTS VXGE_DEF_FIFO_LENGTH
62#define VXGE_ISR_POLLING_CNT 8 67#define VXGE_ISR_POLLING_CNT 8
63#define VXGE_MAX_CONFIG_DEV 0xFF 68#define VXGE_MAX_CONFIG_DEV 0xFF
@@ -76,14 +81,32 @@
76#define TTI_TX_UFC_B 40 81#define TTI_TX_UFC_B 40
77#define TTI_TX_UFC_C 60 82#define TTI_TX_UFC_C 60
78#define TTI_TX_UFC_D 100 83#define TTI_TX_UFC_D 100
84#define TTI_T1A_TX_UFC_A 30
85#define TTI_T1A_TX_UFC_B 80
86/* Slope - (max_mtu - min_mtu)/(max_mtu_ufc - min_mtu_ufc) */
87/* Slope - 93 */
88/* 60 - 9k Mtu, 140 - 1.5k mtu */
89#define TTI_T1A_TX_UFC_C(mtu) (60 + ((VXGE_HW_MAX_MTU - mtu) / 93))
90
91/* Slope - 37 */
92/* 100 - 9k Mtu, 300 - 1.5k mtu */
93#define TTI_T1A_TX_UFC_D(mtu) (100 + ((VXGE_HW_MAX_MTU - mtu) / 37))
94
95
96#define RTI_RX_URANGE_A 5
97#define RTI_RX_URANGE_B 15
98#define RTI_RX_URANGE_C 40
99#define RTI_T1A_RX_URANGE_A 1
100#define RTI_T1A_RX_URANGE_B 20
101#define RTI_T1A_RX_URANGE_C 50
102#define RTI_RX_UFC_A 1
103#define RTI_RX_UFC_B 5
104#define RTI_RX_UFC_C 10
105#define RTI_RX_UFC_D 15
106#define RTI_T1A_RX_UFC_B 20
107#define RTI_T1A_RX_UFC_C 50
108#define RTI_T1A_RX_UFC_D 60
79 109
80#define RTI_RX_URANGE_A 5
81#define RTI_RX_URANGE_B 15
82#define RTI_RX_URANGE_C 40
83#define RTI_RX_UFC_A 1
84#define RTI_RX_UFC_B 5
85#define RTI_RX_UFC_C 10
86#define RTI_RX_UFC_D 15
87 110
88/* Milli secs timer period */ 111/* Milli secs timer period */
89#define VXGE_TIMER_DELAY 10000 112#define VXGE_TIMER_DELAY 10000
@@ -329,7 +352,8 @@ struct vxgedev {
329 352
330 /* A flag indicating whether rx_csum is to be used or not. */ 353 /* A flag indicating whether rx_csum is to be used or not. */
331 u32 rx_csum:1, 354 u32 rx_csum:1,
332 rx_hwts:1; 355 rx_hwts:1,
356 titan1:1;
333 357
334 struct vxge_msix_entry *vxge_entries; 358 struct vxge_msix_entry *vxge_entries;
335 struct msix_entry *entries; 359 struct msix_entry *entries;
@@ -397,6 +421,7 @@ struct vxge_tx_priv {
397 } while (0); 421 } while (0);
398 422
399extern void vxge_initialize_ethtool_ops(struct net_device *ndev); 423extern void vxge_initialize_ethtool_ops(struct net_device *ndev);
424
400enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev); 425enum vxge_hw_status vxge_reset_all_vpaths(struct vxgedev *vdev);
401 426
402int vxge_fw_upgrade(struct vxgedev *vdev, char *fw_name, int override); 427int vxge_fw_upgrade(struct vxgedev *vdev, char *fw_name, int override);