[ofa-general] [PATCHv2] IB/ipoib: S/G and HW checksum support

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Tue Sep 4 13:29:07 PDT 2007


On Tue, Sep 04, 2007 at 10:56:51PM +0300, Michael S. Tsirkin wrote:
> > Yuk. Sending invalid UD packets is horrible.
> 
> I don't understand where do you get malformed UD packets.

Any packet you put on the network with an invalid L4 csum is what I
would called malformed.. Any conformant implementation that Rx's those
packets will reject them.

> > Eh? You set IPOIB_HEADER_F_HWCSUM on the TX path if the csum is
> > invalid
> 
> If I get CHECKSUM_NONE, I really expect there's no checksum.
> So ... 

Am I reading this wrong?

@@ -782,7 +785,10 @@ static int ipoib_hard_header(struct sk_buff *skb,
        header = (struct ipoib_header *) skb_push(skb, sizeof *header);

        header->proto = htons(type);
-       header->reserved = 0;
+       if (skb->ip_summed == CHECKSUM_COMPLETE)
+               header->flags = 0;
+       else
+               header->flags = cpu_to_be16(IPOIB_HEADER_F_HWCSUM);

The two relevent cases here are CHECKSUM_NONE (the csum is not
present, or present but valid) and CHECKSUM_PARTIAL (the csum is not
valid, but is present).

In both cases you put the packet onto the wire with
IPOIB_HEADER_F_HWCSUM and in the CHECKSUM_PARTIAL case the packet has
an invalid checksum on the wire.

Then on the RX side you recover it, mark it as CHECKSUM_UNNECESSARY
which tells the stack not to check the L4 checksum. But it is still
there and still 'badly csumed' (ie invalid).

On the RX side, after going through ip_forward the TX'ing ethernet
driver sees ip_summed != CHECKSUM_PARTIAL and does
nothing, propogating the bad L4 checksum onto the ethernet side.

Jason



More information about the general mailing list