Commit Graph

49 Commits

Author SHA1 Message Date
Sanath Kumar Gampa
6ca5a03728 nvethernet: Add MACSec counters to ethtool stats
Bug 4915922

Change-Id: I21920fe788d8a3789faeaa13a82d6961ee1371a4
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233767
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
2025-07-24 10:19:10 +00:00
Mahesh Patil
ea427d0f7c nvethernet: ethtool to show 48 VDMA channels stats
Enable ethtool to show 48 channel tx/rx packets stats

Bug 4746911
Change-Id: I8ab615910903f3b3b6a21e1aa6a2d42d6552c5ed
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3178610
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Michael Hsu <mhsu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
2025-07-24 10:19:07 +00:00
Jon Hunter
9d6283ca4f net: nvethernet: Fix build for Linux v6.11
In Linux v6.11, the structure 'kernel_ethtool_ts_info' was added as a
copy of the existing 'ethtool_ts_info' for the kernel and the various
kernel functions were updated to use the new structure. This broke the
build for the nvethernet driver, so add a test to the conftest script to
detect the presence of this new strucutue and update the nvethernet
driver accordingly.

Bug 4749580

Change-Id: I2c5daa0132edee8c98eec3a66e19144484325ab0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3176868
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
2024-07-19 03:13:55 -07:00
Jon Hunter
955de38d70 net: nvethernet: Fix support for Linux v6.9
When nvethernet was updated to support Linux v6.9 kernels, the code that
checks if the variable 'eee_req->advertised' is zero or non-zero was not
updated correctly. For Linux v6.9, the variable 'eee_req->advertised' is
a bitmask and so cannot be checked directly to see if it is zero or
non-zero. Building the nvethernet driver with the flag '-Werror=address'
exposed this issue. Fix this by using the 'linkmode_empty()' function to
determine if 'eee_req->advertised' is zero or non-zero for Linux v6.9
kernels.

Bug 4471899
Bug 4662166

Change-Id: Id4080d62006226648cd398dc8652578c74dd8158
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3158064
Tested-by: Shanker Donthineni <sdonthineni@nvidia.com>
Reviewed-by: Rohit Khanna <rokhanna@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Shanker Donthineni <sdonthineni@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Rohit Khanna <rokhanna@nvidia.com>
2024-06-26 06:30:19 -07:00
Mahesh Patil
5edac49a28 nvethernet: T264 Enable 20 VDMA channel support
Ported from -
https://git-master.nvidia.com/r/c/nvethernet-docs/+/2940794

Bug 4043836

Change-Id: I763bfdaa78082de035219e10ef1c131bdbba5e35
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
2024-06-07 13:10:54 +00:00
Jon Hunter
72761b8276 net: nvethernet: Fix build for Linux v6.9
For Linux v6.9, the structure 'ethtool_eee' was replaced by
'ethtool_keee' and this new structure uses bitmaps for the structure
fields 'supported', 'advertised' and 'lp_advertised' as opposed to
'u32' types.

Add a test to conftest to detect the presence of the new 'ethtool_keee'
structure and update the nvethernet driver to use the various
linkmode_xxx helper functions for accessing the bitmap structure fields.

Bug 4471899

Change-Id: I275becfa665a36ed90e8bc227eaa4122825faa6a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3110494
Reviewed-by: Paritosh Dixit <paritoshd@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2024-04-17 08:47:15 -07:00
Jon Hunter
0356a563b3 net: nvethernet: Fix build for Linux v6.8
The ethtool_ops function pointers get_rxfh and set_rxfh were updated for
Linux v6.8 to pass arguments via a new 'ethtool_rxfh_param' structure.
Add a new test for conftest to detect if the get_rxfh and set_rxfh
functions support the 'ethtool_rxfh_param' structure and update the
nvethernet driver accordingly for Linux v6.8.

Bug 4448428

Change-Id: Ia1c49d88c4ac73539454b010af92c261e14be4bf
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037949
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 15:23:19 -08:00
Jon Hunter
ed130f099a net: nvethernet: Fix build for Linux v6.4
In Linux v6.4, commit
3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
added a kernel config option for MAX_SKB_FRAGS and change the type of
the definition to integer. This causes the nvethernet driver build to
fail and the following errors are seen ...

 drivers/net/ethernet/nvidia/nvethernet/ether_linux.c:5949:33: error:
  format ‘%ld’ expects argument of type ‘long int’, but argument 4
  has type ‘nveu32_t’ {aka ‘unsigned int’} [-Werror=format=]
    "invalid tx-frames, must be inrange %d to %ld",
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 drivers/net/ethernet/nvidia/nvethernet/ethtool.c:950:28: error: format
  ‘%ld’ expects argument of type ‘long int’, but argument 4 has
  type ‘nveu32_t’ {aka ‘unsigned int’} [-Werror=format=]
    "invalid tx-frames, must be in the range of"
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix this by changing the type in the respective prints to integer. Note
that his is also to make this change for kernel prior to Linux v6.4.

