Commit Graph

87 Commits

Author SHA1 Message Date
Rakesh Goyal
118cdcebdc nvethernet: delete old skb for tx TS
Remove SKB for which HW timestamps are not present

Bug 3647934

Change-Id: Ib3a5ca6275f74425f4fe43a87ea6696823aedd96
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2716400
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Rakesh Goyal
d38959ba90 nvethernet: add spinlock around skb link list
Issue: In race condition node delete and addition
happen at same time, which leads to corruption of
list

Fix: add spinlock to protect critical section

Bug 3580369

Change-Id: Ief5495f049ed62d4e3832855a92eb066975eb672
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2699119
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@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
8d2e3a6161 nvethernet: fix MC filter corruption issue
Issue:
OSD Driver maintains a local MC address list to avoid the programming
old addresses again into HW when new MC address list passed from the
network stack.
Its observed MC address index for a specific address is different once a
MC address deleted from the list. Because of this new MC address which
is passed in new list is overwriting the old MC address.

Fix:
Program the entire list every time when network stack passes it instead
of maintaining local list at driver.

Bug 3609583

Change-Id: I97cb3ea4d35641ad156d16c54c89e8593ad64459
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2702851
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Om Prakash Singh
4ae758b99b nvethernet: add HSI support
1) Add threaded interrupt handler function to call EPL API
   to report error.

2) add hsi_enable sysfs interface to enable HSI feature at runtime
   to enable:
   echo enable > /sys/devices/platform/./nvethernet/hsi_enable
   to disable:
   echo disable > /sys/devices/platform/./nvethernet/hsi_enable

3) For mac RX CRC and checksum error, error reporting frequency is
   every one second for HSI_ERROR_THRESHOLD error count

4) Added DT property “nvidia,hsi_err_time_threshold” to specify time
   threshold for error reporting

5) Added DT property "nvidia,hsi_err_count_threshold" to specify
    error count threshold for error reporting

Bug 3543410
Change-Id: I73ef1a674a846295e02deff7e07954e8dada9792
Signed-off-by: Om Prakash Singh <omp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2675040
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: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Bhadram Varka
6479c24ff8 nvethernet: fix monitor clk enable/disable warnings
Issue: Adjust link from the phy subsystem can be called
multiple times either with link down or up. If its called
second time with same link down then code tries to disable
the same clks again which results in clock warinigs.

Fix: Maintain the state of the clk and then disable/enable
the clock based on the state.

Bug 3585098

Change-Id: I7d259e6066c7b67d0a970122eb0841e4b5871b43
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2688290
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
dbf00db6bb Add support for configure CBS through TC
Issue: New feature requirement to have
CBS configuration through TC

Fix: added support for same.

sudo tc qdisc add dev eth4 parent root handle 6666 mqprio \
        num_tc 3 \
        map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
        queues 1@0 1@1 2@2 \
        hw 0
sudo tc qdisc replace dev eth4 parent 6666:3 cbs \
        idleslope 2000000 sendslope -8000000 hicredit 3000 locredit -1200 \
        offload 1

Bug  200776994

Change-Id: Id83b967bcbbb18201f2757987ab1cefe63b4ad8d
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2649428
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
Mohan Thadikamalla
5a66fdbf00 nvethernet: Add SET_SPEED ioctl retry on failure
Issue:
When the ethernet server got enabled the boot time KPI
increased due to the XPCS lane up retry.

Fix:
Add work queue on OSD and retry SET_SPEED ioctl.

Bug 3414276

Change-Id: I0a3cc52db0ca4a34c4f5c1d9e7e3361023d0bd35
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2617507
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: Nagaraj Annaiah <nannaiah@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
Rakesh Goyal
594032b82a nvethernet: set affinity for common irq
Issue: when Softirq, vm and common interrupt
are scheduled on CPU0, due to priority inversion
of software IRQ, scheduling ISR corresponding to
HW interrupt got delayed.

Fix: set common IRQ affinity to other CPU core.

Bug 200780703

Change-Id: I56903de12fc753ac0075ace75ed72d34eac95c5d
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2610987
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
5f3e27f093 nvethernet: Use delayed workqueue for tx timestamp
Issue:
- Workqueue for Tx timestamp is running without
  delay, use many CPU cycle at hard isr thread
  priority.
- Incorrect return value from ether_handle_tso()

Fix:
- Update code to use delayed workqueue
- Return correct value

Bug 200780891
Bug 3400623

