aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sk98lin
diff options
context:
space:
mode:
authorshemminger@osdl.org <shemminger@osdl.org>2005-11-24 01:00:52 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-12-01 02:22:52 -0500
commit09f5a214389fe467c2ff15aa2b85349bbde15bce (patch)
tree3d7929315ebcc558d11fd312796a5c2e99731af3 /drivers/net/sk98lin
parente9022ee6c348d41cb62c55e15a9711f7a96f2399 (diff)
[PATCH] sk98lin: allow ethtool checksum on/off per port
Allow control of checksumming parameters via ethtool. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/sk98lin')
-rw-r--r--drivers/net/sk98lin/h/skdrv2nd.h1
-rw-r--r--drivers/net/sk98lin/skethtool.c48
-rw-r--r--drivers/net/sk98lin/skge.c66
3 files changed, 79 insertions, 36 deletions
diff --git a/drivers/net/sk98lin/h/skdrv2nd.h b/drivers/net/sk98lin/h/skdrv2nd.h
index 9bdfde80c30b..0ebafc885705 100644
--- a/drivers/net/sk98lin/h/skdrv2nd.h
+++ b/drivers/net/sk98lin/h/skdrv2nd.h
@@ -297,6 +297,7 @@ struct s_RxPort {
297 RXD *pRxdRingTail; /* Tail of Rx rings */ 297 RXD *pRxdRingTail; /* Tail of Rx rings */
298 RXD *pRxdRingPrev; /* descriptor given to BMU previously */ 298 RXD *pRxdRingPrev; /* descriptor given to BMU previously */
299 int RxdRingFree; /* # of free entrys */ 299 int RxdRingFree; /* # of free entrys */
300 int RxCsum; /* use receive checksum hardware */
300 spinlock_t RxDesRingLock; /* serialize descriptor accesses */ 301 spinlock_t RxDesRingLock; /* serialize descriptor accesses */
301 int RxFillLimit; /* limit for buffers in ring */ 302 int RxFillLimit; /* limit for buffers in ring */
302 SK_IOC HwAddr; /* bmu registers address */ 303 SK_IOC HwAddr; /* bmu registers address */
diff --git a/drivers/net/sk98lin/skethtool.c b/drivers/net/sk98lin/skethtool.c
index b71769ae4603..4265ed91a9c4 100644
--- a/drivers/net/sk98lin/skethtool.c
+++ b/drivers/net/sk98lin/skethtool.c
@@ -539,6 +539,48 @@ static int setPauseParams(struct net_device *dev , struct ethtool_pauseparam *ep
539 return ret ? -EIO : 0; 539 return ret ? -EIO : 0;
540} 540}
541 541
542/* Only Yukon supports checksum offload. */
543static int setScatterGather(struct net_device *dev, u32 data)
544{
545 DEV_NET *pNet = netdev_priv(dev);
546 SK_AC *pAC = pNet->pAC;
547
548 if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
549 return -EOPNOTSUPP;
550 return ethtool_op_set_sg(dev, data);
551}
552
553static int setTxCsum(struct net_device *dev, u32 data)
554{
555 DEV_NET *pNet = netdev_priv(dev);
556 SK_AC *pAC = pNet->pAC;
557
558 if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
559 return -EOPNOTSUPP;
560
561 return ethtool_op_set_tx_csum(dev, data);
562}
563
564static u32 getRxCsum(struct net_device *dev)
565{
566 DEV_NET *pNet = netdev_priv(dev);
567 SK_AC *pAC = pNet->pAC;
568
569 return pAC->RxPort[pNet->PortNr].RxCsum;
570}
571
572static int setRxCsum(struct net_device *dev, u32 data)
573{
574 DEV_NET *pNet = netdev_priv(dev);
575 SK_AC *pAC = pNet->pAC;
576
577 if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
578 return -EOPNOTSUPP;
579
580 pAC->RxPort[pNet->PortNr].RxCsum = data != 0;
581 return 0;
582}
583
542struct ethtool_ops SkGeEthtoolOps = { 584struct ethtool_ops SkGeEthtoolOps = {
543 .get_settings = getSettings, 585 .get_settings = getSettings,
544 .set_settings = setSettings, 586 .set_settings = setSettings,
@@ -551,4 +593,10 @@ struct ethtool_ops SkGeEthtoolOps = {
551 .set_pauseparam = setPauseParams, 593 .set_pauseparam = setPauseParams,
552 .get_link = ethtool_op_get_link, 594 .get_link = ethtool_op_get_link,
553 .get_perm_addr = ethtool_op_get_perm_addr, 595 .get_perm_addr = ethtool_op_get_perm_addr,
596 .get_sg = ethtool_op_get_sg,
597 .set_sg = setScatterGather,
598 .get_tx_csum = ethtool_op_get_tx_csum,
599 .set_tx_csum = setTxCsum,
600 .get_rx_csum = getRxCsum,
601 .set_rx_csum = setRxCsum,
554}; 602};
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c
index 107c5d97546c..02143fa3ee5b 100644
--- a/drivers/net/sk98lin/skge.c
+++ b/drivers/net/sk98lin/skge.c
@@ -2189,13 +2189,10 @@ rx_start:
2189 skb_put(pMsg, FrameLength); 2189 skb_put(pMsg, FrameLength);
2190 } /* frame > SK_COPY_TRESHOLD */ 2190 } /* frame > SK_COPY_TRESHOLD */
2191 2191
2192#ifdef USE_SK_RX_CHECKSUM 2192 if (pRxPort->RxCsum) {
2193 pMsg->csum = pRxd->TcpSums; 2193 pMsg->csum = pRxd->TcpSums;
2194 pMsg->ip_summed = CHECKSUM_HW; 2194 pMsg->ip_summed = CHECKSUM_HW;
2195#else 2195 }
2196 pMsg->ip_summed = CHECKSUM_NONE;
2197#endif
2198
2199 2196
2200 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V")); 2197 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V"));
2201 ForRlmt = SK_RLMT_RX_PROTOCOL; 2198 ForRlmt = SK_RLMT_RX_PROTOCOL;
@@ -4149,6 +4146,7 @@ SK_BOOL DualNet;
4149 Flags); 4146 Flags);
4150 break; 4147 break;
4151 case SK_DRV_NET_UP: /* SK_U32 PortIdx */ 4148 case SK_DRV_NET_UP: /* SK_U32 PortIdx */
4149 { struct net_device *dev = pAC->dev[Param.Para32[0]];
4152 /* action list 5 */ 4150 /* action list 5 */
4153 FromPort = Param.Para32[0]; 4151 FromPort = Param.Para32[0];
4154 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, 4152 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
@@ -4232,22 +4230,12 @@ SK_BOOL DualNet;
4232 printk(" irq moderation: disabled\n"); 4230 printk(" irq moderation: disabled\n");
4233 4231
4234 4232
4235#ifdef SK_ZEROCOPY 4233 printk(" scatter-gather: %s\n",
4236 if (pAC->ChipsetType) 4234 (dev->features & NETIF_F_SG) ? "enabled" : "disabled");
4237#ifdef USE_SK_TX_CHECKSUM 4235 printk(" tx-checksum: %s\n",
4238 printk(" scatter-gather: enabled\n"); 4236 (dev->features & NETIF_F_IP_CSUM) ? "enabled" : "disabled");
4239#else 4237 printk(" rx-checksum: %s\n",
4240 printk(" tx-checksum: disabled\n"); 4238 pAC->RxPort[Param.Para32[0]].RxCsum ? "enabled" : "disabled");
4241#endif
4242 else
4243 printk(" scatter-gather: disabled\n");
4244#else
4245 printk(" scatter-gather: disabled\n");
4246#endif
4247
4248#ifndef USE_SK_RX_CHECKSUM
4249 printk(" rx-checksum: disabled\n");
4250#endif
4251 4239
4252 } else { 4240 } else {
4253 DoPrintInterfaceChange = SK_TRUE; 4241 DoPrintInterfaceChange = SK_TRUE;
@@ -4262,9 +4250,9 @@ SK_BOOL DualNet;
4262 } 4250 }
4263 4251
4264 /* Inform the world that link protocol is up. */ 4252 /* Inform the world that link protocol is up. */
4265 netif_carrier_on(pAC->dev[Param.Para32[0]]); 4253 netif_carrier_on(dev);
4266
4267 break; 4254 break;
4255 }
4268 case SK_DRV_NET_DOWN: /* SK_U32 Reason */ 4256 case SK_DRV_NET_DOWN: /* SK_U32 Reason */
4269 /* action list 7 */ 4257 /* action list 7 */
4270 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, 4258 SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT,
@@ -4871,15 +4859,18 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4871 SET_NETDEV_DEV(dev, &pdev->dev); 4859 SET_NETDEV_DEV(dev, &pdev->dev);
4872 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); 4860 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
4873 4861
4874#ifdef SK_ZEROCOPY 4862 /* Use only if yukon hardware */
4875#ifdef USE_SK_TX_CHECKSUM
4876 if (pAC->ChipsetType) { 4863 if (pAC->ChipsetType) {
4877 /* Use only if yukon hardware */ 4864#ifdef USE_SK_TX_CHECKSUM
4878 /* SK and ZEROCOPY - fly baby... */ 4865 dev->features |= NETIF_F_IP_CSUM;
4879 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
4880 }
4881#endif 4866#endif
4867#ifdef SK_ZEROCOPY
4868 dev->features |= NETIF_F_SG;
4869#endif
4870#ifdef USE_SK_RX_CHECKSUM
4871 pAC->RxPort[0].RxCsum = 1;
4882#endif 4872#endif
4873 }
4883 4874
4884 pAC->Index = boards_found++; 4875 pAC->Index = boards_found++;
4885 4876
@@ -4944,14 +4935,17 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
4944 SET_NETDEV_DEV(dev, &pdev->dev); 4935 SET_NETDEV_DEV(dev, &pdev->dev);
4945 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps); 4936 SET_ETHTOOL_OPS(dev, &SkGeEthtoolOps);
4946 4937
4947#ifdef SK_ZEROCOPY
4948#ifdef USE_SK_TX_CHECKSUM
4949 if (pAC->ChipsetType) { 4938 if (pAC->ChipsetType) {
4950 /* SG and ZEROCOPY - fly baby... */ 4939#ifdef USE_SK_TX_CHECKSUM
4951 dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; 4940 dev->features |= NETIF_F_IP_CSUM;
4952 }
4953#endif 4941#endif
4942#ifdef SK_ZEROCOPY
4943 dev->features |= NETIF_F_SG;
4944#endif
4945#ifdef USE_SK_RX_CHECKSUM
4946 pAC->RxPort[1].RxCsum = 1;
4954#endif 4947#endif
4948 }
4955 4949
4956 if (register_netdev(dev)) { 4950 if (register_netdev(dev)) {
4957 printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n"); 4951 printk(KERN_ERR "sk98lin: Could not register device for seconf port.\n");