Commit Graph

261 Commits

Author SHA1 Message Date
Mahesh Patil
2a77d85ced nvethernet: Remove Rx channel0 WAR fix
MGBE NET07 bit file fixes Rx Channel 0 data
tranfer not working issue. Removing WAR fix

Ported from -
https://git-master.nvidia.com/r/c/nvethernet-docs/+/2972125

Bug 4182455

Change-Id: I0774dc47eee15246989dfbd8c09f0bc001b2a15c
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
2024-06-07 13:10:54 +00:00
Mahesh Patil
5edac49a28 nvethernet: T264 Enable 20 VDMA channel support
Ported from -
https://git-master.nvidia.com/r/c/nvethernet-docs/+/2940794

Bug 4043836

Change-Id: I763bfdaa78082de035219e10ef1c131bdbba5e35
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
2024-06-07 13:10:54 +00:00
Rakesh Goyal
2a104ca84d nvethernet: T264 VDMA feature and initial bring up
Bug 4043836

Ported from the change -
https://git-master.nvidia.com/r/c/nvethernet-docs/+/2896006

Change-Id: I844112cc71e387f6ae04c2cc7f64b71abb4283fd
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3149289
Tested-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: Michael Hsu <mhsu@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Tested-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-06-05 02:51:08 -07:00
Srinivas Ramachandran
70999e5756 nvethernet: Enable Rx csum offload only for EQOS
Issue: Rx csum offload can be safely enabled
       for EQOS as there is reliable HW sequence to
       ensure data validity when processing descriptors
       which are SW owned.
Fix:   Enable Rxcsum for eqos.

Bug 4486046

Change-Id: Ic3ef7317cfc9d22c0756afc6dfc9f98ce6743977
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3126197
(cherry picked from commit 7e908f2f0bce0650b21c64fddb31401f190c26df)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3146940
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Tested-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
Reviewed-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: Amlan Kundu <akundu@nvidia.com>
2024-05-31 02:18:48 -07:00
Hareesh
53fafd9cd9 nvethernet: eqos: suppress set speed failed spew
- Suppressed set speed failed print for eqos as print
  is added in ethernet server.

Bug 4382126

