Skip to content

Commit b7e7ad6

Browse files
committed
Merge branch 'qed-fixes'
Yuval Mintz says: ==================== qed*: Bug fixes This series contain several small fixes, most of which deal with either 100g support, sriov or bandwidth configurations. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 6124872 + 3e7cfce commit b7e7ad6

File tree

4 files changed

+78
-23
lines changed

4 files changed

+78
-23
lines changed

drivers/net/ethernet/qlogic/qed/qed_dev.c

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,14 @@ void qed_resc_free(struct qed_dev *cdev)
155155
}
156156
}
157157

158-
static int qed_init_qm_info(struct qed_hwfn *p_hwfn)
158+
static int qed_init_qm_info(struct qed_hwfn *p_hwfn, bool b_sleepable)
159159
{
160160
u8 num_vports, vf_offset = 0, i, vport_id, num_ports, curr_queue = 0;
161161
struct qed_qm_info *qm_info = &p_hwfn->qm_info;
162162
struct init_qm_port_params *p_qm_port;
163163
u16 num_pqs, multi_cos_tcs = 1;
164+
u8 pf_wfq = qm_info->pf_wfq;
165+
u32 pf_rl = qm_info->pf_rl;
164166
u16 num_vfs = 0;
165167

166168
#ifdef CONFIG_QED_SRIOV
@@ -182,23 +184,28 @@ static int qed_init_qm_info(struct qed_hwfn *p_hwfn)
182184

183185
/* PQs will be arranged as follows: First per-TC PQ then pure-LB quete.
184186
*/
185-
qm_info->qm_pq_params = kzalloc(sizeof(*qm_info->qm_pq_params) *
186-
num_pqs, GFP_KERNEL);
187+
qm_info->qm_pq_params = kcalloc(num_pqs,
188+
sizeof(struct init_qm_pq_params),
189+
b_sleepable ? GFP_KERNEL : GFP_ATOMIC);
187190
if (!qm_info->qm_pq_params)
188191
goto alloc_err;
189192

190-
qm_info->qm_vport_params = kzalloc(sizeof(*qm_info->qm_vport_params) *
191-
num_vports, GFP_KERNEL);
193+
qm_info->qm_vport_params = kcalloc(num_vports,
194+
sizeof(struct init_qm_vport_params),
195+
b_sleepable ? GFP_KERNEL
196+
: GFP_ATOMIC);
192197
if (!qm_info->qm_vport_params)
193198
goto alloc_err;
194199

195-
qm_info->qm_port_params = kzalloc(sizeof(*qm_info->qm_port_params) *
196-
MAX_NUM_PORTS, GFP_KERNEL);
200+
qm_info->qm_port_params = kcalloc(MAX_NUM_PORTS,
201+
sizeof(struct init_qm_port_params),
202+
b_sleepable ? GFP_KERNEL
203+
: GFP_ATOMIC);
197204
if (!qm_info->qm_port_params)
198205
goto alloc_err;
199206

200-
qm_info->wfq_data = kcalloc(num_vports, sizeof(*qm_info->wfq_data),
201-
GFP_KERNEL);
207+
qm_info->wfq_data = kcalloc(num_vports, sizeof(struct qed_wfq_data),
208+
b_sleepable ? GFP_KERNEL : GFP_ATOMIC);
202209
if (!qm_info->wfq_data)
203210
goto alloc_err;
204211

@@ -264,10 +271,10 @@ static int qed_init_qm_info(struct qed_hwfn *p_hwfn)
264271
for (i = 0; i < qm_info->num_vports; i++)
265272
qm_info->qm_vport_params[i].vport_wfq = 1;
266273

267-
qm_info->pf_wfq = 0;
268-
qm_info->pf_rl = 0;
269274
qm_info->vport_rl_en = 1;
270275
qm_info->vport_wfq_en = 1;
276+
qm_info->pf_rl = pf_rl;
277+
qm_info->pf_wfq = pf_wfq;
271278

272279
return 0;
273280

@@ -299,7 +306,7 @@ int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
299306
qed_qm_info_free(p_hwfn);
300307

301308
/* initialize qed's qm data structure */
302-
rc = qed_init_qm_info(p_hwfn);
309+
rc = qed_init_qm_info(p_hwfn, false);
303310
if (rc)
304311
return rc;
305312

@@ -388,7 +395,7 @@ int qed_resc_alloc(struct qed_dev *cdev)
388395
goto alloc_err;
389396

390397
/* Prepare and process QM requirements */
391-
rc = qed_init_qm_info(p_hwfn);
398+
rc = qed_init_qm_info(p_hwfn, true);
392399
if (rc)
393400
goto alloc_err;
394401

@@ -581,7 +588,14 @@ static void qed_calc_hw_mode(struct qed_hwfn *p_hwfn)
581588

582589
hw_mode |= 1 << MODE_ASIC;
583590

591+
if (p_hwfn->cdev->num_hwfns > 1)
592+
hw_mode |= 1 << MODE_100G;
593+
584594
p_hwfn->hw_info.hw_mode = hw_mode;
595+
596+
DP_VERBOSE(p_hwfn, (NETIF_MSG_PROBE | NETIF_MSG_IFUP),
597+
"Configuring function for hw_mode: 0x%08x\n",
598+
p_hwfn->hw_info.hw_mode);
585599
}
586600

