11/*
22 * Linux driver for VMware's vmxnet3 ethernet NIC.
33 *
4- * Copyright (C) 2008-2022 , VMware, Inc. All Rights Reserved.
4+ * Copyright (C) 2008-2024 , VMware, Inc. All Rights Reserved.
55 *
66 * This program is free software; you can redistribute it and/or modify it
77 * under the terms of the GNU General Public License as published by the
8080#define VMXNET3_IO_TYPE (addr ) ((addr) >> 24)
8181#define VMXNET3_IO_REG (addr ) ((addr) & 0xFFFFFF)
8282
83+ #define VMXNET3_PMC_PSEUDO_TSC 0x10003
84+
8385enum {
8486 VMXNET3_CMD_FIRST_SET = 0xCAFE0000 ,
8587 VMXNET3_CMD_ACTIVATE_DEV = VMXNET3_CMD_FIRST_SET ,
@@ -123,6 +125,8 @@ enum {
123125 VMXNET3_CMD_GET_RESERVED4 ,
124126 VMXNET3_CMD_GET_MAX_CAPABILITIES ,
125127 VMXNET3_CMD_GET_DCR0_REG ,
128+ VMXNET3_CMD_GET_TSRING_DESC_SIZE ,
129+ VMXNET3_CMD_GET_DISABLED_OFFLOADS ,
126130};
127131
128132/*
@@ -254,6 +258,24 @@ struct Vmxnet3_RxDesc {
254258
255259#define VMXNET3_RCD_HDR_INNER_SHIFT 13
256260
261+ struct Vmxnet3TSInfo {
262+ u64 tsData :56 ;
263+ u64 tsType :4 ;
264+ u64 tsi :1 ; //bit to indicate to set ts
265+ u64 pad :3 ;
266+ u64 pad2 ;
267+ };
268+
269+ struct Vmxnet3_TxTSDesc {
270+ struct Vmxnet3TSInfo ts ;
271+ u64 pad [14 ];
272+ };
273+
274+ struct Vmxnet3_RxTSDesc {
275+ struct Vmxnet3TSInfo ts ;
276+ u64 pad [14 ];
277+ };
278+
257279struct Vmxnet3_RxCompDesc {
258280#ifdef __BIG_ENDIAN_BITFIELD
259281 u32 ext2 :1 ;
@@ -427,6 +449,13 @@ union Vmxnet3_GenericDesc {
427449#define VMXNET3_RXDATA_DESC_SIZE_ALIGN 64
428450#define VMXNET3_RXDATA_DESC_SIZE_MASK (VMXNET3_RXDATA_DESC_SIZE_ALIGN - 1)
429451
452+ /* Rx TS Ring buffer size must be a multiple of 64 bytes */
453+ #define VMXNET3_RXTS_DESC_SIZE_ALIGN 64
454+ #define VMXNET3_RXTS_DESC_SIZE_MASK (VMXNET3_RXTS_DESC_SIZE_ALIGN - 1)
455+ /* Tx TS Ring buffer size must be a multiple of 64 bytes */
456+ #define VMXNET3_TXTS_DESC_SIZE_ALIGN 64
457+ #define VMXNET3_TXTS_DESC_SIZE_MASK (VMXNET3_TXTS_DESC_SIZE_ALIGN - 1)
458+
430459/* Max ring size */
431460#define VMXNET3_TX_RING_MAX_SIZE 4096
432461#define VMXNET3_TC_RING_MAX_SIZE 4096
@@ -439,6 +468,9 @@ union Vmxnet3_GenericDesc {
439468
440469#define VMXNET3_RXDATA_DESC_MAX_SIZE 2048
441470
471+ #define VMXNET3_TXTS_DESC_MAX_SIZE 256
472+ #define VMXNET3_RXTS_DESC_MAX_SIZE 256
473+
442474/* a list of reasons for queue stop */
443475
444476enum {
@@ -546,6 +578,24 @@ struct Vmxnet3_RxQueueConf {
546578};
547579
548580
581+ struct Vmxnet3_LatencyConf {
582+ u16 sampleRate ;
583+ u16 pad ;
584+ };
585+
586+ struct Vmxnet3_TxQueueTSConf {
587+ __le64 txTSRingBasePA ;
588+ __le16 txTSRingDescSize ; /* size of tx timestamp ring buffer */
589+ u16 pad ;
590+ struct Vmxnet3_LatencyConf latencyConf ;
591+ };
592+
593+ struct Vmxnet3_RxQueueTSConf {
594+ __le64 rxTSRingBasePA ;
595+ __le16 rxTSRingDescSize ; /* size of rx timestamp ring buffer */
596+ u16 pad [3 ];
597+ };
598+
549599enum vmxnet3_intr_mask_mode {
550600 VMXNET3_IMM_AUTO = 0 ,
551601 VMXNET3_IMM_ACTIVE = 1 ,
@@ -679,7 +729,8 @@ struct Vmxnet3_TxQueueDesc {
679729 /* Driver read after a GET command */
680730 struct Vmxnet3_QueueStatus status ;
681731 struct UPT1_TxStats stats ;
682- u8 _pad [88 ]; /* 128 aligned */
732+ struct Vmxnet3_TxQueueTSConf tsConf ;
733+ u8 _pad [72 ]; /* 128 aligned */
683734};
684735
685736
@@ -689,7 +740,8 @@ struct Vmxnet3_RxQueueDesc {
689740 /* Driver read after a GET commad */
690741 struct Vmxnet3_QueueStatus status ;
691742 struct UPT1_RxStats stats ;
692- u8 __pad [88 ]; /* 128 aligned */
743+ struct Vmxnet3_RxQueueTSConf tsConf ;
744+ u8 __pad [72 ]; /* 128 aligned */
693745};
694746
695747struct Vmxnet3_SetPolling {
@@ -861,4 +913,7 @@ struct Vmxnet3_DriverShared {
861913/* when new capability is introduced, update VMXNET3_CAP_MAX */
862914#define VMXNET3_CAP_MAX VMXNET3_CAP_VERSION_7_MAX
863915
916+ #define VMXNET3_OFFLOAD_TSO BIT(0)
917+ #define VMXNET3_OFFLOAD_LRO BIT(1)
918+
864919#endif /* _VMXNET3_DEFS_H_ */
0 commit comments