Commit Graph

25 Commits

Author SHA1 Message Date
Ajay Gupta
97dede3ff9 nvethernet: enable tx interrupt coalescing
Tx frame count and software timer based interrupt coalescing
is enabled. Tx frame count based interrupt coalescing can be
enabled only when tx software timer based interrupt coalescing
is also enabled.

Bug 200529168

Change-Id: I8ac701c86238e8d34d7dbe9924df1162083c023e
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2234610
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
c45ba21f05 nvethernet: eqos: Use single API to enable/configure filter
Update OSI driver calls in ioctl path and set_rx_mode
to use single API

Bug 2715384

Change-Id: I521471060a31b985ea2f17a1e5ef91830820c285
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2216069
GVS: Gerrit_Virtual_Submit
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Bhadram Varka
1c6a1e3f7b nvethernet: unregister HW timestamp source in close
Issue: ether_get_ptptime() is registered as a callback
       function to read ptp time using tegra_register_hwtime_source.
       But it is not unregistered before interface is brought down.
       This causes clients to still query for timestamp even though
       interface is down and MAC is in reset, resulting in CBB errors.
Fix:   Unregister the callback function in ether_close()

Bug 200556936

Change-Id: Idb5b698460f02101c931fd64fbdfc9c06949e05a
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2210705
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
c080c796e2 nvethernet: remove spin locks and re-initialize private variable
Issue:
1) Spin locks are used for code path which is already serialized
by network stack
2) On interface down/up, MAC registers are getting reset and
re-initialized but private structure variables are not updated

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

Bug 200548252
Bug 200547544

Change-Id: Ifb0ce27ba96f8657eebde21e5d02d8b36fb1778b
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2189974
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
8708cf6e98 nvethernet: read ethernet hw counters periodically
HW MMC registers are 32 bits in size. Some of these will
overrun in few secs if there are live traffic at line rate.

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

Bug 200544686

Change-Id: Ifc358f3f6b50839f7d9f48c2f98cb2cdd9ac0821
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2179298
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Narayan Reddy
e97dbc8de1 nvethernet: allow PHY read/write if MAC clks enabled
Issue: During system suspend, PHY framework is trying to
access the PHY registers even though the ethernet interface
is not up which inturn causing the bus errors since MAC clocks
not enabled.

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

Bug 200548320

Change-Id: Ic85ae82bbc7e7f33203cc94f8407bdfd23f75502
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2187285
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Bhadram Varka
e4f82ebb78 nvethernet: use maximum transmit buffer size
1) Removes the limitation of 4KB per descriptor.
2) Adds maximum transmit buffer size as 0x3FFF.
3) Changes descripors threshold considering TSO/GSO.

Bug 200542488

Change-Id: Ic32d5e1e49df48b0da057349f8300d029410d322
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2174519
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Bhadram Varka
58301a3ef2 nvethernet: Update comments with Doxygen style
replace kernel doc comments with Doxygen style comments

Bug 200512422

Change-Id: I1445cab3fb6708ddc21b4bfacebe213ed22f7aa2
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2180213
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Tested-by: Narayan Reddy <narayanr@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Narayan Reddy
da8bbea503 nvethernet: IOCTL and broadcasting MAC timestamp support
1) Register broadcasting MAC timestamp to clients so that
client can make use of the ptp callback for getting the
timestamp
2) Add private ioctl to read Timestamp information of
both HW PTP time and kernel time

Bug 200512422

Change-Id: I03509cc02f28571108a1061c739840c86f960af4
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2161172
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Bhadram Varka
23da7763f3 nvethernet: fix race in enable/disable Tx/Rx interrupts
Change-Id: I5d2ba00662d965d742fea0c655dd2845b65f59b9
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2161941
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
134a4c1057 nvethernet: handle various mtl and dma combination
Issue:
1) MTL Queue can be in any order in input to DT. If not
initialized sw can crash.
2) Don't use return value of skb_get_queue_mapping as
channel number.

Fix:
1) As MTL Queue sequence is already read, use it for
initialization and storing corresponding configuration.
2) Derive the channel number based on the q index
provided by skb_get_queue_mapping.

Bug 200512422

Change-Id: I145f67ee07101ae69821b5ae4a770e512252985b
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2156243
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
3cb8c90059 nvethernet: read max mtu size from platform DT
Issue: Configure Max MTU size support for specific platform

