summaryrefslogtreecommitdiff
path: root/drivers/staging/sxg
diff options
context:
space:
mode:
authorMithlesh Thukral <mithlesh@linsyssoft.com>2009-02-24 18:07:59 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-03 14:53:13 -0700
commitbbb18b97f6bcf1d55814ce08bdaf6c358b16c8bb (patch)
tree857f6bbabe9b325bc719791be683897f0000a684 /drivers/staging/sxg
parent7876ce07c8127c8a704ed79f88be2973ea3cec1c (diff)
Staging: sxg: Add checksum control option through ethtool interface
* This patch adds support for controling checksum feature using the ethtool interface. Signed-off-by: LinSysSoft Sahara Team <saharaproj@linsyssoft.com> Signed-off-by: Mithlesh Thukral <mithlesh@linsyssoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/sxg')
-rw-r--r--drivers/staging/sxg/sxg.c24
-rw-r--r--drivers/staging/sxg/sxg_ethtool.c9
2 files changed, 18 insertions, 15 deletions
diff --git a/drivers/staging/sxg/sxg.c b/drivers/staging/sxg/sxg.c
index 09ff80012df8..d52212a09acb 100644
--- a/drivers/staging/sxg/sxg.c
+++ b/drivers/staging/sxg/sxg.c
@@ -1486,23 +1486,25 @@ static int sxg_process_isr(struct adapter_t *adapter, u32 MessageId)
* sxg_rcv_checksum - Set the checksum for received packet
*
* Arguements:
+ * @adapter - Adapter structure on which packet is received
* @skb - Packet which is receieved
* @Event - Event read from hardware
*/
-void sxg_rcv_checksum(struct sk_buff *skb, struct sxg_event *Event)
+void sxg_rcv_checksum(struct adapter_t *adapter, struct sk_buff *skb,
+ struct sxg_event *Event)
{
skb->ip_summed = CHECKSUM_NONE;
- if(Event->Status & EVENT_STATUS_TCPIP) {
- if(!(Event->Status & EVENT_STATUS_TCPBAD)) {
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- }
- if(!(Event->Status & EVENT_STATUS_IPBAD)) {
- skb->ip_summed = CHECKSUM_UNNECESSARY;
- }
- } else if(Event->Status & EVENT_STATUS_IPONLY) {
- if(!(Event->Status & EVENT_STATUS_IPBAD)) {
+ if (likely(adapter->flags & SXG_RCV_IP_CSUM_ENABLED)) {
+ if (likely(adapter->flags & SXG_RCV_TCP_CSUM_ENABLED)
+ && (Event->Status & EVENT_STATUS_TCPIP)) {
+ if(!(Event->Status & EVENT_STATUS_TCPBAD))
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ if(!(Event->Status & EVENT_STATUS_IPBAD))
skb->ip_summed = CHECKSUM_UNNECESSARY;
+ } else if(Event->Status & EVENT_STATUS_IPONLY) {
+ if(!(Event->Status & EVENT_STATUS_IPBAD))
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
}
}
}
@@ -1581,7 +1583,7 @@ static u32 sxg_process_event_queue(struct adapter_t *adapter, u32 RssId,
rx_bytes = Event->Length;
adapter->stats.rx_packets++;
adapter->stats.rx_bytes += rx_bytes;
- sxg_rcv_checksum(skb, Event);
+ sxg_rcv_checksum(adapter, skb, Event);
skb->dev = adapter->netdev;
netif_receive_skb(skb);
#endif
diff --git a/drivers/staging/sxg/sxg_ethtool.c b/drivers/staging/sxg/sxg_ethtool.c
index 8c710f428974..97f765d1250f 100644
--- a/drivers/staging/sxg/sxg_ethtool.c
+++ b/drivers/staging/sxg/sxg_ethtool.c
@@ -221,7 +221,7 @@ static int sxg_nic_get_settings(struct net_device *netdev,
static u32 sxg_nic_get_rx_csum(struct net_device *netdev)
{
struct adapter_t *adapter = netdev_priv(netdev);
- return ((adapter->flags & SXG_RCV_IP_CSUM_ENABLED) ||
+ return ((adapter->flags & SXG_RCV_IP_CSUM_ENABLED) &&
(adapter->flags & SXG_RCV_TCP_CSUM_ENABLED));
}
@@ -232,9 +232,10 @@ static int sxg_nic_set_rx_csum(struct net_device *netdev, u32 data)
adapter->flags |= SXG_RCV_IP_CSUM_ENABLED;
else
adapter->flags &= ~SXG_RCV_IP_CSUM_ENABLED;
-
- /* Reset the card here (call the reset functions .. currently unavailable)*/
-
+ /*
+ * We dont need to write to the card to do checksums.
+ * It does it anyways.
+ */
return 0;
}