All of lore.kernel.org
 help / color / mirror / Atom feed
* hw/net/cadence_gem: TX checksum offload does not work for fragmented packets
@ 2020-04-21 14:31 Bin Meng
  2020-04-26  6:57 ` Bin Meng
  0 siblings, 1 reply; 3+ messages in thread
From: Bin Meng @ 2020-04-21 14:31 UTC (permalink / raw)
  To: Alistair Francis, Jason Wang, Peter A. G. Crosthwaite, John Linn,
	Edgar E. Iglesias
  Cc: qemu-devel@nongnu.org Developers

Hi,

The cadence_gem does the TX checksum offload by:

                /* Is checksum offload enabled? */
                if (s->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) {
                    net_checksum_calculate(tx_packet, total_bytes);
                }

However this will only work for non-fragmented packets. For fragmented
packets, it just corrupts the packets by inserting wrong checksum to
the fist fragment, or corrupts the data to be sent in other fragments
than the first one.

Any idea of how to solve this cleanly?

Regards,
Bin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: hw/net/cadence_gem: TX checksum offload does not work for fragmented packets
  2020-04-21 14:31 hw/net/cadence_gem: TX checksum offload does not work for fragmented packets Bin Meng
@ 2020-04-26  6:57 ` Bin Meng
  2020-04-26  7:02   ` Jason Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Bin Meng @ 2020-04-26  6:57 UTC (permalink / raw)
  To: Alistair Francis, Jason Wang, Peter A. G. Crosthwaite, John Linn,
	Edgar E. Iglesias
  Cc: qemu-devel@nongnu.org Developers

Hi Jason,

On Tue, Apr 21, 2020 at 10:31 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi,
>
> The cadence_gem does the TX checksum offload by:
>
>                 /* Is checksum offload enabled? */
>                 if (s->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) {
>                     net_checksum_calculate(tx_packet, total_bytes);
>                 }
>
> However this will only work for non-fragmented packets. For fragmented
> packets, it just corrupts the packets by inserting wrong checksum to
> the fist fragment, or corrupts the data to be sent in other fragments
> than the first one.
>
> Any idea of how to solve this cleanly?

I suspect this is a common issue for all NIC models in QEMU. Could you
please comment?

Regards,
Bin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: hw/net/cadence_gem: TX checksum offload does not work for fragmented packets
  2020-04-26  6:57 ` Bin Meng
@ 2020-04-26  7:02   ` Jason Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2020-04-26  7:02 UTC (permalink / raw)
  To: Bin Meng, Alistair Francis, Peter A. G. Crosthwaite, John Linn,
	Edgar E. Iglesias
  Cc: qemu-devel@nongnu.org Developers


On 2020/4/26 下午2:57, Bin Meng wrote:
> Hi Jason,
>
> On Tue, Apr 21, 2020 at 10:31 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>> Hi,
>>
>> The cadence_gem does the TX checksum offload by:
>>
>>                  /* Is checksum offload enabled? */
>>                  if (s->regs[GEM_DMACFG] & GEM_DMACFG_TXCSUM_OFFL) {
>>                      net_checksum_calculate(tx_packet, total_bytes);
>>                  }
>>
>> However this will only work for non-fragmented packets. For fragmented
>> packets, it just corrupts the packets by inserting wrong checksum to
>> the fist fragment, or corrupts the data to be sent in other fragments
>> than the first one.
>>
>> Any idea of how to solve this cleanly?
> I suspect this is a common issue for all NIC models in QEMU. Could you
> please comment?
>
> Regards,
> Bin


I think maybe you can have a look at how it was done by e1000e which 
uses NetTxPkt structure. (E.g net_tx_pkt_update_ip_checksum()).

In the future, we may consider to convert the metadata that just uses 
NetTxPkt structure, but it's a non-trivial changes.

Thanks



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-26  7:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 14:31 hw/net/cadence_gem: TX checksum offload does not work for fragmented packets Bin Meng
2020-04-26  6:57 ` Bin Meng
2020-04-26  7:02   ` Jason Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.