Change-Id: Iaf58b6fcb66ba74185d3098a0954fb12cb915fb3
Signed-off-by: Hareesh <hkesireddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3086295
(cherry picked from commit 3a48e73a8bb74cadb5f711f62880526101a3f56e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3132851
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-15 14:15:24 -07:00
Paritosh Dixit
f451b88fd7 net: nvethernet: Fix build for Linux v6.9
In Linux v6.9-rc1, the typedef of skb_frag_t is updated to a new struct
skb_frag. Struct skb_frag does not include bv_offset and bv_page
members. Hence, use functions skb_frag_off and skb_frag_page to get
offset and page respectively. Use of functions skb_frag_off and
skb_frag_page is backward compatible with older kernel versions that
we use.

Bug 4471899

Signed-off-by: Paritosh Dixit <paritoshd@nvidia.com>
Change-Id: I5d14c750c5b4cd28a2abeda95d7c11bf975ef1b8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3104114
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2024-04-02 13:19:24 -07:00
Aniruddha Paul
615ba15a30 nvethernet: Create pool per Rx DMA channel
Existing implementation uses a single page_pool
for all Rx DMA channels. As by default all irqs
are on CPU 0, this does not cause any issue.
Routing an irq to some other CPU causes race
conditon for page allocation from page_pool which
leads to random memory corruption.

[  158.416637] Call trace:
[  158.416644]  arm_lpae_map_pages+0xb4/0x1e0
[  158.416649]  arm_smmu_map_pages+0x8c/0x160
[  158.416661]  __iommu_map+0xf8/0x2b0
[  158.416677]  iommu_map_atomic+0x58/0xb0
[  158.416683]  __iommu_dma_map+0xac/0x150
[  158.416687]  iommu_dma_map_page+0xf4/0x220
[  158.416690]  dma_map_page_attrs+0x1e8/0x260
[  158.416727]  page_pool_dma_map+0x48/0xd0
[  158.416750]  __page_pool_alloc_pages_slow+0xc4/0x390
[  158.416757]  page_pool_alloc_pages+0x64/0x90
[  158.416762]  ether_padctrl_mii_rx_pins+0x164/0x9d0 [nvethernet]
[  158.416807]  ether_padctrl_mii_rx_pins+0x478/0x9d0 [nvethernet]
[  158.416822]  osi_process_rx_completions+0x284/0x4d0 [nvethernet]
[  158.416832]  0xffffa26218b8f71c
[  158.416855]  __napi_poll+0x48/0x230
[  158.416871]  net_rx_action+0xf4/0x290
[  158.416875]  __do_softirq+0x130/0x3e8
[  158.416889]  __irq_exit_rcu+0xe8/0x110

This change creates a page_pool per Rx DMA channel.
This ensures there is no race conditon for page
alloc/dealloc from each DMA napi context.

Bug 4541158

Change-Id: I12668ee7d824fd30d54a874bbbdf190d02943478
Signed-off-by: Aniruddha Paul <anpaul@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3091494
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
2024-03-17 09:33:32 -07:00
Jon Hunter
c534c789b3 net: nvethernet: Prevent VM interrupts being balanced
If the userspace service 'irqbalance' is installed then the nvethernet
driver crashes when there is network activity. To avoid this crash set
the IRQF_NOBALANCING flash for the VM interrupts. No performance
degradation is observed when running iperf3 with a 1Gbps link.

Long-term the nvethernet driver still needs to be fixed to allow IRQ
balancing.

Bug 4293378
Bug 4541158

Change-Id: I0aa4ee28e36c7d273f14ff043544e72d3e988bd3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3087525
(cherry picked from commit f9ed570c2b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3088936
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-05 16:31:43 -08:00
Bhadram Varka
bec1d86778 nvethernet: fix build issues with safety
Bug 4506095

Change-Id: Ia24590ab716d7f879ca5394b7a5512db072c4fdd
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3083506
Reviewed-by: Narayana Reddy P <narayanr@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-28 11:20:45 -08:00
Sanath Kumar Gampa
725b8aacf1 linux:nvidia: macsec sysfs nodes only if enabled
Issue: Accessing the macsec sysfs nodes is leading to crash when macsec
is disabled in DT

Fix: Do not create sysfs nodes if macsec is not enabled in DT. Also
update the instance_id reading as part of ether_probe which will be
executed even when macsec is disabled

Bug 4431523
Bug 4449611

Change-Id: I354ac142b9d49852a0d5c7557a7368e1c36b0f63
Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3043570
(cherry picked from commit 43136118f6a5e3cbdb09b7366f6a44ca5e52f21c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3075216
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3081231
Reviewed-by: Narayana Reddy P <narayanr@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Bhadram Varka <vbhadram@nvidia.com>
2024-02-28 11:20:40 -08:00
Narayan Reddy
85cf3fb4b3 nvethernet: remove calling of osi_update_stats_counter
remove osi_update_stats_counter and add logic in
nvethernet itself to take care of incrementing the
value

Bug 4284096
Bug 4449611

Change-Id: I0b7e6f03651b0d092d136baf0efd1caffc762205
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053871
(cherry picked from commit bdb1fedec9f3781a3100bd2838271551df31984f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3074753
(cherry picked from commit d31b03a583adf52a7978ef14a9cc0c7d3005ccb0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3081228
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Bhadram Varka <vbhadram@nvidia.com>
2024-02-28 11:20:35 -08:00
Hareesh
5c21e5aafb nvethernet: fix 5.7 misra issues
- Fixed 5.7 misra issues

Bug 3697619
Bug 4449611

Change-Id: I18c3a974ecf01e6981e4f12cbfab040ef7cfa4ca
Signed-off-by: Hareesh Kesireddy <hkesireddy@nvidia.com>
(cherry picked from commit a39b7769b1392d3948160fdcb31ed8765e680882)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3074671
(cherry picked from commit c37e93314db10145238bd5784dfbfca10b60012f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3081222
Reviewed-by: Narayana Reddy P <narayanr@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Bhadram Varka <vbhadram@nvidia.com>
2024-02-28 11:20:25 -08:00
Narayan Reddy
a6f14311c9 nvethernet: Disable NETIF_F_HW_VLAN_CTAG_TX for EQOS
When TSO is enabled with NETIF_F_HW_VLAN_CTAG_TX then VLAN performance
is compromised in the case of EQOS. This is because the hardware fails
to insert a VLAN tag for every segment. To address this issue,
NETIF_F_HW_VLAN_CTAG_TX is temporarily disabled, allowing Network Stack
to handle the insertion of VLAN tags during transmission.

Bug 4290860

Change-Id: Iee24898b5b32d91e19b4eae12c7e076e014d6674
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3008932
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Tonny Liang <tonnyl@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-15 06:15:44 -08:00
Jon Hunter
243e54b69e net: nvethernet: Use conftest for Linux v6.3
Add tests to conftest for detecting if the mii_bus structure has the
read_c45 and write_c45 function pointers and use the definitions
generated by conftest in the nvethernet driver.

This fixes support for nvethernet in 3rd party Linux kernels that have
backported the mii_bus structure changes to their kernel that have a
kernel version prior to Linux v6.3.

Bug 4014315

Change-Id: I5ae98fc5077337286921da6e9347df9781565a70
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3018212
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-11-29 05:19:41 -08:00
Rakesh Goyal
8ca3fa5c51 nvethernet: Skip PHC update if no config change
Issue: Restarting of PTP daemon updates
the current system time in MAC registers.

Fix: Configure PTP registers only if PTP daemon
sends updated configuration. If the configuration
is same continue with earlier registers update.
System time will be set in the MAC registers at
the time of ptp_early_init and the 1st ptp
daemon ioctl to set HW configuration.

Bug 4259584

Change-Id: Ied0eec498cfd4283b71797abf3b272d19998064f
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2994409
(cherry picked from commit e774e69777d92a7136ec6c61571e677bfbde6ebf)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3010369
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-29 05:11:45 -08:00
Mohan Thadikamalla
e8d516daf3 nvethernet: Disable VLAN VID tag filters
Issue:
The L2 Orin bridge use case is encountered
an issue on AV+L NDAS builds for VLAN ping
from HOST1 to HOST2 over L2 Orin bridge.
As HOST1/HOST2 VLAN packets are dropped
by EQOS/MGBE MAC due to VLAN VID feature enable.

Fix:
To support the L2 Orin bridge VLAN
HOST1 to HOST2 data usecase, disable
the VLAN VID filters in the nvethernet driver.

Bug 4230250

Change-Id: I02514fcc15b7764fe93118a9f90c16716368c73c
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
(cherry picked from commit 86cb37f933846a012ba6d8cdac275a2edda0aa42)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3003075
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-30 23:39:22 -07:00
Jon Hunter
ed130f099a net: nvethernet: Fix build for Linux v6.4
In Linux v6.4, commit
3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
added a kernel config option for MAX_SKB_FRAGS and change the type of
the definition to integer. This causes the nvethernet driver build to
fail and the following errors are seen ...

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

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

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

Bug 4183168
Bug 4221847

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

Bug 4119327

Change-Id: I79e701940ca70ca4d66500c75b5992f9d92b54b0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2985744
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-03 04:01:15 -07:00
Revanth Kumar Uppala
7a01b01e88 nvethernet: Resolve "Wframe-larger-than" warning
-Use dynamic structure pointer to eliminate
"Wframe-larger-than" warning.

-Modify "-Wframe-larger-than" flag from 4096 bytes to 2048 bytes

Bug 4213870

Change-Id: I9dc3df951290415ce587b1fe2440ee52dd985b62
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2954775
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-06 05:20:02 -07:00
Mahesh Patil
6883238a21 nvethernet: Fix coverity "unused value"
Bug 3952896

Change-Id: Ie30c3da4d0979f664cb3c951794e905b52e5c005
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2952208
Reviewed-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
2023-08-17 20:16:21 -07:00
Sushil Kumar Singh
0f0dc2e6c1 nvethernet: Cancel set speed workqueue on SC7 entry
set speed work function is not cancelled on system suspend
fix this by cancelling the work queue function

Bug 4167378

Change-Id: I2c065011a830470f690441b2c841893479b361fb
Signed-off-by: Sushil Kumar Singh <sushilkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921347
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-07-28 13:16:35 -07:00
Revanth Kumar Uppala
4c0d72dba6 nvethernet: Fix coverity defect
Issue:
Assigning value 0 to ret, but that stored value is overwritten
before it can be used.

Fix:
Remove unused assignment to ret

CID: 10166550

Bug 3952896

Change-Id: Ieb877e618ca252c218b338682ca02d44096c7a47
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2942165
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-27 18:42:20 -07:00
Bhadram Varka
7cf98e614a nvethernet: return error from ether_get_tx_ts
ether_get_tx_ts, pdata->tx_ts_ref_cnt is an atomic variable
that is used as a mutex in this function and should not return 0
if the function fails to acquire the mutex.
The workqueue is scheduled when the return value of the
judgment function is <0. If one CPU core execution softirq
is running in ether_get_tx_ts function and another CPU core
softirq also calls ether_get_tx_ts function to get hardware
timestamp, then the acquisition of mutex fails and return 0.
After returning 0, the workqueue is not scheduled.
The timestamp cannot be obtained in time. So ether_get_tx_ts
should returns -1 on failure to acquire the mutex.

Bug 4150416

Change-Id: Icffd409b349d8bb8dbf5a483124b3bd3d7ef6cc8
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2934350
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-24 17:41:11 -07:00
Jon Hunter
9655b8c6b0 net: nvethernet: Fix CONFIG_TEGRA_NVPPS not defined warning
Compiling the nvethernet driver without the ccflag CONFIG_TEGRA_NVPPS
defined generates the following warning ...

 drivers/net/ethernet/nvidia/nvethernet/ether_linux.c:2936:5:
 warning: "CONFIG_TEGRA_NVPPS" is not defined, evaluates to 0 [-Wundef]
  2936 | #if CONFIG_TEGRA_NVPPS
       |     ^~~~~~~~~~~~~~~~~~

Fix this by using '#ifdef' to determine if CONFIG_TEGRA_NVPPS is
defined instead of '#if'.

Bug 4190030

Change-Id: Id1523de6f9ef9f4c72669584efb77ffd9ddf20f3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938375
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-19 08:47:03 -07:00
Revanth Kumar Uppala
306f33d38e nvethernet: Read instance_id irrespective of macsec.
Issue:
MGBE0 ASID is getting programmed for all the MAC instances
which inturn causing the data transfer failures.Macsec is not enable
and hence instance_id is not getting updated to the corresponding mac
instance number and hence all mac instance_id's are initialized with 0.
Since ASID programming is based on mac instance_id, all MACs are
programmed with MGBE0 MAC instance id.

Fix:
Moved reading of instance_id from DT out of macsec_probe and hence the
instance_id gets updated irrespective of MAC sec enable/disable.

Bug 4124937

Change-Id: I500ed8d3db402995488260af99ad190217ff6dd2
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2925252
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-27 09:23:14 -07:00
Jon Hunter
c2c17e16c9 net: nvethernet: Fix nvethernet for Linux v6.3
Commit db1a63aed89c ("net: phy: Remove fallback to old C45 method")
removes a fallback C45 method in the MDIO bus driver. This breaks
nvethernet support for Linux v6.3 and the following errors are observed.

 failed to register MDIO bus (nvethernet_mdio_bus)
 net eth0: failed to register MDIO bus

Fix this by adding the necessary read/write_c45 callbacks in the
nvethernet driver. Note these callbacks are only supported for Linux
v6.3+ kernels.

Bug 4014315

Change-Id: Ia6ab753941db0515799657da8522f32996d0852a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2924619
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
2023-06-24 07:28:08 -07:00
Jon Hunter
6475ddcf3d net: nvethernet: Allow driver to be built without NVPPS
The nvethernet driver has a dependency on the NVPPS driver which in
turn has a dependency on the GTE driver. The GTE driver is being
transitioned to the new upstream HTE driver and while this transition is
on-going, allow the nvethernet driver to be distributed and built
without NVPPS and GTE.

Note that by default the dependency on the NVPPS driver is enabled by
setting CONFIG_TEGRA_NVPPS to 'y'. Only if the user sets
CONFIG_TEGRA_NVPPS to 'n' will it be disabled.

Bug 3918941
Bug 3961133

Change-Id: I019e5ebfddfcb158b0a684d2eacc404231577166
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2913273
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-07 22:06:16 -07:00
Revanth Kumar Uppala
98b2b3ff4f nvethernet: Skip the device resume via mdio bus
Enable "phydev->mac_managed_pm" so that device
won't be resumed for second time via mdio bus

Bug 4071996

Change-Id: Ib35bc1459bd882a2b940d4f28bd9d2c76719bfc7
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2901540
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-18 23:41:10 -07:00
Revanth Kumar Uppala
2c2e1dfb9e nvethernet: Correct the if-else condition to copy mac address
Address setting helpers are used to copy mac address from K5.17
as netdev->dev_addr is constant from K5.17.Adding an else condition
now so that memcpy will be used for Kernel versions below K5.17

Bug 4076818

Change-Id: I1542a82710aa2bdf12bfc93fdaedf31d34df91b2
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897883
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-04 11:49:06 -07:00
Narayan Reddy
d1f735fe0d nvethernet: remove explicit addition of vlan prio
Issue: skb_vlan_tag_get gives only the VLAN_ID for
the earlier kernel versions (K4.9) and hence added
a logic to take care of adding the VLAN priority
explicitly and hence the VLAN priority getting
modified in a newer kernel version where VLAN PRIO is
already included

Fix: remove the logic of explicit adding of VLAN
priority.

Bug 3788862
Bug 4088361

Change-Id: I0ac9ebfe21d3e696ac1b0f6ba540c010928f775f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2806468
(cherry picked from commit 799b17fc35f3bc3ec75ea93452c03bd52ed28527)
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2895043
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-04 11:36:02 -07:00
Rakesh Goyal
158ea57641 nvethernet: Protect Tx timestamp list
add_skb_node() added to delete the old entries from the list
but this can concurrently create the issue with ether_get_tx_ts()
either from the workqueue or direct call from tx done routine.

Protect the concurrent access of Tx timestamp list from add_skb_node()
and ether_get_tx_ts().

Bug 3927990
Bug 4088361

Change-Id: Ifae84a072d7d16b259178f2a8e79c2065ce837d8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2842411
(cherry picked from commit 8509d3060cc697cf43c3194521575f859de53e39)
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2895045
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-04 11:35:32 -07:00
Mohan Thadikamalla
756347cd7f nvethernet: Fix invalid KWT fail on NDAS
Issue:
KWT test is getting failed on
NDAS build due nvethernet
driver warnings.

Fix:
Remove unrelated nvethernet
driver warnings

Bug 3935448
Bug 4088361

Change-Id: Ic76a42b2aab2f95ae8b9f89c7823693d58c37f33
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2854306
(cherry picked from commit bb1910bfd1a5305dee9302b2d8fde081e391c516)
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897233
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-04 11:35:22 -07:00
Sushil Singh
a397076302 nvethernet: Add NULL check for phydev in eee init
Issue:
During eth0 down case, the link change gets called twice,
1. due to ndo close
2. due to interrupt generated by phy.
The ether_adjust_link callback also configures the EEE settings
and calls phy_init_eee (a phy framework API) for the same.
Here a race condition occur, when ether_close sets phydev to NULL
before the phy_init_eee gets called (from ether_conf_eee) which tries
to deference the phydev causing kernel panic.

[35779.541305] Call trace:
[35779.544018]  phy_init_eee+0x24/0x290
[35779.547455]  ether_conf_eee+0x110/0x1310 [nvethernet]
[35779.552525]  ether_conf_eee+0x4e0/0x1310 [nvethernet]
[35779.557840]  phy_link_change+0x40/0x90
[35779.561603]  phy_state_machine+0x190/0x240
[35779.565643]  process_one_work+0x1c4/0x4d0
[35779.569396]  worker_thread+0x54/0x430
[35779.573072]  kthread+0x148/0x180
[35779.576586]  ret_from_fork+0x10/0x34
[35779.580069] Code: a90153f3 d5384113 a9025bf5 12001c36 (f941b801)
[35779.586195] ---[ end trace 2ea5b6492f36b0cb ]---
[35779.590737] Kernel panic - not syncing: Oops: Fatal exception

Fix:
Add a NULL check and return -ENODEVICE in EEE configuration

Bug 3877272
Bug 3920560
Bug 3865666
Bug 4088361

Change-Id: I2b26c6eeabb7a109b9d14b3bd2a035f5c3b3c6fa
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2854404
(cherry picked from commit 40606dc247eacf2a8987687777874575d9037058)
Signed-off-by: Sushil Kumar Singh <sushilkumars@nvidia.com>
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2855237
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-04 11:35:12 -07:00
Mahesh Patil
44419231b0 nvethernet: eqos pad calibration reg offsets
Make eqos pad calibration reg ETHER_QOS_AUTO_CAL_CONFIG_0 offsets
AUTO_CAL_PD_OFFSET and 	AUTO_CAL_PU_OFFSET configurable as per
customer boards tuning

Bug 3846183
Bug 4088361

Change-Id: I77521f83cac56650c6a6d1a2dd8b8c7cbdc3f3fc
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2806180
(cherry picked from commit 8eea133d313ba3b1b4ced9f58a65ecf870a2b0e6)
Signed-off-by: Mahesh Patil <maheshp@nvidia.com>
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897231
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-05-04 11:34:52 -07:00
Mohan Thadikamalla
6129bcc538 nvethernet: Clear VLAN tag stripping
Issue:
Observed VLAN ping failure on Linux safety builds.

Fix:
Clear VLAN tag stripping on nvethernet drivers.

Bug 4081795

Change-Id: I08936e2afa1fe1111570cf0cea6aa0cbe463e157
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2891932
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:00:55 -07:00
Sanath Kumar Gampa
d07b3d604c nvethernet:MACSEC, add byp lut with VF MAC
Issue: If the supplicant is killed for some reason Data would flow
plain on that interface, this needs to be avoided

Fix: Update bypass LUT such that if the frames from the VF(on which
supplicant is launched) is received on MACSEC either authenticate the
same or drop. Along with this handles below items as well. All the VFs MACIDs
are obtained in OSI to update the bypass LUTs to decide on which VF frames
to be authenticated and which VF frames needs to be bypassed.

1. Remove osi_macsec_en API and have single API to init and deinit
2. Remove explicit command from supplicant to set control port and
set protected frames. Handle the same in osi_macsec_init

Bug 3984665

Change-Id: I8bc8aa95d1e21e99e992b471fb70ed58073163f7
Signed-off-by: Sanath Kumar Gampa <sgampa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2878515
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-21 11:35:13 -07:00
Jon Hunter
11cff41889 net: nvethernet: Fix build for Linux v6.3
Upstream commit 99d5fe9c7f3d ("net: mdio: Remove support for building C45
muxed addresses") removed the definition MII_ADDR_C45 breaking the build
for the nvethernet driver for Linux v6.3. Update the driver to use the
OSI_MII_ADDR_C45 instead.

Bug 4014315
Bug 4075345

Change-Id: I98f8d10ce1a093d458d293b286a4e5a544d48d04
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2889876
Reviewed-by: Rohit Khanna <rokhanna@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-19 10:57:57 -07:00
Revanth Kumar Uppala
580358e6a2 nvethernet: macsec: Fix crash during suspend
Issue: MACSEC is not enabled in DT for eqos_1 and mgbe2_1
interfaces which makes macsec_pdata pointer to NULL.
During suspend/resume macsec_pdata pointer accessed without
NULL check which resulted in crash.

Fix:
o Add NULL pointer checks for macsec_pdata in suspend and resume.
o Remove unnecessary checks for macsec in suspend and resume.

Bug 4060718

Change-Id: I00e042d979e115c088696a8964496ed0054360e5
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2888289
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-14 23:36:47 -07:00
Sushil Kumar Singh
a986d91aa3 nvethernet: Kernel panic when set jumbo frame
Issue:
Macsec data is NULL for Xavier platforms as no DT macsec
entry is available. This NULL pointer is accessed when
changing MTU, causing kernel panic.

[  110.247070] Unable to handle kernel NULL pointer dereference at virtual address 000000000000015c
[  110.247292] Mem abort info:
[  110.247355]   ESR = 0x96000004
[  110.247423]   EC = 0x25: DABT (current EL), IL = 32 bits
[  110.247534]   SET = 0, FnV = 0
[  110.247616]   EA = 0, S1PTW = 0
[  110.247682] Data abort info:
[  110.247743]   ISV = 0, ISS = 0x00000004
[  110.247823]   CM = 0, WnR = 0
[  110.247889] user pgtable: 4k pages, 48-bit VAs, pgdp=000000010a201000
[  110.248031] [000000000000015c] pgd=0000000000000000, p4d=0000000000000000
[  110.248176] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  110.248295] Modules linked in:
[  110.248379] CPU: 2 PID: 1423 Comm: ifconfig Not tainted 5.10.120-tegra #11
[  110.248525] Hardware name: Unknown Jetson-AGX/Jetson-AGX, BIOS 0.0-ff9214ce 12/20/2022
[  110.248690] pstate: 60400009 (nZCv daif +PAN -UAO -TCO BTYPE=--)
[  110.249074] pc : ether_change_mtu+0x144/0x220
[  110.249381] lr : ether_change_mtu+0x140/0x220
[  110.250528] sp : ffff800014b1b470
[  110.253853] x29: ffff800014b1b470 x28: ffff0318c9632d00
[  110.259366] x27: ffffb376aafb0978 x26: ffffb376aafb0948
[  110.264636] x25: ffffb376ab3b3aa0 x24: ffffb376abf7edd8
[  110.269870] x23: ffff0318c9632d00 x22: ffffb376abeb97d8
[  110.275569] x21: ffff0318c5dc0940 x20: 0000000000002328
[  110.280806] x19: ffff0318c5dc0000 x18: 0000000000000010
[  110.286401] x17: 0000000000000000 x16: ffffb376aa327910
[  110.291581] x15: ffff0318c9633270 x14: ffffffffffffffff
[  110.297166] x13: ffff800094b1b167 x12: ffff800014b1b16f
[  110.302500] x11: 0000000000000020 x10: ffffb376abbb0aa0
[  110.307770] x9 : ffffb376a9ccba7c x8 : 0000000000000001
[  110.313439] x7 : 0000000000017fe8 x6 : c0000000ffffefff
[  110.318605] x5 : ffff031c3fd60958 x4 : 0000000000000000
[  110.324305] x3 : 0000000000000001 x2 : 0000000000000000
[  110.329369] x1 : 0000000000000000 x0 : 0000000000000000
[  110.334706] Call trace:
[  110.337416]  ether_change_mtu+0x144/0x220
[  110.341187]  dev_set_mtu_ext+0xe8/0x1d0
[  110.345121]  dev_set_mtu+0x44/0xb0
[  110.348616]  dev_ifsioc+0x254/0x4d0
[  110.352115]  dev_ioctl+0x128/0x380
[  110.355270]  sock_do_ioctl+0xd4/0x240
[  110.359027]  sock_ioctl+0x27c/0x510
[  110.362530]  __arm64_sys_ioctl+0xb8/0x100
[  110.366731]  el0_svc_common.constprop.0+0x80/0x1f0
[  110.371540]  do_el0_svc+0x2c/0x90
[  110.374522]  el0_svc+0x20/0x40
[  110.377943]  el0_sync_handler+0xc0/0xd0
[  110.381689]  el0_sync+0x184/0x1c0
[  110.384931] Code: b900e714 5281ef42 941a98a4 f94312a0 (b9415c00)
[  110.390801] ---[ end trace cbec9c44e214f14b ]---
[  110.395602] Kernel panic - not syncing: Oops: Fatal exception
[  110.400962] SMP: stopping secondary CPUs
[  110.404718] Kernel Offset: 0x337699bb0000 from 0xffff800010000000
[  110.410752] PHYS_OFFSET: 0xfffffce840000000
[  110.414945] CPU features: 0x18240002,03802a30
[  110.419490] Memory Limit: none
[  110.422645] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]---

Fix:
Add NULL check for macsec data. Macsec is set to NULL if it is not
supported in DT from macsec probe.

Bug 3952134

Change-Id: I0b292e39f3ec8f8fed0fb3fef5cd9f52f5c0e2a9
Signed-off-by: Sushil Kumar Singh <sushilkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2846676
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2878453
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-05 06:01:49 -07:00
Mohan Thadikamalla
01d8319aae nvethernet: Add Linux safety support
Issue:
Observed compilation issues
on the nvethernet driver
for DRIVE Linux safety builds.

Fix:
Add OSI_STRIPPED_LIB support
on nvethernet driver.

Bug 3939603

Change-Id: Id4213c1cf33dc0e925df3e627072b727ae44fa71
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2842470
(cherry picked from commit ece0eb57a89396ea8bdc412beeaa7dfabbda49b1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2879701
Tested-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:49:37 -07:00
Revanth Kumar Uppala
6e2e6973cd nvethernet: Avoid using mdiobus_c45_addr().
Avoid using mdiobus_c45_addr() as it is
obsolete from K6.3.
Instead use its definition directly.

Bug 4014315

Change-Id: Ic407f407b03e465eea97bb530e86360ef81eb1e6
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2873724
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-26 17:35:58 -07:00
Revanth Kumar Uppala
1d36e57bf2 nvethernet: use address setting helpers
Use address setting helpers as netdev->dev_addr
is constant from K5.17

Bug 3978991

Change-Id: I75520ecf695cbf370ef8233d12c250996ebc2abd
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2872952
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-03-21 02:38:07 -07:00
Sushil Kumar Singh
5267694f8e nvethernet: Fix coverity defect
Issue:
Unused value in code with below CID's

10166525
10166540

Fix:
Removed unused variable assignment.

Bug 3952896

Change-Id: I8fa305b26470c08d0eec0e83c8fc5e4fe15be49d
Signed-off-by: Sushil Kumar Singh <sushilkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2860934
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-22 00:45:49 -08:00
Sushil Kumar Singh
877d53d041 nvethernet: Error check for mac address DT node
Issue:
Incorrect return value check for of_get_mac_address()
when reading mac address from dt property.

Fix:
1. Modify error check condition based on
of_get_mac_address() return values.
2. Fixes the Coverity defect CID 10166538.

Bug 3952896

Change-Id: I65ddd05538ad3039da2a21a79be8bb7a0ed1f3fc
Signed-off-by: Sushil Kumar Singh <sushilkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2857036
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-15 04:32:29 -08:00
Sushil Singh
9b97e33558 nvethernet: Fix cert c issues
Issue:
CERT EXP33-C - Using uninitialized value.

Fix:
Initialize variable before use

Bug 3959323

Change-Id: Ia4dc3f58ef13c76305ce8242d38a1863986af193
Signed-off-by: Sushil Singh <sushilkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2853914
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-02-10 23:44:41 -08:00
Revanth Kumar Uppala
2172c01a6d ethernet: Get VM IRQ config sequence from nvidia,vm-irq-id
Ethernet driver expect the VM IRQ configuration. The VM IRQ
is provided with the property "interrupt" which have multiple
VM irq numbers and their configurations via the vm irq
configuration node which is referred by property
"nvidia,vm-irq-config".

The vm irq configuration node have the configuration of
all VM IRQ and each configuration is separated with the
child node like below.

ethernet@6800000 {
	nvidia,vm-irq-config = <&mgbe_vm_irq_config>;
}

	mgbe_vm_irq_config: mgbe-vm-irq-config {
		nvidia,num-vm-irqs = <5>;
		vm_irq1 {
			nvidia,num-vm-channels = <2>;
			nvidia,vm-channels = <0 1>;
			nvidia,vm-num = <0>;
                        nvidia,vm-irq-id = <0>;

		};
		vm_irq2 {
			nvidia,num-vm-channels = <2>;
			nvidia,vm-channels = <2 3>;
			nvidia,vm-num = <1>;
                        nvidia,vm-irq-id = <1>;
		};
		vm_irq3 {
			nvidia,num-vm-channels = <2>;
			nvidia,vm-channels = <4 5>;
			nvidia,vm-num = <2>;
                        nvidia,vm-irq-id = <2>;
		};
		vm_irq4 {
			nvidia,num-vm-channels = <2>;
			nvidia,vm-channels = <6 7>;
			nvidia,vm-num = <3>;
                        nvidia,vm-irq-id = <3>;
		};
		vm_irq5 {
			nvidia,num-vm-channels = <2>;
			nvidia,vm-channels = <8 9>;
			nvidia,vm-num = <4>;
                        nvidia,vm-irq-id = <4>;
		};
	};
};

The child 1(vm_irq1) is link with the VM IRQ  1 listed in
interrupt property, next child which is vm_irq2 is link
with the 2nd VM irq. So, the order of VM configuration
child must be in same order as VM IRQ provided in the
property interrupt.

If the irq configuration order i..e child order is not
matching with VM irq number then there is interrupt issue.

Now, if the VM IRQ config child nodes are provided in base
DT file in same order then the ethernet works fine.
But when applying via overlay, it does not work.
This is because of overlay technique. The overlay logic is
such that it iterates all child node in overlay and
apply the child as first child of target node.
Hence the child sequence provided in overlay fragment
is applied in reverse order in target node. This causes
the irq configuration order not matching with VM IRQs.

To address the overlay issue, read the sequence of
interrupt in property "interrupt" from the newly added property
"nvidia,vm-irq-id" of each child. This way child node
sequence does not matter, and sequence is identified
by property.

Bug 3956724

Change-Id: I5c08edcd8a7e8d3112618dd23050d8b5c10ddc59
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2855639
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-10 06:20:04 -08:00
Revanth Kumar Uppala
cb04b4d509 nvethernet: Register ioctl callback functions
Add ioctl callback functions compatible with
kernel versions below 5.15

Bug 3895413

Change-Id: I4ab5d0b6137c6dce7749cb003d99603cff8cb201
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2833701
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-01-04 17:56:22 -08:00
Revanth Kumar Uppala
843ab03d91 nvethernet: Register ioctl callback functions
Add ioctl callback functions compatible with
K5.15 and above  versions

Bug 3895413

Change-Id: Id32a4fa4dec62787b7a1a1c57a4d9f1cf60d2542
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2827706
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-16 03:34:21 -08:00
Mohan Thadikamalla
2b21d4a86e nvethernet: Remove MAC START ioctl
Issue:
MAC START and STOP IOCTL are deprecated,
so these IOCTL calls has internally
generated failure for Linux OSD.

Fix:
Remove MAC START IOCTL from Linux OSD.

Bug 3889287

Change-Id: I19684936d22dac35df5af2393e163f51118fc8ce
Signed-off-by: Mohan Thadikamalla <mohant@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2824816
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2022-12-13 06:23:15 -08:00
Jon Hunter
1e04890051 nvethernet: Fix build for Linux v5.14 and v5.17+
The nvethernet driver fails to build for Linux v5.14 and Linux v5.17+
kernels. In Linux v5.15 the return type of the get/set_coalesce
callbacks were updated. In Linux v5.17 the parameters for the
get/set_ringparam callbacks were updated. In Linux v6.1 the
weight parameter for the netif_napi_add() function was removed and the
function netif_napi_add_weight() was added for passing the weight
parameter. Add the necessary kernel version checks to ensure that the
drivers build with the different versions of the Linux kernel.

Bug 3793131

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