Bug 4183168
Bug 4221847

Change-Id: Ibd9160ad08e65e0b85cae1cf4903075c31a1cd77
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989002
Reviewed-by: Shanker Donthineni <sdonthineni@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-05 04:37:24 -07:00
Jon Hunter
ece68dd0d1 net: Use conftest
Instead of relying on kernel version to determine if functions or
specific versions of functions are present in the kernel, add compile
time tests to the conftest.sh script to determine this at compile time
for the kernel being used. This is beneficial for working with 3rd party
Linux kernels that may have back-ported upstream changes into their
kernel and so the kernel version checks do not work.

Bug 4119327

Change-Id: I79e701940ca70ca4d66500c75b5992f9d92b54b0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985744
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-03 04:01:15 -07:00
Mohan Thadikamalla
01d8319aae nvethernet: Add Linux safety support
Issue:
Observed compilation issues
on the nvethernet driver
for DRIVE Linux safety builds.

Fix:
Add OSI_STRIPPED_LIB support
on nvethernet driver.

Bug 3939603

Change-Id: Id4213c1cf33dc0e925df3e627072b727ae44fa71
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2842470
(cherry picked from commit ece0eb57a89396ea8bdc412beeaa7dfabbda49b1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2879701
Tested-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:49:37 -07:00
Jon Hunter
1e04890051 nvethernet: Fix build for Linux v5.14 and v5.17+
The nvethernet driver fails to build for Linux v5.14 and Linux v5.17+
kernels. In Linux v5.15 the return type of the get/set_coalesce
callbacks were updated. In Linux v5.17 the parameters for the
get/set_ringparam callbacks were updated. In Linux v6.1 the
weight parameter for the netif_napi_add() function was removed and the
function netif_napi_add_weight() was added for passing the weight
parameter. Add the necessary kernel version checks to ensure that the
drivers build with the different versions of the Linux kernel.

Bug 3793131

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I56738eddd27eb4ebf7db5a2d0d031a64379482e8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2820712
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-05 20:45:48 -08:00
Revanth Kumar Uppala
e37e03efd9 nvethernet: Enable nvethernet driver support
Enable nvethernet driver support for K5.15

Bug 3793131

Change-Id: I2a6d46c9173ea633931308c34e950b404f54796d
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2801126
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-29 04:06:17 -08:00
Mohan Thadikamalla
d0ac6d4396 nvethernet: Update status counters using ioctls
Issue:
TSN, extra, packet error stats counters
are not getting updated during virtualization,
as NVEQOS reads them from the VF OSI core structure.

Fix:
Add new ioctls to update these counters from
the ethernet server OSI core to
the VF OSI core structure.

Bug 3763499

Change-Id: I6e82f9756afe0c2f1adefb5a2449fad479864ea6
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2809358
(cherry picked from commit ab043869fb9b1feb197496d4695b333845689e5e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2815774
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Revanth Kumar Uppala <ruppala@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-11-29 04:06:13 -08:00
Narayan Reddy
99acf2912b nvethernet: add lane bringup restart callback
Issue: In the current scenrio, when the remote
interface is brought down and up. There is no way
of getting the link up again with the remote device
which in turn fails the data transfers even though
interface from other end is brought up.

Fix: When interface is gone down on the other side,
MAC receives local faults and in this scenario
no data should be sent to MAC, so disable network
queues and initiate the lane bring up process for
monitoring the link status. Once the link is up,
re enable the network queues for data transfers.

Also added support for enabling driver logs using
msglvl of ethtool

Bug 3744088
Bug 3654543
Bug 3665378

Change-Id: I16cdee74e4e3ff6cd176924575f5005f385d4c5d
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2730876
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bhadram Varka
b1309d41ea nvethernet: Support for variable Tx/Rx ring length
o Adds support for variable Tx/Rx ring length
which can be changed with ethtool.
o Using default ring size 1K for both MGBE/EQOS
if ring size values not passed from DT.

Bug 3489814

Change-Id: If90a9b2181f9fe9b4beb2ab44e27cb61026cc150
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2652964
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bhadram Varka
ad01764abb nvethernet: fix coverity defects
CID 9871576 Untrusted array index read
CID 10112340 Dereference before null check
CID 10127838 Unchecked return value
CID 10127841 Dead default in switch
CID 10127905 Unchecked return value
CID 10127961 Unused value

Bug 3461002

Change-Id: If041434e57295b282dacf06ed66b1a436b96a165
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2665776
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Om Prakash Singh
906381bd22 nvethernet: fix pkt error ethtool stats
Issue: below ptk error stats are showing wrong value:
        mgbe_ip_header_err
        mgbe_jabber_timeout_err
        mgbe_payload_cs_err
        mgbe_tx_underflow_err

Fix: pkt error stats are part of osi_core structure. Move
     these state in ether_gstrings_stats array that are
     referenced from osi_core, instead of ether_cstrings_stats
     which is referenced from osi_dma.

Bug 3484504
Change-Id: I38eae17526be654b93b1adb4bd1a70de359b9608
Signed-off-by: Om Prakash Singh <omp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2647928
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Narayan Reddy
4612ee1b1e nvethernet: replace SUPPORTED_* to linkmode_*_bit() api.
Issue:
1) usuage of SUPPORTED_* in PHY driver for setting
the link mode parameters leading data corruption. So
replaced SUPPORTED_* with linkmode_*_bit in PHY driver.
2) Redundant code of setting Pause of PHY

