Commit Graph

227 Commits

Author SHA1 Message Date
Bhadram Varka
a91720a4d7 nvethernet: remove MGBE MDIO/MDC pad programming
Remove PAD programming for MGBE MDIO and MDC
PADs and apply pinctrl state if pinctrl present
inside DT.

Bug 200759606

Change-Id: Ib7f41532687dea2935c619e2335a2afd2c3ff8d6
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2593806
Reviewed-by: svcacv <svcacv@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>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Rakesh Goyal
260d005cc1 nvethernet: schedule TX timestamp workqueue
Issue: With TSN + PTP test cases, PTP packets
shaped based on TSN GCL which may lead to not
having time stamp when asked.

Fix: in case of failure to get timestamp,
schedule workqueue again to try to get timestamp.

Bug 200777069

Change-Id: Ic557f6ba7df5147ce85b21278f053e07a984f410
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2599845
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
44b74a383b nvethernet: Don't stop PHY RXC in LPI
Issue:
To save more power PHY RXC will be disabled when PHY in LPI state by
setting 10th bit in below register. This is standard PHY register.
- PCS Control 1 register (MMD device 3, Address 0x00)

When EEE enabled above register being programmed (10th bit got set) and
it created issue while accessing the MAC registers through indirect
addressing since RXC stopped from PHY.

Fix:
Don't stop RXC in LPI for Orin EQOS

Bug 200776300
Bug 200765092

Change-Id: I4150eebe8e2a5ab79ad5b7180232adad2331e315
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2599137
Reviewed-by: svc_kernel_abi <svc_kernel_abi@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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Rakesh Goyal
40c8f17f0f nvethernet: ioctl to support TSC-PTP time capture
Add driver private IOCTL support to capture and
return capture timestamps to userspace.

Bug 200736396

Change-Id: I012f318ca16ab56f295b427846a74379d8d3ccec
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2554285
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: Srinivas Ramachandran <srinivasra@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
Sanath Kumar Gampa
ee3b01231e nvethernet: MACSEC send InstanceID to supplicant
Issue: If MGBE0 is not up and if we try to run supplicant
on MGBE1/2/3 then we would see a crash as we were accessing
the TZ space allocated to MGBE0 which is not up yet

Fix: Sending the Instance ID to supplicant so that supplicant
will access the TZ space corresponding to the MGBE
interface which is up

Bug 200765688

Change-Id: I42893d6142f7b8495a06e31d88a920353114e141
Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2593897
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
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: 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
Bhadram Varka
06eca7dba3 nvethernet: Enable UDP L4 USO
UDP L4 USO support present for kernel-5.10 onwards.
So updating driver to make use UDP L4 USO flag
to make use of USO feature from kernel.

Ethtool can be used to enable/disable USO -
o sudo ethtool -K eth0 tx-udp-segmentation on/off

Bug 3106903

Change-Id: I0767a7bee1de047149c058b9582c4a00b72ea8fd
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2479782
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
75aada80c2 nvethernet: set frame length for non TSO packet
Issue:
- TX packet fragments are not working
on Orin platform.
- Express packets pass through even time
interval is not sufficient to send packet

Fix:
- Set OSI_PKT_CX_LEN and tx_pkt_cx->payload_len
for non TSO packet. this will update frame
length in TDECS3

Bug 200765943
Bug 200763256

Change-Id: I82cc91e176d9ac84d654ef7f60686ebc4024d3da
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2592048
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Sanath Kumar Gampa
faf4382eb4 nvethernet: macsec secure and n_secure irq freeing
Issue: Observed a Kernel warning if we make enable
MACSEC using sysfs once and disable twice

Fix: Avoid freeing if macsec IRQ is already freed

Bug 200772596

Change-Id: I9e2a018da7b0b6bcef79af895de2dbd04859aa55
Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2593896
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
nannaiah
ceb7893c0e nvethernet: Don't enable clocks for virtualization.
Incase of ethernet virtualization, ethernet server enables
clock so don't enable clocks from VM.

Bug 2694285

