Commit Graph

75 Commits

Author SHA1 Message Date
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
Bhadram Varka
a921c9487b nvethernet: dump HW features through debugfs
cat /sys/kernel/debug/nvethernet-<interface>/hw_features to
dump the HW features

Bug 200563382

Change-Id: Ifd8eab0564123d1f588241fbadb739e6ef553114
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2338196
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: Rakesh Goyal <rgoyal@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Bibhay Ranjan
e42f49ee42 nvethernet: disable IVC support for Ethernet in K5.4
tegra-ivc driver is not enabled on kernel-5.4 hence
file "linux/tegra-ivc.h" is missing.This driver is
used by virtualization code.

Putting all the virtualization code within kernel
version check and disable it for kernel-5.4

Bug 200591808

Change-Id: I797062db172256e1ec14d22d00d73164513a9685
Signed-off-by: Bibhay Ranjan <bibhayr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2337400
Reviewed-by: automaticguardword <automaticguardword@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:08 +05:30
Bhadram Varka
c4a75f03ac nvethernet: Add support for VM interrupts
Adds VM interrupt handling for VM interrupt
based MAC controllers.

Need to pass below parameters from DT -
o Number of VM IRQ's assigned per OS/VM.
o Number of VM channels assigned to a VM IRQ.
o List of DMA channels assigned to a VM IRQ.

Below is the sample DT representation -

vm_irq_config: vm-irq-config {
	nvidia,num-vm-irqs = <4>;
	vm_irq1 {
		nvidia,num-vm-channels = <2>;
		nvidia,vm-channels = <0 1>;
	};
	vm_irq2 {
		nvidia,num-vm-channels = <2>;
		nvidia,vm-channels = <2 3>;
	};
	vm_irq3 {
		nvidia,num-vm-channels = <2>;
		nvidia,vm-channels = <4 5>;
	};
	vm_irq4 {
		nvidia,num-vm-channels = <2>;
		nvidia,vm-channels = <6 7>;
	};
};

ethernet@<base_addr> {
	[...]
	nvidia,vm-irq-config = <&vm_irq_config>;
	[...]
}

Bug 200548572

Change-Id: I802f247fa95ef6dcd769afbc7c13c6362d2f328e
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2292602
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bhadram Varka
3c81e255bd nvethernet: Don't enable clks/resets for EQOS VDK
EQOS clks/resets not enabled on VDK. Bypass clks and
resets for EQOS probe base on OSI Core flag.

Bug 200548572

Change-Id: I8d8400261ecf14ee782b3b1fff61b07cac20cb1b
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2292601
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
nannaiah
f48d979e44 nvethernet: Allow to set non zero DMA channel.
1. Add Flag which decides stats work queue is enabled(1) or
   disabled(0)
2. If virtualization is enabled then allow function driver instance
   to specify non zero DMA channel and to read stats flag from DT.

Bug 2694285

Change-Id: Ic97c079e66c117ed78f1b473ffda33173bd3f23c

Signed-off-by: Nagaraj annaiah <nannaiah@nvidia.com>
Change-Id: Ic97c079e66c117ed78f1b473ffda33173bd3f23c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2327179
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
nannaiah
4862fe2d5b nvethernet: Add IVC handling for Common interrupts
When ethernet virtualization exists the common interrupts
are served from ethernet server and server sends ivc messages
to host drivers to handle common interrupts.

Bug 2694285

Change-Id: I0af0c7f97b3f2d34f4adb72c114c3cfca6a623fc

Signed-off-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Change-Id: I8bb71c3704308f26ae97141ba1e8354da31fd70f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2317274
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@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
Bhadram Varka
69cf090fde nvethernet: check return code for set_speed
osi_set_speed will return error if there is no set_speed
callback defined or if something error happened while setting speed.

Bug 200565886

Change-Id: I9c74364d1a2e951059c3718c719314424b13c729
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2314494
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Mahesh Patil
35f2dceb54 Revert "nvethernet: Disable EEE feature"
This reverts commit 3b60e4e0d59bbd8d582a85d5e4c3459499c7ae33.

Bug 2813867
Bug 2850086

Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Change-Id: I2891c5db06b4269c1424d8c91e3b3c12129ec973
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2314315
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ajay Gupta <ajayg@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
Mohan Thadikamalla
b18ab27659 nvethernet: Remove backup_config checks
As the osi_core_private_data structure
backup_config variable got updated to
core_backup structure type remove this
variable NULL check.

Bug 200596517

Change-Id: I3911ef285eaa7af60f7d9e75b11b23d38773b06b
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2315796
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@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>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
narayanr
9980e3e524 nvethernet: enable GPSLCE
Enable Gaint Packet Size Limit Control when
MTU size is greater than 9000

Bug 200561709

