aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c')
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c65
1 files changed, 16 insertions, 49 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 8fb836d4129f..aeb26a850679 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -84,14 +84,9 @@ static int qlcnic_start_firmware(struct qlcnic_adapter *);
84static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter); 84static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter);
85static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *); 85static void qlcnic_dev_set_npar_ready(struct qlcnic_adapter *);
86static int qlcnicvf_start_firmware(struct qlcnic_adapter *); 86static int qlcnicvf_start_firmware(struct qlcnic_adapter *);
87static void qlcnic_set_netdev_features(struct qlcnic_adapter *,
88 struct qlcnic_esw_func_cfg *);
89static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16); 87static int qlcnic_vlan_rx_add(struct net_device *, __be16, u16);
90static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16); 88static int qlcnic_vlan_rx_del(struct net_device *, __be16, u16);
91 89
92#define QLCNIC_IS_TSO_CAPABLE(adapter) \
93 ((adapter)->ahw->capabilities & QLCNIC_FW_CAPABILITY_TSO)
94
95static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter) 90static u32 qlcnic_vlan_tx_check(struct qlcnic_adapter *adapter)
96{ 91{
97 struct qlcnic_hardware_context *ahw = adapter->ahw; 92 struct qlcnic_hardware_context *ahw = adapter->ahw;
@@ -1074,8 +1069,6 @@ void qlcnic_set_eswitch_port_features(struct qlcnic_adapter *adapter,
1074 1069
1075 if (!esw_cfg->promisc_mode) 1070 if (!esw_cfg->promisc_mode)
1076 adapter->flags |= QLCNIC_PROMISC_DISABLED; 1071 adapter->flags |= QLCNIC_PROMISC_DISABLED;
1077
1078 qlcnic_set_netdev_features(adapter, esw_cfg);
1079} 1072}
1080 1073
1081int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) 1074int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter)
@@ -1090,51 +1083,23 @@ int qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter)
1090 return -EIO; 1083 return -EIO;
1091 qlcnic_set_vlan_config(adapter, &esw_cfg); 1084 qlcnic_set_vlan_config(adapter, &esw_cfg);
1092 qlcnic_set_eswitch_port_features(adapter, &esw_cfg); 1085 qlcnic_set_eswitch_port_features(adapter, &esw_cfg);
1086 qlcnic_set_netdev_features(adapter, &esw_cfg);
1093 1087
1094 return 0; 1088 return 0;
1095} 1089}
1096 1090
1097static void 1091void qlcnic_set_netdev_features(struct qlcnic_adapter *adapter,
1098qlcnic_set_netdev_features(struct qlcnic_adapter *adapter, 1092 struct qlcnic_esw_func_cfg *esw_cfg)
1099 struct qlcnic_esw_func_cfg *esw_cfg)
1100{ 1093{
1101 struct net_device *netdev = adapter->netdev; 1094 struct net_device *netdev = adapter->netdev;
1102 unsigned long features, vlan_features;
1103 1095
1104 if (qlcnic_83xx_check(adapter)) 1096 if (qlcnic_83xx_check(adapter))
1105 return; 1097 return;
1106 1098
1107 features = (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | 1099 adapter->offload_flags = esw_cfg->offload_flags;
1108 NETIF_F_IPV6_CSUM | NETIF_F_GRO); 1100 adapter->flags |= QLCNIC_APP_CHANGED_FLAGS;
1109 vlan_features = (NETIF_F_SG | NETIF_F_IP_CSUM | 1101 netdev_update_features(netdev);
1110 NETIF_F_IPV6_CSUM); 1102 adapter->flags &= ~QLCNIC_APP_CHANGED_FLAGS;
1111
1112 if (QLCNIC_IS_TSO_CAPABLE(adapter)) {
1113 features |= (NETIF_F_TSO | NETIF_F_TSO6);
1114 vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6);
1115 }
1116
1117 if (netdev->features & NETIF_F_LRO)
1118 features |= NETIF_F_LRO;
1119
1120 if (esw_cfg->offload_flags & BIT_0) {
1121 netdev->features |= features;
1122 adapter->rx_csum = 1;
1123 if (!(esw_cfg->offload_flags & BIT_1)) {
1124 netdev->features &= ~NETIF_F_TSO;
1125 features &= ~NETIF_F_TSO;
1126 }
1127 if (!(esw_cfg->offload_flags & BIT_2)) {
1128 netdev->features &= ~NETIF_F_TSO6;
1129 features &= ~NETIF_F_TSO6;
1130 }
1131 } else {
1132 netdev->features &= ~features;
1133 features &= ~features;
1134 adapter->rx_csum = 0;
1135 }
1136
1137 netdev->vlan_features = (features & vlan_features);
1138} 1103}
1139 1104
1140static int 1105static int
@@ -2016,8 +1981,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2016 pci_enable_pcie_error_reporting(pdev); 1981 pci_enable_pcie_error_reporting(pdev);
2017 1982
2018 ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL); 1983 ahw = kzalloc(sizeof(struct qlcnic_hardware_context), GFP_KERNEL);
2019 if (!ahw) 1984 if (!ahw) {
1985 err = -ENOMEM;
2020 goto err_out_free_res; 1986 goto err_out_free_res;
1987 }
2021 1988
2022 switch (ent->device) { 1989 switch (ent->device) {
2023 case PCI_DEVICE_ID_QLOGIC_QLE824X: 1990 case PCI_DEVICE_ID_QLOGIC_QLE824X:
@@ -2053,6 +2020,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2053 2020
2054 adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic"); 2021 adapter->qlcnic_wq = create_singlethread_workqueue("qlcnic");
2055 if (adapter->qlcnic_wq == NULL) { 2022 if (adapter->qlcnic_wq == NULL) {
2023 err = -ENOMEM;
2056 dev_err(&pdev->dev, "Failed to create workqueue\n"); 2024 dev_err(&pdev->dev, "Failed to create workqueue\n");
2057 goto err_out_free_netdev; 2025 goto err_out_free_netdev;
2058 } 2026 }
@@ -2133,6 +2101,10 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2133 goto err_out_disable_msi; 2101 goto err_out_disable_msi;
2134 } 2102 }
2135 2103
2104 err = qlcnic_get_act_pci_func(adapter);
2105 if (err)
2106 goto err_out_disable_mbx_intr;
2107
2136 err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac); 2108 err = qlcnic_setup_netdev(adapter, netdev, pci_using_dac);
2137 if (err) 2109 if (err)
2138 goto err_out_disable_mbx_intr; 2110 goto err_out_disable_mbx_intr;
@@ -2162,9 +2134,6 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2162 break; 2134 break;
2163 } 2135 }
2164 2136
2165 if (qlcnic_get_act_pci_func(adapter))
2166 goto err_out_disable_mbx_intr;
2167
2168 if (adapter->drv_mac_learn) 2137 if (adapter->drv_mac_learn)
2169 qlcnic_alloc_lb_filters_mem(adapter); 2138 qlcnic_alloc_lb_filters_mem(adapter);
2170 2139
@@ -3149,10 +3118,8 @@ qlcnic_check_health(struct qlcnic_adapter *adapter)
3149 if (adapter->need_fw_reset) 3118 if (adapter->need_fw_reset)
3150 goto detach; 3119 goto detach;
3151 3120
3152 if (adapter->ahw->reset_context && qlcnic_auto_fw_reset) { 3121 if (adapter->ahw->reset_context && qlcnic_auto_fw_reset)
3153 qlcnic_reset_hw_context(adapter); 3122 qlcnic_reset_hw_context(adapter);
3154 adapter->netdev->trans_start = jiffies;
3155 }
3156 3123
3157 return 0; 3124 return 0;
3158 } 3125 }