Fix:
 if "nvidia,max_platform_mtu" present in platform DT and less than
    MAX_HW_MTU supported
 	set platform max value from DT
 else
	default MTU(1500 bytes) will be used as platform max mtu

Bug 2594873

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

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

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

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

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

Bug 200525721

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

Bug 200519211

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

Bug 200524751

Change-Id: Id647db1f60582717a09f24699841e00d7a582a1d
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2123439
GVS: Gerrit_Virtual_Submit
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
6a3fdf61b3 nvethernet: enable MAC filter
Functions added to support filter setting from Network
stack as well as from customized app using ioctl.

Bug 200512993

Change-Id: Id9a7712242ef229969d7c476c85171509ab53d73
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111084
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Srinivas Ramachandran
3565e0eb75 nvethernet: Add temperature based pad calibration.
Ethernet pad calibration needs to be triggered for temperature
changes in steps of 35C from -40C to 110C. In order to get
indication of current operating temperature, register a ethernet
cooling device with thermal zones defined as per above requirement.
When the temperature trips these zones, callback function is invoked
from kernel thermal framework, and ethernet driver can trigger pad
calibration.

Bug 1679250

Change-Id: Iaeccca650e371843fa571f7b368bb5464e106314
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2120431
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Srinivas Ramachandran
e05030a4e2 nvethernet: Add support for ioctls and HW offloads
1. ARP offload can be configured via private ioctl.
   Application requesting the arp offload configuration
   should provide the IP address to be configured for
   ARP offload via ioctl data struct. Refer to
   struct ether_ifr_data and
   struct arp_offload_param for details.

2. Tx/Rx Checksum offload can be configured via ethtool

3. TCP Segmentation offload can be configured via ethtool

Bug 2571001

Change-Id: If639ab9049db97f200911af456ddb8cb8433fa12
Signed-off-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2109676
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
4e30306bac nvethernet: add support for 802.1Qav (CBS)
Code added for
1) Customized application to configure avb setting
2) ndo_select_queue support to identify queue based on
   user priority.

Bug 200512771

Change-Id: I6468aa838567e50885931f10d49126870f1e25c4
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2108339
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Narayan Reddy
3fa01bcd71 nvethernet: MAC loopback support
When MAC HW loopback is enabled, MAC receives
back all the packets that is being sent by it.
Packets which were sent are looped inside the
MAC itself.

Bug 200512681

Change-Id: Ifb29dcdbfbf2c1b3baab438bf5b98c0fb362e6d8
Signed-off-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2088984
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Rakesh Goyal
0975ee4989 nvethernet: fix common irq free path
issue: freeing common irq in ether_free_irqs without check

fix: Use mask for common interrupt as well so it can be used to
check before freeing irq

Bug 200512422

Change-Id: I694ba983658fae3da6948ceda18d24c11f08d458
Signed-off-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081600
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Narayan Reddy
2893067ed3 nvethernet: add support to parse dma_mask
Add dma-mask parsing in device tree for eqos
driver if IOMMU is enabled. This will allow
memory allocations from the specified address
and downwards, while device can reach every part
of physical memory through the IOMMU.

dma-mask will be remain default 32-bit mask if no
IOMMU is present since now DMA mask represents a
fundamental limit of the device.

Bug 200458098

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

Bug 200512251

Change-Id: I1c754deff7c399db215f3803468c4c1513bf0988
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2080716
GVS: Gerrit_Virtual_Submit
Reviewed-by: Rakesh Goyal <rgoyal@nvidia.com>
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: Srinivas Ramachandran <srinivasra@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Bhadram Varka
ec95665467 nvethernet: support for VLAN
Adds support for VLAN tag insertion on Tx path
and parsing of VLAN tag on receive path.

Bug 200511721

Change-Id: I07d4a576873bae61267244c9eb03a777f515a761
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2077037
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2022-11-01 14:27:07 +05:30
Bhadram Varka
77ee94796d nvethernet: support for EQOS base MAC
1) support for driver probe based on nveqos
2) support for EQOS hw init
3) data transmission support for Tx and Rx

Bug 200507585

Change-Id: I5c8bc88f97b2e61a2b346a23aadcb19a7b8c53a5
Signed-off-by: Bhadram Varka <vbhadram@nvidia.com>
2022-11-01 14:27:07 +05:30