DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] How to calculate checksum automically with NIC when sending a packet?
@ 2013-11-22  2:40 William Rolinson
  2013-11-22 12:07 ` Vladimir Medvedkin
  0 siblings, 1 reply; 3+ messages in thread
From: William Rolinson @ 2013-11-22  2:40 UTC (permalink / raw)
  To: dev

RT~

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

* Re: [dpdk-dev] How to calculate checksum automically with NIC when sending a packet?
  2013-11-22  2:40 [dpdk-dev] How to calculate checksum automically with NIC when sending a packet? William Rolinson
@ 2013-11-22 12:07 ` Vladimir Medvedkin
  2013-11-22 12:14   ` Vladimir Medvedkin
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Medvedkin @ 2013-11-22 12:07 UTC (permalink / raw)
  To: William Rolinson; +Cc: dev

Hi,

If you need only ip checksum:
struct rte_mbuf *m;
m->ol_flags |= PKT_TX_IP_CKSUM;

if you need to calculate tcp checksum add also PKT_TX_TCP_CKSUM flag to
ol_flags field and caclulate pseudoheader checksum (see get_ipv4_psd_sum()
in app/test-pmd/csumonly.c)

struct tcp_hdr *th;
th->cksum               = get_ipv4_psd_sum(iph);

Regards,
Vladimir




2013/11/22 William Rolinson <mydpdk@126.com>

> RT~
>

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

* Re: [dpdk-dev] How to calculate checksum automically with NIC when sending a packet?
  2013-11-22 12:07 ` Vladimir Medvedkin
@ 2013-11-22 12:14   ` Vladimir Medvedkin
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Medvedkin @ 2013-11-22 12:14 UTC (permalink / raw)
  To: William Rolinson; +Cc: dev

Of course you have to properly set
m->pkt.vlan_macip.f.l2_len and
m->pkt.vlan_macip.f.l3_len fields.

Regards,
Vladimir


2013/11/22 Vladimir Medvedkin <medvedkinv@gmail.com>

> Hi,
>
> If you need only ip checksum:
> struct rte_mbuf *m;
> m->ol_flags |= PKT_TX_IP_CKSUM;
>
> if you need to calculate tcp checksum add also PKT_TX_TCP_CKSUM flag to
> ol_flags field and caclulate pseudoheader checksum (see get_ipv4_psd_sum()
> in app/test-pmd/csumonly.c)
>
> struct tcp_hdr *th;
> th->cksum               = get_ipv4_psd_sum(iph);
>
> Regards,
> Vladimir
>
>
>
>
> 2013/11/22 William Rolinson <mydpdk@126.com>
>
>> RT~
>>
>
>

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

end of thread, other threads:[~2013-11-22 12:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-22  2:40 [dpdk-dev] How to calculate checksum automically with NIC when sending a packet? William Rolinson
2013-11-22 12:07 ` Vladimir Medvedkin
2013-11-22 12:14   ` Vladimir Medvedkin

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).