Commit e5dcf6dc authored by Sucheta Chakraborty's avatar Sucheta Chakraborty Committed by David S. Miller

qlcnic: enable mac-learning in promiscous mode.

MAC learning is required in bridge mode.
During bridge mode device will be put in promiscous mode.
Signed-off-by: default avatarSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a941fef8
...@@ -1015,6 +1015,7 @@ struct qlcnic_adapter { ...@@ -1015,6 +1015,7 @@ struct qlcnic_adapter {
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
u64 dev_rst_time; u64 dev_rst_time;
u8 mac_learn;
unsigned long vlans[BITS_TO_LONGS(VLAN_N_VID)]; unsigned long vlans[BITS_TO_LONGS(VLAN_N_VID)];
struct qlcnic_npar_info *npars; struct qlcnic_npar_info *npars;
...@@ -1460,6 +1461,7 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev); ...@@ -1460,6 +1461,7 @@ netdev_tx_t qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev);
int qlcnic_validate_max_rss(struct net_device *netdev, u8 max_hw, u8 val); int qlcnic_validate_max_rss(struct net_device *netdev, u8 max_hw, u8 val);
int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data); int qlcnic_set_max_rss(struct qlcnic_adapter *adapter, u8 data);
void qlcnic_dev_request_reset(struct qlcnic_adapter *); void qlcnic_dev_request_reset(struct qlcnic_adapter *);
void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter);
/* Management functions */ /* Management functions */
int qlcnic_get_mac_address(struct qlcnic_adapter *, u8*); int qlcnic_get_mac_address(struct qlcnic_adapter *, u8*);
......
...@@ -446,6 +446,13 @@ void qlcnic_set_multi(struct net_device *netdev) ...@@ -446,6 +446,13 @@ void qlcnic_set_multi(struct net_device *netdev)
} }
send_fw_cmd: send_fw_cmd:
if (mode == VPORT_MISS_MODE_ACCEPT_ALL) {
qlcnic_alloc_lb_filters_mem(adapter);
adapter->mac_learn = 1;
} else {
adapter->mac_learn = 0;
}
qlcnic_nic_set_promisc(adapter, mode); qlcnic_nic_set_promisc(adapter, mode);
} }
......
...@@ -90,7 +90,6 @@ static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev); ...@@ -90,7 +90,6 @@ static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev);
static void qlcnic_restore_indev_addr(struct net_device *dev, unsigned long); static void qlcnic_restore_indev_addr(struct net_device *dev, unsigned long);
static int qlcnic_start_firmware(struct qlcnic_adapter *); static int qlcnic_start_firmware(struct qlcnic_adapter *);
static void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter);
static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter); static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter);
static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *); static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *);
static int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32); static int qlcnicvf_config_led(struct qlcnic_adapter *, u32, u32);
...@@ -1578,6 +1577,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1578,6 +1577,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
adapter->dev_rst_time = jiffies; adapter->dev_rst_time = jiffies;
revision_id = pdev->revision; revision_id = pdev->revision;
adapter->ahw->revision_id = revision_id; adapter->ahw->revision_id = revision_id;
adapter->mac_learn = qlcnic_mac_learn;
rwlock_init(&adapter->ahw->crb_lock); rwlock_init(&adapter->ahw->crb_lock);
mutex_init(&adapter->ahw->mem_lock); mutex_init(&adapter->ahw->mem_lock);
...@@ -1654,7 +1654,9 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1654,7 +1654,9 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
break; break;
} }
if (adapter->mac_learn)
qlcnic_alloc_lb_filters_mem(adapter); qlcnic_alloc_lb_filters_mem(adapter);
qlcnic_create_diag_entries(adapter); qlcnic_create_diag_entries(adapter);
return 0; return 0;
...@@ -1850,13 +1852,12 @@ static int qlcnic_close(struct net_device *netdev) ...@@ -1850,13 +1852,12 @@ static int qlcnic_close(struct net_device *netdev)
return 0; return 0;
} }
static void void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter)
qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter)
{ {
void *head; void *head;
int i; int i;
if (!qlcnic_mac_learn) if (adapter->fhash.fmax && adapter->fhash.fhead)
return; return;
spin_lock_init(&adapter->mac_learn_lock); spin_lock_init(&adapter->mac_learn_lock);
...@@ -2286,7 +2287,7 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) ...@@ -2286,7 +2287,7 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
if (unlikely(qlcnic_tx_pkt(adapter, first_desc, skb))) if (unlikely(qlcnic_tx_pkt(adapter, first_desc, skb)))
goto unwind_buff; goto unwind_buff;
if (qlcnic_mac_learn) if (adapter->mac_learn)
qlcnic_send_filter(adapter, tx_ring, first_desc, skb); qlcnic_send_filter(adapter, tx_ring, first_desc, skb);
qlcnic_update_cmd_producer(adapter, tx_ring); qlcnic_update_cmd_producer(adapter, tx_ring);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment