diff options
author | Ido Schimmel <idosch@mellanox.com> | 2016-04-06 11:10:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-06 17:24:19 -0400 |
commit | 6f253d8381e9e7b8a254e7384b7d32ea5784e6e8 (patch) | |
tree | be1d200d74d83665e3aa52c27da84d17651f5a7c | |
parent | cc7cf5175807daa9cb51f6e0eb034f60ced6b251 (diff) |
mlxsw: reg: Add Port Flow Control Configuration register
Add the Port Flow Control Configuration (PFCC) register, which
configures both flow control and Priority-based Flow Control (PFC).
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/reg.h | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h index 2e58c41e90d4..b83514aeeb0f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/reg.h +++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h | |||
@@ -2319,6 +2319,135 @@ static inline void mlxsw_reg_paos_pack(char *payload, u8 local_port, | |||
2319 | mlxsw_reg_paos_e_set(payload, 1); | 2319 | mlxsw_reg_paos_e_set(payload, 1); |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | /* PFCC - Ports Flow Control Configuration Register | ||
2323 | * ------------------------------------------------ | ||
2324 | * Configures and retrieves the per port flow control configuration. | ||
2325 | */ | ||
2326 | #define MLXSW_REG_PFCC_ID 0x5007 | ||
2327 | #define MLXSW_REG_PFCC_LEN 0x20 | ||
2328 | |||
2329 | static const struct mlxsw_reg_info mlxsw_reg_pfcc = { | ||
2330 | .id = MLXSW_REG_PFCC_ID, | ||
2331 | .len = MLXSW_REG_PFCC_LEN, | ||
2332 | }; | ||
2333 | |||
2334 | /* reg_pfcc_local_port | ||
2335 | * Local port number. | ||
2336 | * Access: Index | ||
2337 | */ | ||
2338 | MLXSW_ITEM32(reg, pfcc, local_port, 0x00, 16, 8); | ||
2339 | |||
2340 | /* reg_pfcc_pnat | ||
2341 | * Port number access type. Determines the way local_port is interpreted: | ||
2342 | * 0 - Local port number. | ||
2343 | * 1 - IB / label port number. | ||
2344 | * Access: Index | ||
2345 | */ | ||
2346 | MLXSW_ITEM32(reg, pfcc, pnat, 0x00, 14, 2); | ||
2347 | |||
2348 | /* reg_pfcc_shl_cap | ||
2349 | * Send to higher layers capabilities: | ||
2350 | * 0 - No capability of sending Pause and PFC frames to higher layers. | ||
2351 | * 1 - Device has capability of sending Pause and PFC frames to higher | ||
2352 | * layers. | ||
2353 | * Access: RO | ||
2354 | */ | ||
2355 | MLXSW_ITEM32(reg, pfcc, shl_cap, 0x00, 1, 1); | ||
2356 | |||
2357 | /* reg_pfcc_shl_opr | ||
2358 | * Send to higher layers operation: | ||
2359 | * 0 - Pause and PFC frames are handled by the port (default). | ||
2360 | * 1 - Pause and PFC frames are handled by the port and also sent to | ||
2361 | * higher layers. Only valid if shl_cap = 1. | ||
2362 | * Access: RW | ||
2363 | */ | ||
2364 | MLXSW_ITEM32(reg, pfcc, shl_opr, 0x00, 0, 1); | ||
2365 | |||
2366 | /* reg_pfcc_ppan | ||
2367 | * Pause policy auto negotiation. | ||
2368 | * 0 - Disabled. Generate / ignore Pause frames based on pptx / pprtx. | ||
2369 | * 1 - Enabled. When auto-negotiation is performed, set the Pause policy | ||
2370 | * based on the auto-negotiation resolution. | ||
2371 | * Access: RW | ||
2372 | * | ||
2373 | * Note: The auto-negotiation advertisement is set according to pptx and | ||
2374 | * pprtx. When PFC is set on Tx / Rx, ppan must be set to 0. | ||
2375 | */ | ||
2376 | MLXSW_ITEM32(reg, pfcc, ppan, 0x04, 28, 4); | ||
2377 | |||
2378 | /* reg_pfcc_prio_mask_tx | ||
2379 | * Bit per priority indicating if Tx flow control policy should be | ||
2380 | * updated based on bit pfctx. | ||
2381 | * Access: WO | ||
2382 | */ | ||
2383 | MLXSW_ITEM32(reg, pfcc, prio_mask_tx, 0x04, 16, 8); | ||
2384 | |||
2385 | /* reg_pfcc_prio_mask_rx | ||
2386 | * Bit per priority indicating if Rx flow control policy should be | ||
2387 | * updated based on bit pfcrx. | ||
2388 | * Access: WO | ||
2389 | */ | ||
2390 | MLXSW_ITEM32(reg, pfcc, prio_mask_rx, 0x04, 0, 8); | ||
2391 | |||
2392 | /* reg_pfcc_pptx | ||
2393 | * Admin Pause policy on Tx. | ||
2394 | * 0 - Never generate Pause frames (default). | ||
2395 | * 1 - Generate Pause frames according to Rx buffer threshold. | ||
2396 | * Access: RW | ||
2397 | */ | ||
2398 | MLXSW_ITEM32(reg, pfcc, pptx, 0x08, 31, 1); | ||
2399 | |||
2400 | /* reg_pfcc_aptx | ||
2401 | * Active (operational) Pause policy on Tx. | ||
2402 | * 0 - Never generate Pause frames. | ||
2403 | * 1 - Generate Pause frames according to Rx buffer threshold. | ||
2404 | * Access: RO | ||
2405 | */ | ||
2406 | MLXSW_ITEM32(reg, pfcc, aptx, 0x08, 30, 1); | ||
2407 | |||
2408 | /* reg_pfcc_pfctx | ||
2409 | * Priority based flow control policy on Tx[7:0]. Per-priority bit mask: | ||
2410 | * 0 - Never generate priority Pause frames on the specified priority | ||
2411 | * (default). | ||
2412 | * 1 - Generate priority Pause frames according to Rx buffer threshold on | ||
2413 | * the specified priority. | ||
2414 | * Access: RW | ||
2415 | * | ||
2416 | * Note: pfctx and pptx must be mutually exclusive. | ||
2417 | */ | ||
2418 | MLXSW_ITEM32(reg, pfcc, pfctx, 0x08, 16, 8); | ||
2419 | |||
2420 | /* reg_pfcc_pprx | ||
2421 | * Admin Pause policy on Rx. | ||
2422 | * 0 - Ignore received Pause frames (default). | ||
2423 | * 1 - Respect received Pause frames. | ||
2424 | * Access: RW | ||
2425 | */ | ||
2426 | MLXSW_ITEM32(reg, pfcc, pprx, 0x0C, 31, 1); | ||
2427 | |||
2428 | /* reg_pfcc_aprx | ||
2429 | * Active (operational) Pause policy on Rx. | ||
2430 | * 0 - Ignore received Pause frames. | ||
2431 | * 1 - Respect received Pause frames. | ||
2432 | * Access: RO | ||
2433 | */ | ||
2434 | MLXSW_ITEM32(reg, pfcc, aprx, 0x0C, 30, 1); | ||
2435 | |||
2436 | /* reg_pfcc_pfcrx | ||
2437 | * Priority based flow control policy on Rx[7:0]. Per-priority bit mask: | ||
2438 | * 0 - Ignore incoming priority Pause frames on the specified priority | ||
2439 | * (default). | ||
2440 | * 1 - Respect incoming priority Pause frames on the specified priority. | ||
2441 | * Access: RW | ||
2442 | */ | ||
2443 | MLXSW_ITEM32(reg, pfcc, pfcrx, 0x0C, 16, 8); | ||
2444 | |||
2445 | static inline void mlxsw_reg_pfcc_pack(char *payload, u8 local_port) | ||
2446 | { | ||
2447 | MLXSW_REG_ZERO(pfcc, payload); | ||
2448 | mlxsw_reg_pfcc_local_port_set(payload, local_port); | ||
2449 | } | ||
2450 | |||
2322 | /* PPCNT - Ports Performance Counters Register | 2451 | /* PPCNT - Ports Performance Counters Register |
2323 | * ------------------------------------------- | 2452 | * ------------------------------------------- |
2324 | * The PPCNT register retrieves per port performance counters. | 2453 | * The PPCNT register retrieves per port performance counters. |
@@ -3558,6 +3687,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id) | |||
3558 | return "PPAD"; | 3687 | return "PPAD"; |
3559 | case MLXSW_REG_PAOS_ID: | 3688 | case MLXSW_REG_PAOS_ID: |
3560 | return "PAOS"; | 3689 | return "PAOS"; |
3690 | case MLXSW_REG_PFCC_ID: | ||
3691 | return "PFCC"; | ||
3561 | case MLXSW_REG_PPCNT_ID: | 3692 | case MLXSW_REG_PPCNT_ID: |
3562 | return "PPCNT"; | 3693 | return "PPCNT"; |
3563 | case MLXSW_REG_PPTB_ID: | 3694 | case MLXSW_REG_PPTB_ID: |