Change-Id: I6c191908599ef86f632a2801d1e7d3e06cb03c4f
Signed-off-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2587837
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
6c979ebdd5 nvethernet: Get HV window base from DT
Issue: SID needs to be programmed through HV window
to get it reflected in controller register space.
Currently its programmed through RM window.

Fix: Get HV window base address from DT and program
in controller registers in non-hypervisor mode.
Store MAC instance ID to program the same ASID
values which are used in DT.

Bug 200761024

Change-Id: Ie9bcaebcba39f2d07438c9502591c0f51f22378f
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2592481
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
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
Rakesh Goyal
78035314d0 nvethernet: define default PTP RxQ
Issue: PTP packets are received on RxQ0, with legacy
       perf data, which cause PTP getting delayed.

Fix:   If DT entry not present, use ETHER_DEFAULT_PTP_QUEUE

Bug 200766950

Change-Id: I25054caf23ffec37fcb422a7aa705b122da96394
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2588641
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@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
Bhadram Varka
eee46a197b nvethernet: get interface name from DT
Bug 200763996

Change-Id: I7a6636eeace9aff162763aa8260d9d1eda3a9216
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2587523
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Mohan Thadikamalla
2a68302c12 nvethernet: Fix crash on VLAN filter update
Issue:
Observed crash during the VLAN filter
when the interface is down.

Fix:
Don’t update the VLAN filter if the
interface is not running.

Bug 200765532

Change-Id: I3dc87fd856b2389aabc9552685103c5bc60fdacf
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2583630
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
d93210ee62 nvethernet: Fix IRQ names in multi interface case
Issue: IRQ names not correct when multiple interfaces
probed with nvethernet driver because of static array.

Fix: Move irq names array inside private data structure
so that every interface will have unique name.

Bug 200762612

Change-Id: I9d55b62c345c458fa65e2ad4612ba55473e34752
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2588659
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@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
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
Narayan Reddy
36d784d40e nvethernet: update speed and mode in fixed link
Issue: in caseof interface down and up the speed
and mode values are incorrect incase of fixed link

Fix: In case of fixed link restore speed and mode
values based on the iface mode

Bug 3359851
Bug 200765222

Change-Id: Iacd1cb2212c0783bb5e361205cbf62f64b197325
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2584629
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
f415855538 Revert "nvethernet: Get HV window base from DT"
This reverts commit baa960f28b63b1e6b82f84e27d09d508629b3cb2.

Reason for revert: Created regression for AV + L

Bug 3358505
Bug 200761024

Change-Id: I184be44bd3aa9723c640cf3089c10dfd0a6a9772
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2584381
Reviewed-by: svcacv <svcacv@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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Srinivas Ramachandran
3842c2bc78 nvethernet: Restrict > 9K jumbo only in eqos
Issue: MGBE supports upto 16K jumbo size.
       There is enough MTL queue space also
       for 16K packet even with all 10 queues
       enabled in MGBE. So no need to restrict
       > 9k jumbo to single channel config only.
FIx:   For MGBE, unconditionally allow upto 16K
       jumbo size setting.

Bug 200760072

Change-Id: I734ce3be13605e4db992a1679e2de0736bd2583f
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2579108
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
76fe45ab4f nvethernet: Get HV window base from DT
Issue: SID needs to be programmed through HV window
to get it reflected in controller register space.
Currently its programmed through RM window.

Fix: Get HV window base address from DT.

Bug 3358505
Bug 200761024

Change-Id: Ia878e1d4e7f81e4c6531de00b87a1804238dde9e
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2582063
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@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
Rakesh Goyal
6af51eded8 nvethernet: fix use of "in_use" flag
Issue: When osd_transmit_complete() call
       ether_get_free_tx_ts_node() to get next
       free index, it returns always 0 as
       in_use flag was not set for already used
       node.

Fix: Set in_use flag to maintain list of nodes
     and avoid overwrite.

Bug 200762771

Change-Id: I8acd3f3495476c9e5d7ecf60494b62106948ca50
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2581550
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: Mohan Thadikamalla <mohant@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>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Sahil Mukund Patki
9cb082dc22 nvethernet: Fix debugfs compilation error
Fix compilation errors in nvethernet seen when disabling
CONFIG_DEBUG_FS

