diff options
author | Rajesh Borundia <rajesh.borundia@qlogic.com> | 2010-08-31 17:17:50 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-01 10:41:56 -0700 |
commit | 7373373d100e5aebe751af0b2609a9a01dad5ac1 (patch) | |
tree | 3816ae48d6f3f33beeb20f2c66b2b4ab333dc1fa /drivers/net/qlcnic/qlcnic_main.c | |
parent | dcb50afff747d15fc2ffff762c08c325e4c229e5 (diff) | |
download | kernel_samsung_smdk4412-7373373d100e5aebe751af0b2609a9a01dad5ac1.zip kernel_samsung_smdk4412-7373373d100e5aebe751af0b2609a9a01dad5ac1.tar.gz kernel_samsung_smdk4412-7373373d100e5aebe751af0b2609a9a01dad5ac1.tar.bz2 |
qlcnic: fix mac override capability
o Rename mac_learning to mac_override
o Added check in set_mac to return error if mac override is disabled.
o Disabling mac_override only supported for Non priviledged functions.
Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_main.c')
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 789fe81..130f4dbe 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c @@ -343,6 +343,9 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p) struct qlcnic_adapter *adapter = netdev_priv(netdev); struct sockaddr *addr = p; + if ((adapter->flags & QLCNIC_MAC_OVERRIDE_DISABLED)) + return -EOPNOTSUPP; + if (!is_valid_ether_addr(addr->sa_data)) return -EINVAL; @@ -741,10 +744,14 @@ qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter, struct qlcnic_esw_func_cfg *esw_cfg) { adapter->flags &= ~QLCNIC_MACSPOOF; + adapter->flags &= ~QLCNIC_MAC_OVERRIDE_DISABLED; if (esw_cfg->mac_anti_spoof) adapter->flags |= QLCNIC_MACSPOOF; + if (!esw_cfg->mac_override) + adapter->flags |= QLCNIC_MAC_OVERRIDE_DISABLED; + qlcnic_set_netdev_features(adapter, esw_cfg); } @@ -862,14 +869,14 @@ qlcnic_set_default_offload_settings(struct qlcnic_adapter *adapter) memset(&esw_cfg, 0, sizeof(struct qlcnic_esw_func_cfg)); esw_cfg.pci_func = i; esw_cfg.offload_flags = BIT_0; - esw_cfg.mac_learning = BIT_0; + esw_cfg.mac_override = BIT_0; if (adapter->capabilities & QLCNIC_FW_CAPABILITY_TSO) esw_cfg.offload_flags |= (BIT_1 | BIT_2); if (qlcnic_config_switch_port(adapter, &esw_cfg)) return -EIO; npar = &adapter->npars[i]; npar->pvid = esw_cfg.vlan_id; - npar->mac_learning = esw_cfg.offload_flags; + npar->mac_override = esw_cfg.mac_override; npar->mac_anti_spoof = esw_cfg.mac_anti_spoof; npar->discard_tagged = esw_cfg.discard_tagged; npar->promisc_mode = esw_cfg.promisc_mode; @@ -887,7 +894,7 @@ qlcnic_reset_eswitch_config(struct qlcnic_adapter *adapter, esw_cfg.op_mode = QLCNIC_PORT_DEFAULTS; esw_cfg.pci_func = pci_func; esw_cfg.vlan_id = npar->pvid; - esw_cfg.mac_learning = npar->mac_learning; + esw_cfg.mac_override = npar->mac_override; esw_cfg.discard_tagged = npar->discard_tagged; esw_cfg.mac_anti_spoof = npar->mac_anti_spoof; esw_cfg.offload_flags = npar->offload_flags; @@ -3042,6 +3049,10 @@ qlcnicvf_start_firmware(struct qlcnic_adapter *adapter) qlcnic_check_options(adapter); + err = qlcnic_set_eswitch_port_config(adapter); + if (err) + return err; + adapter->need_fw_reset = 0; return err; @@ -3397,8 +3408,10 @@ validate_esw_config(struct qlcnic_adapter *adapter, switch (esw_cfg[i].op_mode) { case QLCNIC_PORT_DEFAULTS: if (QLC_DEV_GET_DRV(op_mode, pci_func) != - QLCNIC_NON_PRIV_FUNC) + QLCNIC_NON_PRIV_FUNC) { esw_cfg[i].mac_anti_spoof = 0; + esw_cfg[i].mac_override = 1; + } break; case QLCNIC_ADD_VLAN: if (!IS_VALID_VLAN(esw_cfg[i].vlan_id)) @@ -3474,7 +3487,7 @@ qlcnic_sysfs_write_esw_config(struct file *file, struct kobject *kobj, switch (esw_cfg[i].op_mode) { case QLCNIC_PORT_DEFAULTS: npar->promisc_mode = esw_cfg[i].promisc_mode; - npar->mac_learning = esw_cfg[i].mac_learning; + npar->mac_override = esw_cfg[i].mac_override; npar->offload_flags = esw_cfg[i].offload_flags; npar->mac_anti_spoof = esw_cfg[i].mac_anti_spoof; npar->discard_tagged = esw_cfg[i].discard_tagged; |