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>
This commit is contained in:
Rakesh Goyal
2019-09-04 18:11:12 +05:30
committed by Revanth Kumar Uppala
parent 8708cf6e98
commit c080c796e2
3 changed files with 8 additions and 20 deletions

View File

@@ -1160,7 +1160,8 @@ static int ether_therm_init(struct ether_priv_data *pdata)
* 1) PHY initialization
* 2) request tx/rx/common irqs
* 3) HW initialization
* 4) Starting the PHY
* 4) OSD private data structure initialization
* 5) Starting the PHY
*
* @param[in] dev: Net device data structure.
*
@@ -1258,6 +1259,12 @@ static int ether_open(struct net_device *dev)
goto err_hw_init;
}
/* As all registers reset as part of ether_close(), reset private
* structure variable as well */
pdata->vlan_hash_filtering = OSI_PERFECT_FILTER_MODE;
pdata->l3_l4_filter = OSI_DISABLE;
pdata->l2_filtering_mode = OSI_PERFECT_FILTER_MODE;
/* Start the MAC */
osi_start_mac(pdata->osi_core);
@@ -1870,7 +1877,6 @@ static int ether_prepare_uc_list(struct net_device *dev)
* @param[in] dev - pointer to net_device structure.
*
* @note MAC and PHY need to be initialized.
* Spinlock is used for protection.
*/
static void ether_set_rx_mode(struct net_device *dev)
{
@@ -1879,8 +1885,6 @@ static void ether_set_rx_mode(struct net_device *dev)
struct osi_filter filter = {0};
int mode, ret;
spin_lock_bh(&pdata->lock);
if ((dev->flags & IFF_PROMISC) == IFF_PROMISC) {
dev_dbg(pdata->dev, "enabling Promiscuous mode\n");
filter.pr_mode = OSI_ENABLE;
@@ -1929,8 +1933,6 @@ static void ether_set_rx_mode(struct net_device *dev)
if (ret != 0) {
dev_err(pdata->dev, "osi_config_mac_pkt_filter_reg failed\n");
}
spin_unlock_bh(&pdata->lock);
}
/**
@@ -3476,8 +3478,6 @@ static int ether_probe(struct platform_device *pdev)
goto err_netdev;
}
spin_lock_init(&pdata->lock);
spin_lock_init(&pdata->ioctl_lock);
spin_lock_init(&pdata->rlock);
init_filter_values(pdata);
/* Disable Clocks */

View File

@@ -273,12 +273,8 @@ struct ether_priv_data {
* whcih has triggered */
atomic_t therm_state;
#endif /* THERMAL_CAL */
/** Spin lock for filter code */
spinlock_t lock;
/** Spin lock for Tx/Rx interrupt enable registers */
spinlock_t rlock;
/** spin lock for filter code ioctl path */
spinlock_t ioctl_lock;
/** max address register count, 2*mac_addr64_sel */
int num_mac_addr_regs;
/** Last Multicast address reg filter index, If 0,no MC address added */

View File

@@ -192,9 +192,7 @@ static int ether_config_l3_l4_filtering(struct net_device *dev,
ret = osi_config_l3_l4_filter_enable(osi_core, filter_flags);
if (ret == 0) {
spin_lock_bh(&pdata->ioctl_lock);
pdata->l3_l4_filter = filter_flags;
spin_unlock_bh(&pdata->ioctl_lock);
}
return ret;
@@ -253,14 +251,12 @@ static int ether_config_ip4_filters(struct net_device *dev,
}
/* enable IPFE bit in MAC_Packet_Filter for L3/L4 if already not */
spin_lock_bh(&pdata->ioctl_lock);
if (pdata->l3_l4_filter == OSI_DISABLE) {
ret = osi_config_l3_l4_filter_enable(osi_core, OSI_ENABLE);
if (ret == 0) {
pdata->l3_l4_filter = OSI_ENABLE;
}
}
spin_unlock_bh(&pdata->ioctl_lock);
/* configure the L3 filters */
ret = osi_config_l3_filters(osi_core, l_l3_filter.filter_no,
@@ -333,14 +329,12 @@ static int ether_config_ip6_filters(struct net_device *dev,
}
/* enable IPFE bit in MAC_Packet_Filter for L3/L4 if already not */
spin_lock_bh(&pdata->ioctl_lock);
if (pdata->l3_l4_filter == OSI_DISABLE) {
ret = osi_config_l3_l4_filter_enable(osi_core, OSI_ENABLE);
if (ret == 0) {
pdata->l3_l4_filter = OSI_ENABLE;
}
}
spin_unlock_bh(&pdata->ioctl_lock);
/* configure the L3 filters */
ret = osi_config_l3_filters(osi_core, l_l3_filter.filter_no,
@@ -414,14 +408,12 @@ static int ether_config_tcp_udp_filters(struct net_device *dev,
}
/* enable IPFE bit in MAC_Packet_Filter for L3/L4 if already not */
spin_lock_bh(&pdata->ioctl_lock);
if (pdata->l3_l4_filter == OSI_DISABLE) {
ret = osi_config_l3_l4_filter_enable(osi_core, OSI_ENABLE);
if (ret == 0) {
pdata->l3_l4_filter = OSI_ENABLE;
}
}
spin_unlock_bh(&pdata->ioctl_lock);
/* configure the L4 filters */
ret = osi_config_l4_filters(osi_core, l_l4_filter.filter_no,