Bug 200755555

Change-Id: Ib0d0fbc7502467109e1dbed6ffd03c0224e9d4aa
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2569761
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@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
Bhadram Varka
27a4b4591a nvethernet: Bringup fixes aggregated
1. Program padctrl registers direclty from driver
2. Disable RSS
3. Skip mac reset based on DT flag on auto platforms

Bug 200760072

Change-Id: Ie1ea86fdec8561d9ffd6479afc4aeec81deb1ea3
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2573001
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Tested-by: Narayan Reddy <narayanr@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Srinivas Ramachandran
277273634c nvethernet: Use Tx divider clk ID and fix crash
o Use newly added clk divider for eqos v5_30
o Fix crash while getting the MAC address, do not register interface
  if MAC address is not found/invalid.
o Make driver probe as late init
o Do not return error for missing optional clks

Bug 200760072

Change-Id: Ib4d9454c923b062cb25f9b2ebe20adc7c24df7de
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2572676
Tested-by: Narayan Reddy <narayanr@nvidia.com>
Tested-by: Ashish Mhetre <amhetre@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@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
Narayan Reddy
48e0d60b07 nvethernet: PHY register read/write for fixed-link case
ethernet@<address> {
    nvidia,mdio_address = <PHY MDIO bus address>;

    fixed-link {
	speed = <1000>;
	full-duplex;
    };
};

1. Added nvidia DT property (nvidia,mdio_address) for passing
   the PHY MDIO bus address.
2. If this property present in DT then driver calls PHY MDIO
   read/write functions directly instead of going through PHY subsystem.
3. If this property is not present – then driver PHY mdio
   read/write goes through PHY subsystem.

Bug 200733774

Change-Id: Ib3a533bd73910f5c95ed0884be28820adf729726
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2567762
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@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
Sushil Singh
a955fa087a nvethernet:k5.10 Fix probe defer warning prints
Issue
- Driver probe defer causes failed prints on kernel boot logs
  if clk/reset controller driver module is not initialized
  before nvethernet module probe.

Fix
- The probe defer is part of kernel mechanism to retry module
  initialization and hardware setup. This is not an error
  or failure for software driver.
  Only in case of probe failure, throw error logs in console

Bug 200728771
Bug 200732811

Change-Id: I9c421db6ceedc108553f9f2b33f4f3993d63c02f
Signed-off-by: Sushil Singh <sushilkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2563340
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Narayan Reddy
451275bea6 nvethernet: remove ifr_data NULL pointer check
ifr_data pointer value used to carry mii_ioctl_data from
user space to kernel space. When all values are zero it
reflects the pointer value as zero and ifr_data NULL pointer
check will result in failure.

Driver should not check since ifr_data pointer value itself
represent mii_ioctl_data. So removing the NULL check for ifr_data.

Bug 200733774

Change-Id: Ibf405fe22c3e2e694e08eac598e9431066703c3c
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2564428
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@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
Bhadram Varka
41429e6df9 nvethernet: Support of NVGRO for NVUSO segments
Algorithm:
- There is one master queue and one final queue to maintain the
packets.
- Final queue will start when a packet received with TTL=1
- TTL = 2 and 3 packets will be queued into final if those are in
sequence else those will be queued to master queue.
- When packet received with TTL = 2 then only merge process will start
- For every valid final queue merge starts by looking at the IPID
in master queue in increment order. This loop continues until
TTL = 2 found in master queue.
- Once TTL = 2 found then entire final queue will be given GRO
layer in sequential order.

Bug 3106903

Change-Id: I6cc08f3faae67a04813d32d59f7cce02f06dccbf
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2554423
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
583db7360a nvethernet: add OSI core debugging
Dumps the registers and structures into kernel log

Bug 200737108

