| 2367 | } |
| 2368 | |
| 2369 | int t4_sge_init(struct adapter *adap) |
| 2370 | { |
| 2371 | struct sge *s = &adap->sge; |
| 2372 | u32 sge_control, sge_conm_ctrl; |
| 2373 | int ret, egress_threshold; |
| 2374 | |
| 2375 | /* |
| 2376 | * Ingress Padding Boundary and Egress Status Page Size are set up by |
| 2377 | * t4_fixup_host_params(). |
| 2378 | */ |
| 2379 | sge_control = t4_read_reg(adap, A_SGE_CONTROL); |
| 2380 | s->pktshift = G_PKTSHIFT(sge_control); |
| 2381 | s->stat_len = (sge_control & F_EGRSTATUSPAGESIZE) ? 128 : 64; |
| 2382 | ret = t4_sge_init_soft(adap); |
| 2383 | if (ret < 0) { |
| 2384 | dev_err(adap, "%s: t4_sge_init_soft failed, error %d\n", |
| 2385 | __func__, -ret); |
| 2386 | return ret; |
| 2387 | } |
| 2388 | |
| 2389 | /* |
| 2390 | * A FL with <= fl_starve_thres buffers is starving and a periodic |
| 2391 | * timer will attempt to refill it. This needs to be larger than the |
| 2392 | * SGE's Egress Congestion Threshold. If it isn't, then we can get |
| 2393 | * stuck waiting for new packets while the SGE is waiting for us to |
| 2394 | * give it more Free List entries. (Note that the SGE's Egress |
| 2395 | * Congestion Threshold is in units of 2 Free List pointers.) For T4, |
| 2396 | * there was only a single field to control this. For T5 there's the |
| 2397 | * original field which now only applies to Unpacked Mode Free List |
| 2398 | * buffers and a new field which only applies to Packed Mode Free List |
| 2399 | * buffers. |
| 2400 | */ |
| 2401 | sge_conm_ctrl = t4_read_reg(adap, A_SGE_CONM_CTRL); |
| 2402 | if (is_t4(adap->params.chip) || adap->use_unpacked_mode) |
| 2403 | egress_threshold = G_EGRTHRESHOLD(sge_conm_ctrl); |
| 2404 | else |
| 2405 | egress_threshold = G_EGRTHRESHOLDPACKING(sge_conm_ctrl); |
| 2406 | s->fl_starve_thres = 2 * egress_threshold + 1; |
| 2407 | |
| 2408 | return 0; |
| 2409 | } |
| 2410 | |
| 2411 | int t4vf_sge_init(struct adapter *adap) |
| 2412 | { |
no test coverage detected