Fix:
1) Change SUPPORTED_* to ETHTOOL_LINK_MODE_*_BIT for
consistent check between PHY and Ethernet driver for K5.10.
2) removed pause setting of PHY, since this is already
taken care in corresponding PHY drivers.

Bug 200781153

Change-Id: Ic6a212dd4560fb3a06a4f60be3bdd33620a38197
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2607712
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Rakesh Goyal
68e7a47f9c nvethernet: print lock failure counter
Print mmc counters for lock failure during
node addition and deletion.

Bug 200743666

Change-Id: Iafd112a66839796546959a27c758cbd297178b6f
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2594818
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Gaurav Asati <gasati@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
1e95418da0 nvethernet: add pkt error stats to ethtool
Issue: Population of Tx packet error stats is not present
through ethtool

Fix: Add Tx packet error stats.

Bug 200565898
Bug 200765786

Change-Id: I950b3de3f470111e8d2ec912f21fb0d131aa47a3
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2597402
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Rakesh Goyal
c33c0b334c nvethernet: update min rx coalescing timer value
MGBE and EQOS supports different rx coalescing
timer value. Add logic for check for same
for input from ethtool and DT

Bug 200767374

Change-Id: I324d48200f4bd5ce71f7740411c8da5b06275134
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2589963
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
1d0b94cfa9 nvethernet: fix MMC counters for more than 4 channels
Issue: Currently ethtool not printing the counters information
more than DMA channels 4.

Fix: Add dump support for dumping the data for more then four
DMA channels or MTL queues.

Bug 200760072

Change-Id: I72551bce3a8e88a04e866857345eeede5e0f3447
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2588070
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
rakesh goyal
1c87167250 nvethernet: use single API for ioctl
To reduce number of external OSI interface APIs,
consolidated all IOCTL API to one interface API.
OSD should use same for all interaction to OSI.

Bug 200671160

Change-Id: I2ada2746f29be6cf396709c2ec12dd96d4a5ca15
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
2022-11-01 14:27:08 +05:30
Mohan Thadikamalla
c2f3c724bd nvethernet: Add FRP command IOCTL support
Add new private IOCTL to perform
Flexible Receive Parser table entry
add, delete, and update operations
using OSI API call.

Bug 200565623

Change-Id: I00f2be1aaa6ee737de5154085be0521db0bb9593
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2331371
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
2022-11-01 14:27:08 +05:30
Rakesh Goyal
f244049a90 nvethernet: TSN support
Initialize TSN and ioctl support for configuration

Bug 200561100

Change-Id: Ic8a488de7850b63a593db69e626b19ad139811a1
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2319819
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
2022-11-01 14:27:08 +05:30
Rakesh Goyal
59e2c42725 nvethernet: Extend PTP support
Adding support for one step sync
Adding support for user input from sysfs node

Bug 200562043

Change-Id: I686f035d54c8fb998db968178aca772258830ec7
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2314229
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
a6520f2194 nvethernet: add support for RSS
Changes takes care generation Hash key and population
of hash table with necessary information.

It also adds support ethtool to get/set hash key/table.

Bug 200565647

Change-Id: I5d5364bc88f4dea9456919b886dd8ede7f638ae3
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2263899
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
663753148e nvethernet: Add MGBE stats for ethtool
Bug 200565915

