* [PATCH 0/3] qla3xxx checksum related patches
@ 2007-05-30 21:23 Stephen Hemminger
2007-05-30 21:23 ` [PATCH 1/3] qla3xxx: device doesnt do hardware checksumming Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-05-30 21:23 UTC (permalink / raw)
To: Jeff Garzik, linux-driver; +Cc: netdev
Found while looking at drivers that are doing NETIF_F_HW_CSUM
incorrectly.
The first is a bug fix. Second is cleanup, Third is an enhancement.
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] qla3xxx: device doesnt do hardware checksumming.
2007-05-30 21:23 [PATCH 0/3] qla3xxx checksum related patches Stephen Hemminger
@ 2007-05-30 21:23 ` Stephen Hemminger
2007-06-03 15:46 ` Jeff Garzik
2007-05-30 21:23 ` [PATCH 2/3] qla3xxx: cleanup checksum offload code Stephen Hemminger
2007-05-30 21:23 ` [PATCH 3/3] qla3xxx: ethtool ops for controlling checksum Stephen Hemminger
2 siblings, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2007-05-30 21:23 UTC (permalink / raw)
To: Jeff Garzik, linux-driver; +Cc: netdev
[-- Attachment #1: qla-ipv6.patch --]
[-- Type: text/plain, Size: 922 bytes --]
Reading the code for ql_hw_csum_setup(), it is obvious that
this driver is broken for IPV6. The driver sets the NETIF_F_HW_SUM
flag, but the code for checksum setup only deals with IPV4.
Compile tested only, no hardware available.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
drivers/net/qla3xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/qla3xxx.c 2007-05-30 14:05:12.000000000 -0700
+++ b/drivers/net/qla3xxx.c 2007-05-30 14:09:25.000000000 -0700
@@ -4044,7 +4044,7 @@ static int __devinit ql3xxx_probe(struct
if (pci_using_dac)
ndev->features |= NETIF_F_HIGHDMA;
if (qdev->device_id == QL3032_DEVICE_ID)
- ndev->features |= (NETIF_F_HW_CSUM | NETIF_F_SG);
+ ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
qdev->mem_map_registers =
ioremap_nocache(pci_resource_start(pdev, 1),
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] qla3xxx: cleanup checksum offload code
2007-05-30 21:23 [PATCH 0/3] qla3xxx checksum related patches Stephen Hemminger
2007-05-30 21:23 ` [PATCH 1/3] qla3xxx: device doesnt do hardware checksumming Stephen Hemminger
@ 2007-05-30 21:23 ` Stephen Hemminger
2007-06-06 23:23 ` Ron Mercer
` (2 more replies)
2007-05-30 21:23 ` [PATCH 3/3] qla3xxx: ethtool ops for controlling checksum Stephen Hemminger
2 siblings, 3 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-05-30 21:23 UTC (permalink / raw)
To: Jeff Garzik, linux-driver; +Cc: netdev
[-- Attachment #1: qla-csum.patch --]
[-- Type: text/plain, Size: 1988 bytes --]
The code for checksum is more complex than needed when dealing with VLAN's;
the higher layers already pass down the location of the IP header.
Compile tested only, no hardware available.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
drivers/net/qla3xxx.c | 37 +++++++++++--------------------------
1 file changed, 11 insertions(+), 26 deletions(-)
--- a/drivers/net/qla3xxx.c 2007-05-30 14:09:25.000000000 -0700
+++ b/drivers/net/qla3xxx.c 2007-05-30 14:09:31.000000000 -0700
@@ -2433,37 +2433,22 @@ static int ql_get_seg_count(struct ql3_a
return -1;
}
-static void ql_hw_csum_setup(struct sk_buff *skb,
+static void ql_hw_csum_setup(const struct sk_buff *skb,
struct ob_mac_iocb_req *mac_iocb_ptr)
{
- struct ethhdr *eth;
- struct iphdr *ip = NULL;
- u8 offset = ETH_HLEN;
-
- eth = (struct ethhdr *)(skb->data);
-
- if (eth->h_proto == __constant_htons(ETH_P_IP)) {
- ip = (struct iphdr *)&skb->data[ETH_HLEN];
- } else if (eth->h_proto == htons(ETH_P_8021Q) &&
- ((struct vlan_ethhdr *)skb->data)->
- h_vlan_encapsulated_proto == __constant_htons(ETH_P_IP)) {
- ip = (struct iphdr *)&skb->data[VLAN_ETH_HLEN];
- offset = VLAN_ETH_HLEN;
- }
-
- if (ip) {
- if (ip->protocol == IPPROTO_TCP) {
- mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_TC |
+ const struct iphdr *ip = ip_hdr(skb);
+
+ mac_iocb_ptr->ip_hdr_off = skb_network_offset(skb);
+ mac_iocb_ptr->ip_hdr_len = ip->ihl;
+
+ if (ip->protocol == IPPROTO_TCP) {
+ mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_TC |
OB_3032MAC_IOCB_REQ_IC;
- mac_iocb_ptr->ip_hdr_off = offset;
- mac_iocb_ptr->ip_hdr_len = ip->ihl;
- } else if (ip->protocol == IPPROTO_UDP) {
- mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_UC |
+ } else {
+ mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_UC |
OB_3032MAC_IOCB_REQ_IC;
- mac_iocb_ptr->ip_hdr_off = offset;
- mac_iocb_ptr->ip_hdr_len = ip->ihl;
- }
}
+
}
/*
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] qla3xxx: ethtool ops for controlling checksum
2007-05-30 21:23 [PATCH 0/3] qla3xxx checksum related patches Stephen Hemminger
2007-05-30 21:23 ` [PATCH 1/3] qla3xxx: device doesnt do hardware checksumming Stephen Hemminger
2007-05-30 21:23 ` [PATCH 2/3] qla3xxx: cleanup checksum offload code Stephen Hemminger
@ 2007-05-30 21:23 ` Stephen Hemminger
2 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-05-30 21:23 UTC (permalink / raw)
To: Jeff Garzik, linux-driver; +Cc: netdev
[-- Attachment #1: qla-ethtool-ops.patch --]
[-- Type: text/plain, Size: 1670 bytes --]
Add the ability to control scatter/gather and checksumming
via ethtool.
Compile tested only, no hardware available.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
drivers/net/qla3xxx.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
--- a/drivers/net/qla3xxx.c 2007-05-30 14:10:42.000000000 -0700
+++ b/drivers/net/qla3xxx.c 2007-05-30 14:15:37.000000000 -0700
@@ -1901,6 +1901,35 @@ static void ql_get_pauseparam(struct net
pause->tx_pause = (reg & MAC_CONFIG_REG_TF) >> 1;
}
+static int ql_set_tx_csum(struct net_device *dev, u32 data)
+{
+ if (data) {
+ struct ql3_adapter *qdev = netdev_priv(ndev);
+
+ if (qdev->device_id != QL3032_DEVICE_ID)
+ return -EINVAL;
+
+ dev->features |= NETIF_F_IP_CSUM;
+ } else
+ dev->features &= ~NETIF_F_IP_CSUM;
+
+ return 0;
+}
+
+static int ql_set_sg(struct net_device *dev, u32 data)
+{
+ if (data) {
+ struct ql3_adapter *qdev = netdev_priv(ndev);
+
+ if (qdev->device_id != QL3032_DEVICE_ID)
+ return -EINVAL;
+ dev->features |= NETIF_F_SG;
+ } else
+ dev->features &= ~NETIF_F_SG;
+
+ return 0;
+}
+
static const struct ethtool_ops ql3xxx_ethtool_ops = {
.get_settings = ql_get_settings,
.get_drvinfo = ql_get_drvinfo,
@@ -1909,6 +1938,10 @@ static const struct ethtool_ops ql3xxx_e
.get_msglevel = ql_get_msglevel,
.set_msglevel = ql_set_msglevel,
.get_pauseparam = ql_get_pauseparam,
+ .get_tx_csum = ql_op_get_tx_csum,
+ .set_tx_csum = ethtool_op_set_tx_csum,
+ .get_sg = ethtool_op_get_sg,
+ .set_sg = ql_get_sg,
};
static int ql_populate_free_queue(struct ql3_adapter *qdev)
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] qla3xxx: device doesnt do hardware checksumming.
2007-05-30 21:23 ` [PATCH 1/3] qla3xxx: device doesnt do hardware checksumming Stephen Hemminger
@ 2007-06-03 15:46 ` Jeff Garzik
0 siblings, 0 replies; 9+ messages in thread
From: Jeff Garzik @ 2007-06-03 15:46 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-driver, netdev
Stephen Hemminger wrote:
> Reading the code for ql_hw_csum_setup(), it is obvious that
> this driver is broken for IPV6. The driver sets the NETIF_F_HW_SUM
> flag, but the code for checksum setup only deals with IPV4.
>
> Compile tested only, no hardware available.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
applied to #upstream-fixes
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 2/3] qla3xxx: cleanup checksum offload code
2007-05-30 21:23 ` [PATCH 2/3] qla3xxx: cleanup checksum offload code Stephen Hemminger
@ 2007-06-06 23:23 ` Ron Mercer
2007-06-13 19:43 ` Jeff Garzik
2007-06-13 20:04 ` Jeff Garzik
2 siblings, 0 replies; 9+ messages in thread
From: Ron Mercer @ 2007-06-06 23:23 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
Jeff,
You've already appled patch 1/3 in Stephen's series. I tested this one
(2/3) and it looks good. I can resubmit this if you want.
Regards, Ron Mercer
> -----Original Message-----
> From: Stephen Hemminger [mailto:shemminger@linux-foundation.org]
> Sent: Wednesday, May 30, 2007 2:23 PM
> To: Jeff Garzik; Linux Driver
> Cc: netdev@vger.kernel.org
> Subject: [PATCH 2/3] qla3xxx: cleanup checksum offload code
>
> The code for checksum is more complex than needed when
> dealing with VLAN's;
> the higher layers already pass down the location of the IP header.
>
> Compile tested only, no hardware available.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
>
> ---
> drivers/net/qla3xxx.c | 37 +++++++++++--------------------------
> 1 file changed, 11 insertions(+), 26 deletions(-)
>
> --- a/drivers/net/qla3xxx.c 2007-05-30 14:09:25.000000000 -0700
> +++ b/drivers/net/qla3xxx.c 2007-05-30 14:09:31.000000000 -0700
> @@ -2433,37 +2433,22 @@ static int ql_get_seg_count(struct ql3_a
> return -1;
> }
>
> -static void ql_hw_csum_setup(struct sk_buff *skb,
> +static void ql_hw_csum_setup(const struct sk_buff *skb,
> struct ob_mac_iocb_req *mac_iocb_ptr)
> {
> - struct ethhdr *eth;
> - struct iphdr *ip = NULL;
> - u8 offset = ETH_HLEN;
> -
> - eth = (struct ethhdr *)(skb->data);
> -
> - if (eth->h_proto == __constant_htons(ETH_P_IP)) {
> - ip = (struct iphdr *)&skb->data[ETH_HLEN];
> - } else if (eth->h_proto == htons(ETH_P_8021Q) &&
> - ((struct vlan_ethhdr *)skb->data)->
> - h_vlan_encapsulated_proto ==
> __constant_htons(ETH_P_IP)) {
> - ip = (struct iphdr *)&skb->data[VLAN_ETH_HLEN];
> - offset = VLAN_ETH_HLEN;
> - }
> -
> - if (ip) {
> - if (ip->protocol == IPPROTO_TCP) {
> - mac_iocb_ptr->flags1 |=
> OB_3032MAC_IOCB_REQ_TC |
> + const struct iphdr *ip = ip_hdr(skb);
> +
> + mac_iocb_ptr->ip_hdr_off = skb_network_offset(skb);
> + mac_iocb_ptr->ip_hdr_len = ip->ihl;
> +
> + if (ip->protocol == IPPROTO_TCP) {
> + mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_TC |
> OB_3032MAC_IOCB_REQ_IC;
> - mac_iocb_ptr->ip_hdr_off = offset;
> - mac_iocb_ptr->ip_hdr_len = ip->ihl;
> - } else if (ip->protocol == IPPROTO_UDP) {
> - mac_iocb_ptr->flags1 |=
> OB_3032MAC_IOCB_REQ_UC |
> + } else {
> + mac_iocb_ptr->flags1 |= OB_3032MAC_IOCB_REQ_UC |
> OB_3032MAC_IOCB_REQ_IC;
> - mac_iocb_ptr->ip_hdr_off = offset;
> - mac_iocb_ptr->ip_hdr_len = ip->ihl;
> - }
> }
> +
> }
>
> /*
>
> --
> Stephen Hemminger <shemminger@linux-foundation.org>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] qla3xxx: cleanup checksum offload code
2007-05-30 21:23 ` [PATCH 2/3] qla3xxx: cleanup checksum offload code Stephen Hemminger
2007-06-06 23:23 ` Ron Mercer
@ 2007-06-13 19:43 ` Jeff Garzik
2007-06-13 19:55 ` Ron Mercer
2007-06-13 20:04 ` Jeff Garzik
2 siblings, 1 reply; 9+ messages in thread
From: Jeff Garzik @ 2007-06-13 19:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-driver, netdev
Stephen Hemminger wrote:
> The code for checksum is more complex than needed when dealing with VLAN's;
> the higher layers already pass down the location of the IP header.
>
> Compile tested only, no hardware available.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Ron, do you ACK patch #2 and patch #3?
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 2/3] qla3xxx: cleanup checksum offload code
2007-06-13 19:43 ` Jeff Garzik
@ 2007-06-13 19:55 ` Ron Mercer
0 siblings, 0 replies; 9+ messages in thread
From: Ron Mercer @ 2007-06-13 19:55 UTC (permalink / raw)
To: Jeff Garzik, Stephen Hemminger; +Cc: netdev
ACK patch #2, not patch 3. I will add patch 3 at a later date.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
> -----Original Message-----
> From: Jeff Garzik [mailto:jeff@garzik.org]
> Sent: Wednesday, June 13, 2007 12:44 PM
> To: Stephen Hemminger
> Cc: Linux Driver; netdev@vger.kernel.org
> Subject: Re: [PATCH 2/3] qla3xxx: cleanup checksum offload code
>
> Stephen Hemminger wrote:
> > The code for checksum is more complex than needed when
> dealing with VLAN's;
> > the higher layers already pass down the location of the IP header.
> >
> > Compile tested only, no hardware available.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
>
> Ron, do you ACK patch #2 and patch #3?
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] qla3xxx: cleanup checksum offload code
2007-05-30 21:23 ` [PATCH 2/3] qla3xxx: cleanup checksum offload code Stephen Hemminger
2007-06-06 23:23 ` Ron Mercer
2007-06-13 19:43 ` Jeff Garzik
@ 2007-06-13 20:04 ` Jeff Garzik
2 siblings, 0 replies; 9+ messages in thread
From: Jeff Garzik @ 2007-06-13 20:04 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: linux-driver, netdev
Stephen Hemminger wrote:
> The code for checksum is more complex than needed when dealing with VLAN's;
> the higher layers already pass down the location of the IP header.
>
> Compile tested only, no hardware available.
>
> Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
applied to #upstream (2.6.23)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-06-13 20:05 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-30 21:23 [PATCH 0/3] qla3xxx checksum related patches Stephen Hemminger
2007-05-30 21:23 ` [PATCH 1/3] qla3xxx: device doesnt do hardware checksumming Stephen Hemminger
2007-06-03 15:46 ` Jeff Garzik
2007-05-30 21:23 ` [PATCH 2/3] qla3xxx: cleanup checksum offload code Stephen Hemminger
2007-06-06 23:23 ` Ron Mercer
2007-06-13 19:43 ` Jeff Garzik
2007-06-13 19:55 ` Ron Mercer
2007-06-13 20:04 ` Jeff Garzik
2007-05-30 21:23 ` [PATCH 3/3] qla3xxx: ethtool ops for controlling checksum Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).