Commits
Murali Karicheri committed ca6d920cd3e
prueth: support run time change of protocol at pru Ethernet device The ICSS PRU is capable of running different firmware to support various industrial Ethernet protocols. This requires a capability to configure and run a specific protocol at PRU from user space. The ethtool command already provide -K option to allow offload features to hardware. Use this facility to allow offload of HSR/PRP or any future protocol offload to firmware and there by allow user to bring up Ethernet with a specific protocol running at firmware. If user would like to run plain Ethernet using EMAC firmware, user may switch off the offload using ethtool -K option and bring up Ethernet interface using EMAC firmware. Here is an example sequence to switch from EMAC to HSR assuming eth2 and eth3 are in use. ifconfig eth3 0.0.0.0 down ethtool -K eth2 hsr-rx-offload on ethtool -K eth3 hsr-rx-offload on ifconfig eth2 hw ether <LRE MAC> ifconfig eth3 hw ether <LRE MAC> ip link add name hsr0 type hsr ..... Similarly to switch from HSR to PRP, user may do ip link delete hsr0 ifconfig eth2 down ifconfig eth3 down ethtool -K eth2 hsr-rx-offload off ethtool -K eth3 hsr-rx-offload off ethtool -K eth2 prp-rx-offload on ethtool -K eth3 prp-rx-offload on ifconfig eth2 hw ether <LRE MAC> ifconfig eth3 hw ether <LRE MAC> ip link add name prp0 type prp .... Similar way, user may switch from PRP to HSR or EMAC and so on. To support this functionality, move some of the code related to Host or Port configuration from probe() to ndo_open(). The Ethernet device configuration or initialization consists of initializing the Host specific part followed by port specific part. Since the Host specific configuration/init is common across both ports, it is required to protect this code through a mutex to make sure concurrent ndo device open happens properly. i.e second net device open wait for the common initialization to be complete before proceeding to initialize its own port. The variable, emac_configured, is used to skip the common code when second device is opened. Additional implement ndo ops, emac_ndo_fix_features() and emac_ndo_set_features() to support ethtool -K option and keep separate variables for storing switch/emac irqs so that device can use it based on eth_tye without having to parse the DTS everytime. Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>