Change-Id: Ied21e03e0cc5dddd9a2a8d47ffbaccd542937fb5
Signed-off-by: narayanr <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2303740
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Mahesh Patil
405a6ed9ed nvethernet: Disable EEE feature
Issue: Enabling EEE feature causing random SSH failures
       in GVS tests.
Fix: Disable EEE feature until root cause issue

Bug 2813867

Change-Id: I462cb7efbe7916a7591e8f0a2dca6ba1cbf9addc
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2294331
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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
Mohan Thadikamalla
dc9401798a nvethernet: Fix invalid MAC filter register count
Issue:
When HW configured for 32 MAC filters Addresses,
driver pdata->num_mac_addr_regs wrongly set to 1.

Fix:
Handle pdata->hw_feat.mac_addr16_sel check properly and set
pdata->num_mac_addr_regs value to 32.

Bug 200565909

Change-Id: I84a6f84b27fff6aaeee9a6636eca5b11f46ba994
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2290788
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@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
Srinivas Ramachandran
6fc9bd5147 nvethernet: Invoke API to backup/restore registers
Issue: During SOC suspend, the MAC is placed in reset.
       This causes all dynamic configurations done by
       SW on the MAC core registers is lost. When SOC
       resumes, MAC is initialized to power-on-default
       configuration, while other SW components still
       have previously set configuration. This results
       in mismatch between HW/SW configuration.
Fix:   Invoke APIs osi_save_registers(), osi_restore_registers()
       to backup and restore the MAC core configuration
       registers before suspend and after resume respectively.

Bug 200561046

Change-Id: I22183ba86fe9e7a7d8f9efb6a90c265182c5c68a
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2267402
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Srinivas Ramachandran
1573817944 nvethernet: Honor budget for processing tx completions
Issue: osi_process_tx_completions is run in the BH for
       processing Tx done irq. This function always loops
       till the Tx status for all packets that are Tx'd so
       far is processed.
       1) The NAPI budget for this Tx completions handler is
       not honored.
       2) The condition to invoke napi_complete() is incorrect.
       Currently, processed count should be 0, which can happen
       only if BH is scheduled to run and it finds no packets that
       have completed Tx. THis is a wasted schedule for the BH.
       3) netdev stats for Tx packets is incremented for every Tx
       descriptor instead of packet.

Fix: 1) Add budget parameter to osi_process_tx_completions() API.
     2) Change condition to invoke napi_complete() to avoid wasted
     scheduling of the napi handler.
     3) Increment the netdev stats only when skb is consumed ie.
     entire packet is transmitted).

Bug 2756439

Change-Id: I273bdb2667112b8d252b119dee5cc92055cb2913
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2237821
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Mahesh Patil
ece7ed224b nvethernet: Rename functions to match close functionality
Issue: rename functions to match close functionality

Fix:
 1) Renamed osi_poll_for_swr() to osi_poll_for_mac_reset_complete()

Bug 2715276

Change-Id: I939d9804350110b3d28c16ff511390ce5ab0c625
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2209755
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
narayanr
1559acd4db nvethernet: change the log level for IOCTL func
Currently for unsupported IOCTL numbers driver printing
the debug message at kernel error log level. Change the
log level from ERR to DEBUG.

Bug 200577089

Change-Id: I7c1580e50e49de6b61a3a1d76ddf946ba98ad74c
Signed-off-by: narayanr <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2270813
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
4901365614 nvethernet: fix hrtimer bug
Issue:
 1) hrtimer code is using index instead of
chan number (TX_NAPI[<index>] instead of TX_NAPI[chan])

Fix:
 1) update code to use channel number

Bug 200529168

Change-Id: I4a554ae3426910dd19b5d481957f41e32b6ff063
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2263933
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Mahesh Patil
5176ea0aa5 nvethernet: Harden while loops
Issue:
 Unsigned int variable in loop condition
 can be stuck forever if variable becomes uint_max-1
 for unknown reason

Fix:
 Add acceptable range condition check for loops

Bug 2715343

Change-Id: I0c29d77fd3c2c7e03e3ff3492acea00b94e3319e
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2244699
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Mahesh Patil
fa8c188668 nvethernet: Make promiscuous mode configurable
Make nvethernet promiscuous mode configurable in DT.
It can be enabled or disabled based DT for given platform

Bug 2715400

Change-Id: Ifa32ba8fa9108ad7b9a283b2f4f65c362601cdfc
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2261454
Reviewed-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Reviewed-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Tested-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
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
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
Mohan Thadikamalla
610e2b6a21 nvethernet: Fix continuous PHY interrupt on resume
Issue:
In suspend - PHY placed in reset with phy-reset GPIO.
With this, all register content will be gone.
After resume - PHY placed out of reset but
PHY registers will not be restored. With this change,
we are putting PHY in the proper state after resume.

