aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxge/vxge-main.c
diff options
context:
space:
mode:
authorJon Mason <jdmason@kudzu.us>2011-04-08 07:11:21 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-12 14:22:33 -0400
commitcd883a791b55c3c52ce402cd551585fed092d240 (patch)
tree9f7e6191bf756e55904b0ad217fdc32403962090 /drivers/net/vxge/vxge-main.c
parentd83d282bcbf24ec8ddd4f0eb57f7ad302c431b8a (diff)
vxge: always enable hardware time stamp
Hardware time stamp calculation can only be enabled by the privileged function. Enable it always by default and simply use the ethtool interface to set a flag to indicate whether or not the respective function driver should indicate the timestamp along with the received packet. Also, make certain fields in vxge_hw_device_config bit-fields to reduce the size of the struct. Signed-off-by: Jon Mason <jdmason@kudzu.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxge/vxge-main.c')
-rw-r--r--drivers/net/vxge/vxge-main.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
index aff68c1118d4..d192dad8ff21 100644
--- a/drivers/net/vxge/vxge-main.c
+++ b/drivers/net/vxge/vxge-main.c
@@ -3112,8 +3112,7 @@ vxge_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats)
3112 return net_stats; 3112 return net_stats;
3113} 3113}
3114 3114
3115static enum vxge_hw_status vxge_timestamp_config(struct vxgedev *vdev, 3115static enum vxge_hw_status vxge_timestamp_config(struct __vxge_hw_device *devh)
3116 int enable)
3117{ 3116{
3118 enum vxge_hw_status status; 3117 enum vxge_hw_status status;
3119 u64 val64; 3118 u64 val64;
@@ -3123,27 +3122,24 @@ static enum vxge_hw_status vxge_timestamp_config(struct vxgedev *vdev,
3123 * required for the driver to load (due to a hardware bug), 3122 * required for the driver to load (due to a hardware bug),
3124 * there is no need to do anything special here. 3123 * there is no need to do anything special here.
3125 */ 3124 */
3126 if (enable) 3125 val64 = VXGE_HW_XMAC_TIMESTAMP_EN |
3127 val64 = VXGE_HW_XMAC_TIMESTAMP_EN | 3126 VXGE_HW_XMAC_TIMESTAMP_USE_LINK_ID(0) |
3128 VXGE_HW_XMAC_TIMESTAMP_USE_LINK_ID(0) | 3127 VXGE_HW_XMAC_TIMESTAMP_INTERVAL(0);
3129 VXGE_HW_XMAC_TIMESTAMP_INTERVAL(0);
3130 else
3131 val64 = 0;
3132 3128
3133 status = vxge_hw_mgmt_reg_write(vdev->devh, 3129 status = vxge_hw_mgmt_reg_write(devh,
3134 vxge_hw_mgmt_reg_type_mrpcim, 3130 vxge_hw_mgmt_reg_type_mrpcim,
3135 0, 3131 0,
3136 offsetof(struct vxge_hw_mrpcim_reg, 3132 offsetof(struct vxge_hw_mrpcim_reg,
3137 xmac_timestamp), 3133 xmac_timestamp),
3138 val64); 3134 val64);
3139 vxge_hw_device_flush_io(vdev->devh); 3135 vxge_hw_device_flush_io(devh);
3136 devh->config.hwts_en = VXGE_HW_HWTS_ENABLE;
3140 return status; 3137 return status;
3141} 3138}
3142 3139
3143static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data) 3140static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
3144{ 3141{
3145 struct hwtstamp_config config; 3142 struct hwtstamp_config config;
3146 enum vxge_hw_status status;
3147 int i; 3143 int i;
3148 3144
3149 if (copy_from_user(&config, data, sizeof(config))) 3145 if (copy_from_user(&config, data, sizeof(config)))
@@ -3164,10 +3160,6 @@ static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
3164 3160
3165 switch (config.rx_filter) { 3161 switch (config.rx_filter) {
3166 case HWTSTAMP_FILTER_NONE: 3162 case HWTSTAMP_FILTER_NONE:
3167 status = vxge_timestamp_config(vdev, 0);
3168 if (status != VXGE_HW_OK)
3169 return -EFAULT;
3170
3171 vdev->rx_hwts = 0; 3163 vdev->rx_hwts = 0;
3172 config.rx_filter = HWTSTAMP_FILTER_NONE; 3164 config.rx_filter = HWTSTAMP_FILTER_NONE;
3173 break; 3165 break;
@@ -3186,8 +3178,7 @@ static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
3186 case HWTSTAMP_FILTER_PTP_V2_EVENT: 3178 case HWTSTAMP_FILTER_PTP_V2_EVENT:
3187 case HWTSTAMP_FILTER_PTP_V2_SYNC: 3179 case HWTSTAMP_FILTER_PTP_V2_SYNC:
3188 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: 3180 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
3189 status = vxge_timestamp_config(vdev, 1); 3181 if (vdev->devh->config.hwts_en != VXGE_HW_HWTS_ENABLE)
3190 if (status != VXGE_HW_OK)
3191 return -EFAULT; 3182 return -EFAULT;
3192 3183
3193 vdev->rx_hwts = 1; 3184 vdev->rx_hwts = 1;
@@ -4575,6 +4566,24 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4575 goto _exit4; 4566 goto _exit4;
4576 } 4567 }
4577 4568
4569 /* Always enable HWTS. This will always cause the FCS to be invalid,
4570 * due to the fact that HWTS is using the FCS as the location of the
4571 * timestamp. The HW FCS checking will still correctly determine if
4572 * there is a valid checksum, and the FCS is being removed by the driver
4573 * anyway. So no fucntionality is being lost. Since it is always
4574 * enabled, we now simply use the ioctl call to set whether or not the
4575 * driver should be paying attention to the HWTS.
4576 */
4577 if (is_privileged == VXGE_HW_OK) {
4578 status = vxge_timestamp_config(hldev);
4579 if (status != VXGE_HW_OK) {
4580 vxge_debug_init(VXGE_ERR, "%s: HWTS enable failed",
4581 VXGE_DRIVER_NAME);
4582 ret = -EFAULT;
4583 goto _exit4;
4584 }
4585 }
4586
4578 vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_LL); 4587 vxge_hw_device_debug_set(hldev, VXGE_ERR, VXGE_COMPONENT_LL);
4579 4588
4580 /* set private device info */ 4589 /* set private device info */