Change-Id: I2095a0634e079bf870ef87cd2de1d35fe24bafd4
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2610986
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
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
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
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
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
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
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
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
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
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
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
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
Bhadram Varka
ee63b13b24 nvethernet: add EQOS monitoring Rx clks
BPMP-FW exposes the following EQOS RX clocks:

o eqos_rx_input [external input clock from EQOS pad]
o eqos_rx [external input clock after RX clock gate]
o eqos_rx_m [monitoring clock: virtual clock that controls RX clock FMON]
o eqos_macsec_rx  [external input clock after RX MACSEC clock gate
  (separate gate from RX gate)]

To enable RX clock FMON -
o Issue clk_set_rate on EQOS_RX_INPUT
o Clk_enable for EQOS_RX_CLK and EQOS_RX_M

Bug 3286707

Change-Id: Ifa1482bcd82bec0f0c90693e99382b0a86409164
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2530476
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-11-01 14:27:08 +05:30
nannaiah
975e946c85 nvethernet: Add workqueue to set Rx mode.
Issue:
Network RTNL lock disables scheduler which causes IVC hang.

Fix:
- Add workqueue to set Rx mode.
- Change IVC spinlock to workqueue.
- Add virtualization check for macsec clk init.
- Add Read & Write Register.

Bug 2694285

Change-Id: I8354b500c62c0145eeed9a66bfcc8227fc8999e7
Signed-off-by: Nagaraj annaiah <nannaiah@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2520309
2022-11-01 14:27:08 +05:30
Bhadram Varka
a79b1f58c0 nvethernet: support for page pool
Add support for page pool and
enable it when CONFIG_PAGE_POOL
config got enabled.

Bug 200686236

Change-Id: I08efd68106182f65eac4e24b9f55baa22ce5968b
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2532360
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
2022-11-01 14:27:08 +05:30
Rakesh Goyal
7f9b76c903 nvethernet: read MAC address from DT for new platform
Read index from ethernet DT node to index for MAC
address.

Bug 200724410

Change-Id: I714e73a500b3ce6d7b7a5e31cf48f8d4e239e9cc
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2531839
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
719d5641dd nvethernet: add support for MGBE/XPCS clocks
Bug 3288030

Change-Id: I78c88d86ff99010b3656c62f1074df30c068db66
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2529193
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
ae45ba80a8 nvethernet: add support for XPCS reset
Bug 3288030

Change-Id: I5e08c266befec52094c508719bff8e8d8e8ef696
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2522194
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
2022-11-01 14:27:08 +05:30
rakesh goyal
3479a84bc7 nvethernet: remove void pointers input arguments
removed void pointers function arguments for osd dma
callbacks

Bug 2739123

Change-Id: I8430d99c1528a7705d8016e2bfa15a027e82d515
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2514923
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
2022-11-01 14:27:08 +05:30
Rakesh Goyal
01d2b3fe51 nvethernet: L2 filter index handling at OSD layer
Linux OSD code maintaining link list to identify L2
filter added/removed in compare to earlier list.
By doing this OSD sends address and dma channel which
should to be removed from hardware instead of full
list every time.

Bug 200711542
Bug 200711544
Bug 200713215

Change-Id: I95d4dc687c5fd45a6e0bbc3c097e59b90b03b0e5
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2519592
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
2022-11-01 14:27:08 +05:30
Rakesh Goyal
32ed166339 nvethernet: use L2 filter command to set MAC address
Issue:
1) Missing support for packet MC/BC packet duplication
2) Remove MAC UC and BC address on ether_close()

Fix:
1) Update OSI_CMD_L2_FILTER structure parameter to support
new algorithm.
2) MAC UC and BC address added to filter from ether_open()
and ether_resume() function.
3) Configure MAC register to support MC/BC packet
duplication

Bug 200711542
Bug 200711544
Bug 200713215

Change-Id: Ie589892de121e5873f5dfa9b9db9bf5c441ece71
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2519591
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
2022-11-01 14:27:08 +05:30
nannaiah
ca2466ab09 nvethernet: Add fix to support virtualization.
1. Disable Power Ungate if virtualization is
   enabled.
2. Remove use_stats flag.

Bug 2694285

Signed-off-by: Nagaraj annaiah <nannaiah@nvidia.com>

Change-Id: I76b22ae0459760558b6e2dccc181615d545b629d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2513958
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Tested-by: Nagaraj Annaiah <nannaiah@nvidia.com>
2022-11-01 14:27:08 +05:30
Srinivas Ramachandran
805fe9c4fa nvethernet: Add support for MACsec controller
This commit adds the driver interface for the
MACsec controller. The driver interface is
invoked using generic netlink messages from
userspace MACsec key agreement agent.