Fix:
Add PHY config on resume call.

Bug 200545651

Change-Id: I138d951c42be0b00a1e22c2a45f0d58567f22df1
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2255706
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Narayan Reddy <narayanr@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
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
nannaiah
5e49592caf nvethernet: Read DMA Config Address from DT.
1) Add support to read DMA Address from DT entry.
2) Allow function driver instance to specify non-zero DMA
   channel as well.

Change-Id: I79421192013c8a417d74e4279146e4b6c7410c95

Bug 2694285

Signed-off-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Change-Id: I2c1c66f95d23556799e3561f81b018002fe2ad83
Reviewed-on: https://git-master.nvidia.com/r/2158927
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
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
Mohan Thadikamalla
ae038d9360 nvethernet: Enable slot function support
Issue:
Data packets sent via EQOS hardware are not
following any packet gaping. The AVB use-cases
have different timing requirements for class A
data packets. For example, the time difference
between two class A data packets are supposed
to be 125 microseconds for audio data
of frequency 48 kHz.

Fix:
Enable slot function support to schedule the data
fetching from the system memory by the DMA.
This feature is useful when the source AV data
needs to be transmitted at specific intervals.

Bug 200545374

Change-Id: I549014998380cd6c0d161c778bccdaa5ed017129
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2223850
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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
Srinivas Ramachandran
12328b2c5a nvethernet: Remove APIs that micro-manage HW
Issue: APIs like osi_clear_tx/rx_intr, osi_update_rx_tailptr
       are redundant. The operations that are done in these
       functions can be included as part of other existing
       OSD-OSI interface API. OSD need not micro-manage the
       hardware controller by using such fine grain APIs.
Fix:   Remove the redundant APIs and implement their functionality
       as part of existing APIs.

Bug 2715391

Change-Id: Ib2feee7b9080d3762ddd33f79f5410ef10a43a07
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2211092
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
Rakesh Goyal
2bf3b730d8 nvethernet: remove dev_set_rx_mode() from resume path
Issue: TOT build breaks if nvethernet driver build as loadable
kernel module. dev_set_rx_mode() API is not having EXPORT_SYMBOL
declaration.

Fix: remove calling dev_set_rx_mode() form resume path.

Bug 2715384

Change-Id: Iac0d0555c699d2bc13d61cc680f44e5ee6dc4d2d
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2231329
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
c45ba21f05 nvethernet: eqos: Use single API to enable/configure filter
Update OSI driver calls in ioctl path and set_rx_mode
to use single API

Bug 2715384

Change-Id: I521471060a31b985ea2f17a1e5ef91830820c285
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2216069
GVS: Gerrit_Virtual_Submit
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
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
Bhadram Varka
e217a1da45 nvethernet: don't poll for Software reset in probe
No need poll for SWR bit in DMA Basic Mode register
for reading RO only registers after reset.

Bug 2715328

Change-Id: Ib16c1d09386c00cdd98eadfb2fe6d9336d6de2b3
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2220296
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Srinivas Ramachandran <srinivasra@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
1c6a1e3f7b nvethernet: unregister HW timestamp source in close
Issue: ether_get_ptptime() is registered as a callback
       function to read ptp time using tegra_register_hwtime_source.
       But it is not unregistered before interface is brought down.
       This causes clients to still query for timestamp even though
       interface is down and MAC is in reset, resulting in CBB errors.
Fix:   Unregister the callback function in ether_close()

Bug 200556936

Change-Id: Idb5b698460f02101c931fd64fbdfc9c06949e05a
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2210705
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
05e0c8f037 driver: net: nvethernet: Re-order functions in ether_open()
Issue: In ether_open(), following issues are noted:
       1. ether_ptp_init() is called after starting MAC,
       which could cause some PTP packets to be missed.
       2. napi handlers are not enabled before requesting
       irq/starting MAC. This can cause issues if irq is
       raised immediately (if irq becomes shared in some
       platform) after it is requested.
       3. ether_request_irq() is called before DMA resources
       are initialized. This will also cause problem if irq
       is raised immediately.

Fix:   Move and re-order function invocations in ether_open()
       so that driver is ready to go (DMA resources allocated,
       napi handlers enabled etc.) by the time irq is requested/
       MAC is started for Rx/Tx.

Bug 2715330

Change-Id: I491251c8e749ccad2890ad0d113c87aaf3d87b42
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2211091
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-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
7bbf31a2a7 nvethernet: fix ndo_vlan_rx_kill_vid()
Issue: VLAN tag MAC register access after ether_close()

Fix: If netif is not running, return 0 from
ndo_vlan_rx_kill_vid and don't call OSI interface call.

Bug 200544722
Bug 200545674

Change-Id: Iecb4cb53e0e5cd3a544110b323b5e1c7b04ba1d5
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2204247
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
c080c796e2 nvethernet: remove spin locks and re-initialize private variable
Issue:
1) Spin locks are used for code path which is already serialized
by network stack
2) On interface down/up, MAC registers are getting reset and
re-initialized but private structure variables are not updated

Fix:
1) Remove spinlocks
2) Re-initialize private structure variables

Bug 200548252
Bug 200547544

Change-Id: Ifb0ce27ba96f8657eebde21e5d02d8b36fb1778b
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2189974
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
8708cf6e98 nvethernet: read ethernet hw counters periodically
HW MMC registers are 32 bits in size. Some of these will
overrun in few secs if there are live traffic at line rate.

Scheduling work queue to get periodic value from MMC
HW registers and update in 64 bits local variables, will
be solution to this HW limitation.

Bug 200544686

Change-Id: Ifc358f3f6b50839f7d9f48c2f98cb2cdd9ac0821
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2179298
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Narayan Reddy
78b4e7b720 nvethernet: enable vlan tag stripping
Enable VLAN tag stripping in HW.

Bug 200549370

Change-Id: Ib476fa0ca5e7bc4f7c903d8f38e9581975697121
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2192182
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
e97dbc8de1 nvethernet: allow PHY read/write if MAC clks enabled
Issue: During system suspend, PHY framework is trying to
access the PHY registers even though the ethernet interface
is not up which inturn causing the bus errors since MAC clocks
not enabled.

Fix: Add MAC clocks enable check before accessing the PHY
registers through MDIO bus.

Bug 200548320

Change-Id: Ic85ae82bbc7e7f33203cc94f8407bdfd23f75502
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2187285
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
9b7d91fdcb nvethernet: use __napi_schedule_irqoff
ether_tx_chan_isr() and ether_rx_chan_isr() run
from hard interrupt context.

Use napi_schedule_irqoff() instead of napi_schedule()

Bug 200542488

Change-Id: I2f6c8244ac8d0a84a57ba2c05bf512da0c7e3213
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2173462
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
e4f82ebb78 nvethernet: use maximum transmit buffer size
1) Removes the limitation of 4KB per descriptor.
2) Adds maximum transmit buffer size as 0x3FFF.
3) Changes descripors threshold considering TSO/GSO.

Bug 200542488

Change-Id: Ic32d5e1e49df48b0da057349f8300d029410d322
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2174519
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
9c4438324c nvethernet: Fix error in assign default priority
Issue: Due to missing "continue" in loop, default priority
is overwritten with wrong value.

Fix: Add "continue" in if loop to avoid overwriting.

Bug 200512422

Change-Id: Ice32f948bba58ea774d37e7508853a5c058b13ad
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2183011
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
Mohan Thadikamalla
e1fbd14f38 nvethernet: Register thermal device with DT
Update thermal cooling device register
with device tree node reference for proper
thermal zone bind.

Bug 200508665
Bug 1679250

Change-Id: I113be183fa7d655f74c1ffb40db8d6482b9f1dc9
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2169058
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Tested-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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
Narayan Reddy
da8bbea503 nvethernet: IOCTL and broadcasting MAC timestamp support
1) Register broadcasting MAC timestamp to clients so that
client can make use of the ptp callback for getting the
timestamp
2) Add private ioctl to read Timestamp information of
both HW PTP time and kernel time

Bug 200512422

Change-Id: I03509cc02f28571108a1061c739840c86f960af4
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2161172
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
ffde058071 nvethernet: Add driver suspend/resume support
Add the driver suspend/resume PM ops. These will ensure that
the MAC HW is de-init when tegra is suspended, and re-inited
when resume happens. WOLAN is not supported with this change.

Bug 2666797

Change-Id: Ibe47025fb5e4853885ea3b9ccffb49965e5e3e28
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2165029
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Tested-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Rakesh Goyal
a0ced14509 nvethernet: fix kernel_warning_test errors
Moving informative prints from dev_err to dev_info

Bug 200512422

Change-Id: I3e404f14c2ee0bc24fef3943c3bb402c33d492e2
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2162925
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
23da7763f3 nvethernet: fix race in enable/disable Tx/Rx interrupts
Change-Id: I5d2ba00662d965d742fea0c655dd2845b65f59b9
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2161941
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
65a4e04daf nvethernet: check return value form interface function
Issue:
1) OSI interface function return value are not validated
2) MTL Q and DMA channel 1:1 mapping check missing

Fix:
1) check for valid return value for such API before proceed
2) check for 1:1 mapping between MTLQs and DMA channels

Bug 200512422

Change-Id: Ib61e6099d2dcdd64cb40a58718b0552fc08efa8e
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2161185
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30