587601
/* Init run time data for all PFs on an engine. */
@@ -821,6 +835,11 @@ int qed_hw_init(struct qed_dev *cdev,
821835
u32 load_code, param;
822836
int rc, mfw_rc, i;
823837

838+
if ((int_mode == QED_INT_MODE_MSI) && (cdev->num_hwfns > 1)) {
839+
DP_NOTICE(cdev, "MSI mode is not supported for CMT devices\n");
840+
return -EINVAL;
841+
}
842+
824843
if (IS_PF(cdev)) {
825844
rc = qed_init_fw_data(cdev, bin_fw_data);
826845
if (rc != 0)
@@ -2086,6 +2105,13 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate)
20862105
{
20872106
int i;
20882107

2108+
if (cdev->num_hwfns > 1) {
2109+
DP_VERBOSE(cdev,
2110+
NETIF_MSG_LINK,
2111+
"WFQ configuration is not supported for this device\n");
2112+
return;
2113+
}
2114+
20892115
for_each_hwfn(cdev, i) {
20902116
struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
20912117

drivers/net/ethernet/qlogic/qed/qed_main.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,15 +413,17 @@ static int qed_set_int_mode(struct qed_dev *cdev, bool force_mode)
413413
/* Fallthrough */
414414

415415
case QED_INT_MODE_MSI:
416-
rc = pci_enable_msi(cdev->pdev);
417-
if (!rc) {
418-
int_params->out.int_mode = QED_INT_MODE_MSI;
419-
goto out;
420-
}
416+
if (cdev->num_hwfns == 1) {
417+
rc = pci_enable_msi(cdev->pdev);
418+
if (!rc) {
419+
int_params->out.int_mode = QED_INT_MODE_MSI;
420+
goto out;
421+
}
421422

422-
DP_NOTICE(cdev, "Failed to enable MSI\n");
423-
if (force_mode)
424-
goto out;
423+
DP_NOTICE(cdev, "Failed to enable MSI\n");
424+
if (force_mode)
425+
goto out;
426+
}
425427
/* Fallthrough */
426428

427429
case QED_INT_MODE_INTA:

drivers/net/ethernet/qlogic/qede/qede_ethtool.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ static int qede_get_sset_count(struct net_device *dev, int stringset)
230230
case ETH_SS_PRIV_FLAGS:
231231
return QEDE_PRI_FLAG_LEN;
232232
case ETH_SS_TEST:
233-
return QEDE_ETHTOOL_TEST_MAX;
233+
if (!IS_VF(edev))
234+
return QEDE_ETHTOOL_TEST_MAX;
235+
else
236+
return 0;
234237
default:
235238
DP_VERBOSE(edev, QED_MSG_DEBUG,
236239
"Unsupported stringset 0x%08x\n", stringset);

drivers/net/ethernet/qlogic/qede/qede_main.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ static int qede_set_vf_rate(struct net_device *dev, int vfidx,
18241824
{
18251825
struct qede_dev *edev = netdev_priv(dev);
18261826

1827-
return edev->ops->iov->set_rate(edev->cdev, vfidx, max_tx_rate,
1827+
return edev->ops->iov->set_rate(edev->cdev, vfidx, min_tx_rate,
18281828
max_tx_rate);
18291829
}
18301830

@@ -2091,6 +2091,29 @@ static void qede_vlan_mark_nonconfigured(struct qede_dev *edev)
20912091
edev->accept_any_vlan = false;
20922092
}
20932093

2094+
int qede_set_features(struct net_device *dev, netdev_features_t features)
2095+
{
2096+
struct qede_dev *edev = netdev_priv(dev);
2097+
netdev_features_t changes = features ^ dev->features;
2098+
bool need_reload = false;
2099+
2100+
/* No action needed if hardware GRO is disabled during driver load */
2101+
if (changes & NETIF_F_GRO) {
2102+
if (dev->features & NETIF_F_GRO)
2103+
need_reload = !edev->gro_disable;
2104+
else
2105+
need_reload = edev->gro_disable;
2106+
}
2107+
2108+
if (need_reload && netif_running(edev->ndev)) {
2109+
dev->features = features;
2110+
qede_reload(edev, NULL, NULL);
2111+
return 1;
2112+
}
2113+
2114+
return 0;
2115+
}
2116+
20942117
#ifdef CONFIG_QEDE_VXLAN
20952118
static void qede_add_vxlan_port(struct net_device *dev,
20962119
sa_family_t sa_family, __be16 port)
@@ -2175,6 +2198,7 @@ static const struct net_device_ops qede_netdev_ops = {
21752198
#endif
21762199
.ndo_vlan_rx_add_vid = qede_vlan_rx_add_vid,
21772200
.ndo_vlan_rx_kill_vid = qede_vlan_rx_kill_vid,
2201+
.ndo_set_features = qede_set_features,
21782202
.ndo_get_stats64 = qede_get_stats64,
21792203
#ifdef CONFIG_QED_SRIOV
21802204
.ndo_set_vf_link_state = qede_set_vf_link_state,

0 commit comments

Comments
 (0)