Currently sysfs node is added to check the irq
stats for default macsec controller operation.

Bug 2913560

Change-Id: I07b0b778ba1c6674e87b103a3e68e158fea61c2c
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
2022-11-01 14:27:08 +05:30
Mohan Thadikamalla
9f70a55384 nvethernet: Add Multiple DMA channels route
- Add a new DT node to enable Multiple DMA routing
for netdev MC MAC ddress. Read the DT value
and store it into OSI core private data.
- Add new driver private IOCTL for MC DMA channels
selection as inputs and call ether_set_rx_mode
to update MAC filters with given DMA channels route.

Bug 200565911

Change-Id: I1e65322489e34c4b6318a769dac963073d4887ad
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
2022-11-01 14:27:08 +05:30
Bhadram Varka
29fb064269 nvethernet: add support for MGBE
Adds support for MGBE based on MAC controller version.
Also integrated MGBE files to Linux build system

Bug 200548572

Change-Id: I1c5a63cb3b843daa60500254e1272449cc2e8e49
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2252647
2022-11-01 14:27:08 +05:30
nannaiah
8c8eceeeb7 nvethernet: Add IVC fix
Issue: rt_spinlock causes IVC failures.

Fix:
1. Change rt_spinlock to spinlock.
2. Add timeout to ivc_can_read.

Bug 2694285

Change-Id: Ib603c304e750a33262e8509ed3f869030b934958
Signed-off-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2497217
Tested-by: mobile promotions <svcmobile_promotions@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
nannaiah
e411787070 nvethernet: Enable IVC for kernel 5.10
Bug 2694285

Change-Id: I80a66c86f9cb4974454b41dfde3707ab36e15c24
Signed-off-by: Nagaraj annaiah <nannaiah@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2495280
Reviewed-by: Rakesh Goyal <rgoyal@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
rakesh goyal
9f61b817f7 nvethernet: use raw_spin_lock_* for RT kernel
Issue:	raw_spin_lock* should be used with RT kernel
Fix:	update code to use raw_spin_lock* APIs instead of
	spin_lock*

Bug 200671160

Change-Id: I5a1d187d2ead6394d97bbdcb41533852b4708afe
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2493350
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
b427be9267 nvethernet: assign OSD ops
Bug 200620687

Change-Id: I9e0b9b87ba425b446b60576a1ddae938ff514a2f
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2483069
Reviewed-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@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
nannaiah
ca57e74aea nvethernet: Add OSD IVC support
In case of virtualization the OSI functions will be handled
at Ethernet Server. Add IVC support where OSD can send
IVC packets to ethernet server. Ethernet Server parses the
messages and calls the corresponding OSI API.

Bug 2694285

Change-Id: I0f8a23d33fe3fc87e2582101a6bef6f911e1226d
Signed-off-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2439193
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@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
narayanr
958ea205da nvethernet: remove setting of dma_mask
Issue: Seeing MC errors when setting the DMA mask to 40bit.

Fix: Maximum system mask which can be set on tegra is 39bit
and is enabled by default for all clients. So removing the
setting of DMA mask so that the default value can be used

Bug 200681386

Change-Id: I4820a64c011d92bde2947969fdfa535b692c37ab
Signed-off-by: narayanr <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2454950
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Rakesh Goyal <rgoyal@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
3ff1678205 nvethernet: fix Rx DMA suspend issue
Issue:  DMA will be in suspend state if there is no rx buffer allocation
        happen to HW. If DMA is in suspend state, no interrupt will
        occur for channel which leads to not calling of
	osd_receive_packet().

Fix:    Whenever there is rx buffer kernel memory allocation failure,
	desc will be updated with reserve buffer. This reserved RX buffer
	is already allocated at the time of eqos_open. Aim of same to
	make sure rx DMA always have buffer and not go in suspend state.

Bug 200650229

Change-Id: Ic18d9f8f03c69c142d91288a1a7288d26e1c8b42
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2399011
Reviewed-by: Bhadram Varka <vbhadram@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
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
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
rakesh goyal
c6b2d05d26 nvethernet: dump all registers
Dump all valid ethernet IP registers

Bug 200563382

Change-Id: I34ce3c1dc5c2c4e12040d2d349e2ad63ec8bca8b
Signed-off-by: rakesh goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2338198
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@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