Change-Id: I88d63b5e46466ce036201350e2ca31cc4a2b39df
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2558998
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
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:08 +05:30
Bhadram Varka
2c6aad7764 nvethernet: Update MGBE MAC version
On uFPGA MGBE MAC version is 0x31 and it got updated
to 0x40 on silicon.

Bug 200751806

Change-Id: If07f9bf338d522f5efc8823323db522dd3438daa
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2559465
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Narayan Reddy
56063f5983 nvethernet: add PHY read/write support
Add a private ioctl for phy register read
and write. This support is needed for accessing
the PHY registers from user space when fixed link
is enabled in SW even though PHY is directly connected
to MAC.

Bug 200733774

Change-Id: Ifd9b5dc7764363d897605c2370da419a863ddea4
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2554892
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
3f0e18c74d nvethernet: tctool support for EST and FPE
Add support for ndo_setup_tc in network
device operations for kernel 5.10 or above.

Bug 200622871

Change-Id: Id5f96001be3b00925d26efaca1b39e26b959e952
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2550396
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
300cffe2bc nvethernet: Fix multi-os test regression
Reduce MTU size to include macsec SECTAG if macsec
supported

Bug 200730979

Change-Id: I7db505c2ef1c6a866ebbec285a647ec9c346727f
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2549562
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:08 +05:30
Narayan Reddy
9fd74bdf26 nvethernet: add reading of PHY delays from DT
PHY delays varies from PHY to PHY, so pass
these values from platform DT and read the
same

Bug 200733771

Change-Id: I720dc1ccd42f0f8bcbe23aeb5100b03948cbd3a1
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2556626
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
0ca9eae1b0 nvethernet: add MGBE monitoring Rx clks
BPMP-FW exposes the following MGBE RX clocks:
o mgbe0_rx_input [external input clk recovered from GBE UPHY lane]
o mgbe0_rx_input_m [monitoring clk: virtual clk controls RX clk FMON]
o mgbe0_rx_pcs_input [external input clk recovered from GBE UPHY lane]
o mgbe0_rx_pcs [mux between mgbe0_rx_pcs_input and mgbe0_tx_pcs]
o mgbe0_rx_pcs_m [monitoring clk: virtual clk controls RX PCS clk FMON]

To enable RX clock FMON -
o Issue clk_set_rate on MGBE_RX_INPUT and MGBE_RX_PCS_INPUT based
on UPHY GBE mode.
o Clk_enable already available on ToT for RX_INPUT_M
and RX_PCS_INPUT_M.

Bug 3288030

Change-Id: Ia71ccc9f21a5e79fecf149efae9032db25af60d8
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2544758
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: svcacv <svcacv@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
Mahesh Patil
b02ba38d38 nvethernet: address review comments
- Remove debug code under TEST macro
- Remove macsec CLK/RST hard code WAR's
- Update macsec OSI macro's as per latest OSI_ prefix

Bug 3264523

Change-Id: I8674e953e0faf49125e2326bdeb4b5bdc323a26c
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2548474
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
f972af3192 nvethernet: Add debug capabilities
- Dumps the descriptor dump to kernel trace buffer.
- Enable/Disable descriptor dump through sysfs.
- Dumps the register/structure dump to kernel log.

Bug 200737108

Change-Id: Ica30a881adcbd7c86771a6b441b6ffcbf813ac17
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2556684
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@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
Mahesh Patil
4318bd4ebb nvethernet: pad calibration
Issue:
   1. Current pad calibration does not check for RGMII/MDIO
      interfaces idle
Fix:
  1. Make sure RGMII and MDIO interface are idle before
     doing pad calibration as per spec

Bug 2831220

Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Change-Id: Ie4a7fadb2f2851c0d3eb62c1cd05f8e16d529931
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2321644
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
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
Mahesh Patil
b2213096ea nvethernet: Remove thermal pad calibration
Remove thermal pad calibration for EQOS. It is no more required
as per latest HW team recommendation

Bug 3332089

Change-Id: I26ca02a5bc1f9eac34bc1415a2eb477f37fc8fd0
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2549598
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
c1cd386acd nvethernet: Handle error conditions in macsec
1. Track MAC state and return error if MAC is down
2. Protect ref_count read with mutex to avoid race condition
3. free macsec priv memory on rmmod