Change-Id: If450f4c7c1619f8b013403f8b0c2135a34f472d3
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2292238
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
2022-11-01 14:27:08 +05:30
Bhadram Varka
93924a32f3 Revert "nvethernet: use single API for ioctl"
This reverts commit 5bbeaa61e89ee6375a15020f2ef533b5ed66d628.
2022-11-01 14:27:08 +05:30
rakesh goyal
f4d30eb89b nvethernet: use single API for ioctl
To reduce number of external OSI interface APIs,
consolidated all IOCTL API to one interface API.
OSD should use same for all interaction to OSI.

Bug 200671160

Change-Id: I05324777c9bd7ed3c167e4f8a629af2e695389d2
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2493248
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
0d329bb260 nvethernet: Support for Ethernet selftests
Adds selftest support for -
1) MAC loopback
2) PHY loopback
3) MMC Counters

Bug 200622869

Change-Id: Ib476afa342c283b53d5ab74cc50a1458183ab16d
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2354887
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bibhay Ranjan
81378766ad nvethernet: fix ethtool ops for kernel > 5.4
Bug 200617764

Change-Id: I34d9b640593219a4775c7c38f7ec7034b6d13fe5
Signed-off-by: Bibhay Ranjan <bibhayr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2348800
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Bitan Biswas
0e7b230bab nvidia: drivers: fix linux-5.7-rc5 build
Fix build linux-5.7-rc5 errors including following:
	- change timespec to timespec64. replace getnstimeofday
	  with ktime_get_ts64
	- replace usage of macro FIELD_SIZEOF with sizeof_field in ethtool.c
	  nvethernet and eqos files.
	- support 2 arguments for of_get_phy_mode call

bug 200617764

Change-Id: I46067d7d36d08ee9556b2722e9ccec707b8853d4
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2347244
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Bibhay Ranjan
619f3c7b7d nvethernet: bringup on kernel-5.4
disable chip-id.h APIs on kernel-5.4 since
the file is still not available.

Back compatible with older kernel versions

Bug 200591808

Change-Id: Ib991ad02ba016ac9f186b5c8afdc8608c780d9be
Signed-off-by: Bibhay Ranjan <bibhayr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2304494
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
rakesh goyal
ecf995a8f7 nvethernet: ethtool: counter for pkt_err stats got cleared
Add counter for how many times pkt_err stats got cleared
using osi_clear_tx_pkt_err_stats and
osi_clear_rx_pkt_err_stats call.

Bug 200548007

Change-Id: I3f98256306f9104ad952ff1829c48ccce41c4d4e
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2304565
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bhadram Varka
dbdc5e7764 nvethernet: rename EQOS to ETHER
It rename EQOS to ETHER so that it can be used for
other IP's as well.

Bug 200565915

Change-Id: Idbec6f1706ecf594dc13fb48f9936746eb78aecc
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2292241
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Srinivas Ramachandran
7fb9f30e28 nvethernet: Add support for EEE LPI
1. Add statistics for keeping track of EEE LPI entry/exit.
Invoke the API to configure EEE LPI in HW based on the PHY link
status and EEE support in PHY.

2. Add support to enable/disable EEE from ethtool.

Bug 2594864

Change-Id: Ib7703e087eb83269a351689f8d406564f799709a
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2160786
Reviewed-by: Ajay Gupta <ajayg@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Ajay Gupta
97dede3ff9 nvethernet: enable tx interrupt coalescing
Tx frame count and software timer based interrupt coalescing
is enabled. Tx frame count based interrupt coalescing can be
enabled only when tx software timer based interrupt coalescing
is also enabled.

Bug 200529168

Change-Id: I8ac701c86238e8d34d7dbe9924df1162083c023e
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2234610
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Ajay Gupta
5a14f39d86 nvethernet: enable rx frame based interrupt coalescing
Rx frame based coalescing can be enabled only when
Rx timer based coalescing is also enabled. This is to avoid
no rx interrupt issues for applications which send only limited
frames and expects reply.

Bug 200529168

Change-Id: I7b00414bd56935ad8df57c9fa28764feb878213d
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2233503
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Mohan Thadikamalla
975de5f870 nvethernet: add WOL feature support
Enable WOL feature with ethtool
Get Wol feature details by - ethtool eth0
Set the feature for magic packet by - ethtool -s eth0 wol g

Bug 200545369

Change-Id: Ia4a9696b4a35b487d8e848a6c40de7510e8374d3
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2178086
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Srinivas Ramachandran
a95d243909 nvethernet: Fix ethtool stats ops
Issue: Ethtool ops are registered during probe function and can
       be invoked by external modules at any time as long as driver
       is loaded. Certain ops functions read HW registers from the
       MAC controller during function execution. Reading HW stats
       is one such ops. However, when interface is down - HW is
       placed in reset. Trying to read HW registers results in CBB
       errors in this case. Also, the stats maintained in SW structs
       are not cleared upon interface down.
Fix:   Do not allow reading HW stats when interface is down in the
       ethtool ops callback functions. Clear the SW stats structs
       when interface is down. There is no need to explicitly
       clear the stats in probe as stats memory is already zero
       inititalized in probe.

Bug 2732055

Change-Id: I425b473819f170039ff63e6973ff29a0fe4a4e9c
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2221221
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Narayan Reddy
e93d5e1e55 nvethernet: read actual ptp clock index
Issue: currently always returning 0 as PTP clock index

Fix: Instead of hardcoding the ptp clock index to 0, read
actual index using ptp_clock_index.

Bug 2703848

Change-Id: Icff23ab516c4e16df02230a7dc7369e133bd7a5f
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2197387
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Bhadram Varka
58301a3ef2 nvethernet: Update comments with Doxygen style
replace kernel doc comments with Doxygen style comments

Bug 200512422

Change-Id: I1445cab3fb6708ddc21b4bfacebe213ed22f7aa2
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2180213
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Tested-by: Narayan Reddy <narayanr@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Narayan Reddy
481b69b58a nvethernet: add support for RIWT
This support enables the configuration of Receive Interrupt
Watchdog Timer register which indicates the watchdog timeout for
Receive Interrupt (RI) from the DMA.

Bug 200512422
Bug 2624476

Change-Id: I01bf170faa3c0f337d433eb19ebec49270483e18
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2139369
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
8c7d9510f2 nvethernet: support filter based dma routing API
Updated IOCTL path to not get impacted with new API
change. OSI call should be done with correct parameters
1) dma_routing_enable
2) dma_chan and
3) addr_mask (for L2 filtering) to support new IOCTL
4) src_dest (for L2 filtering) to support new IOCTL

Included logic for User priority based RxQ selection. We can have DT
entry "nvidia,rx_queue_prio" to configure this setting
i.e. for valid following Queue mapping

Priorities 6,3 to Queue 3
Priorities 4,5 to Queue 2
Priority 0 to Queue 1 and
Priority 1 to Queue 0.
setting will be nvidia,rx-queue-prio = <0x2 0x1 0x30 0x48>;

If static channel selection, i.e. RXQtoDMA set with value 0x03020100,
	Priorities 6,3 to Queue 3 to chan 3
	Priorities 4,5 to Queue 2 to chan 2
	Priority 0 to Queue 1 to chan 1 and
	Priority 1 to Queue 0 to chan 0
else if DCS(dma channel selection) enabled
	channel will be selected based on filter rules.

Included logic to take input from User On DCS enable or disable. User can
update dt entry "nvidia,dcs-enable", for dcs enable disable for all queue.
i.e nvidia,dcs-enable = <0x1> will enable DCS for all queue.

Bug 200525721

Change-Id: I4ba820f178b03424d01bb4ddd1f1d6eadde572f7
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2133196
GVS: Gerrit_Virtual_Submit
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
2f9ecd7d54 nvethernet: ethtool: add support for stats
These stats are read from MAC HW RMON counters as well as SW controlled
control from Core and DMA path.
ethtool -S <interface> is used to get statistics.
There are 3 stats
1) ether_mmc_counters: EQOS HW counters
2) ether_xtra_stat_counters: SW counters from osi/core
3) ether_xtra_dma_stat_counters: SW counters from osi/dma

Bug 200519211

Change-Id: I5b1b6592541c650f01e845667eca2f5c59bcfd08
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2113962
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Narayan Reddy
21dcef7b83 nvethernet: add PTP support
This takes care of implementing the PTP support
which includes PTP V1/V2 over IPV4,IPV6,Ethernet,gPTP.

Bug 200524751

Change-Id: Id647db1f60582717a09f24699841e00d7a582a1d
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2123439
GVS: Gerrit_Virtual_Submit
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Narayan Reddy
0426fc74e2 nvethernet: add pause frame support
Pause frame  is a flow control mechanism for
temporarily stopping the transmission of data on
Ethernet. The goal of this mechanism is to ensure
zero packet loss in case of network congestion.

Bug 200516459

Change-Id: I7b6373bfbb9572c4ac2635f1c4c91011f4244380
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111933
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Bhadram Varka
6e9c58de03 nvethernet: support for ethtool
Adds support for basic ethtool operations -
o get link propeties
o change speed/duplex

Bug 200512251

Change-Id: I1c754deff7c399db215f3803468c4c1513bf0988
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2080716
GVS: Gerrit_Virtual_Submit
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30