Bug 3309824

Change-Id: Ia6f1cee0399c294b603b10a3ce8a3407060578d3
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2548464
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@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
Mahesh Patil
2811efc501 nvethernet: Add DT macsec instance id
Added macsec's intance id which will be used by TZ

Bug 3324237

Change-Id: I6f7daf4e0947cac55ff161c44d628514de0a2e13
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2548469
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: Ajay Gupta <ajayg@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
e584bbd262 nvetherenet: add different XFI/USXGMII modes
This change takes care of configuring different
connection speeds of XFI/USXGMII modes

Bug 200718307

Change-Id: Ic90297d310e6d84929f9b12edba50962fd848107
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2550412
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
f6570e4010 nvethernet: Add support for 2 step timestamp read
- On transmit complete callback
-- If OSI_TXDONE_CX_TS_DELAY flag is set in Tx done
   flag, store buffer pointer along with pkt Id
   in its internal array/list

- On Common interrupt:
-- Call osi to handle common interrupt.

- On trasmit complete interrupt:
-- Parse through internal array/list for pending TS
   to read, by issuing OSI_CMD_GET_TS ioctl for pkt_id.
   Loop until list is cleared or error is received.
-- On interface up
   Remove old timestamp of channels initialized.

Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Change-Id: I5104277de66dd240023f921fa5f7b4fcc035f74d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2535962
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@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>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bhadram Varka
232d3615da nvethernet: runtime power gating/ungating for MGBE
Adds support for runtime power gating/ungating
for MGBE through Linux PM runtime API's.

It requires power-domains DT entry to be part
of ethernet DT node.

Bug 200740290

Change-Id: I95727e8cbb5615d01603f4bb456253f05ff32d42
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2548337
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bhadram Varka
537d6aa16b nvethernet: Set MGBE TX, TX_PCS and MAC_DIV clks
There are three clks for MGBE which needs to be set based
on UPHY GBE mode and PHY line rate.

o MGBE_MAC_DIV_CLK will be set based on PHY line rate
o MGBE_MAC_TX/TX_PCS clks will be set based on UPHY GBE mode

Below are the settings -

UPHY GBE mode = 10G:
===================
Possible MAC working rates: 10G/5G/2.5G
1) MAC DIVISOR: 312.5MHz, 312.5/2MHZ and 312.5/4MHz
2) TX CLK: 644.5MHZ
3) TX PCS_CLK: 156.5MHz

UPHY GBE mode = 5G:
==================
Possible MAC working rates: 5G/2.5G
1) MAC DIVISOR: 312.5/2MHz and 312.5/4MHz
2) TX CLK: 322.2MHZ
3) TX PCS_CLK: 78.125MHz

Bug 200739493

Change-Id: Ie6b21f87d2077b8be621a32b2034b4eff1eb391e
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2541313
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Rakesh Goyal
8553696ea7 nvethernet: use real-time API to get current time
Issue: PTP configuration API is using monolithic
time API.

Fix: Use real-time API to get correct system time.

Bug 200666019

Change-Id: Ie6a8fd819a70f3c257ce214fae937356840a5421
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2533453
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bhadram Varka
1d49d66c4f nvethernet: Read XPCS/UPHY GBE properties for MGBE
Read below properties only for MGBE driver probe -
o xpcs-base
o UPHY GBE mode.
o xpcs_rst

Bug 200739336

Change-Id: Ief83b091e53425fbf6e5250af4ec7afa646de6ea
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2540495
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Mohan Thadikamalla <mohant@nvidia.com>
2022-11-01 14:27:08 +05:30
nannaiah
0003b0bf62 Add virtualization check to configure CAR.
In case of virtualization, server does the CAR configuration
so SKIP the parse and configuring the CAR.

Bug 2694285

Change-Id: I5c9e5d180f2cd88ca0a55b3259f0d25ce8156a13
Signed-off-by: Nagaraj annaiah <nannaiah@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2536560
2022-11-01 14:27:08 +05:30