mlx5_en_ethtool.c revision 347806
1290650Shselasky/*- 2290650Shselasky * Copyright (c) 2015 Mellanox Technologies. All rights reserved. 3290650Shselasky * 4290650Shselasky * Redistribution and use in source and binary forms, with or without 5290650Shselasky * modification, are permitted provided that the following conditions 6290650Shselasky * are met: 7290650Shselasky * 1. Redistributions of source code must retain the above copyright 8290650Shselasky * notice, this list of conditions and the following disclaimer. 9290650Shselasky * 2. Redistributions in binary form must reproduce the above copyright 10290650Shselasky * notice, this list of conditions and the following disclaimer in the 11290650Shselasky * documentation and/or other materials provided with the distribution. 12290650Shselasky * 13290650Shselasky * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND 14290650Shselasky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15290650Shselasky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16290650Shselasky * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 17290650Shselasky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18290650Shselasky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19290650Shselasky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20290650Shselasky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21290650Shselasky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22290650Shselasky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23290650Shselasky * SUCH DAMAGE. 24290650Shselasky * 25290650Shselasky * $FreeBSD: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c 347806 2019-05-16 17:17:52Z hselasky $ 26290650Shselasky */ 27290650Shselasky 28290650Shselasky#include "en.h" 29290650Shselasky#include <net/sff8472.h> 30290650Shselasky 31290650Shselaskyvoid 32290650Shselaskymlx5e_create_stats(struct sysctl_ctx_list *ctx, 33290650Shselasky struct sysctl_oid_list *parent, const char *buffer, 34290650Shselasky const char **desc, unsigned num, u64 * arg) 35290650Shselasky{ 36290650Shselasky struct sysctl_oid *node; 37290650Shselasky unsigned x; 38290650Shselasky 39290650Shselasky sysctl_ctx_init(ctx); 40290650Shselasky 41290650Shselasky node = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, 42290650Shselasky buffer, CTLFLAG_RD, NULL, "Statistics"); 43290650Shselasky if (node == NULL) 44290650Shselasky return; 45290650Shselasky for (x = 0; x != num; x++) { 46290650Shselasky SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, 47290650Shselasky desc[2 * x], CTLFLAG_RD, arg + x, desc[2 * x + 1]); 48290650Shselasky } 49290650Shselasky} 50290650Shselasky 51300277Shselaskystatic void 52300277Shselaskymlx5e_ethtool_sync_tx_completion_fact(struct mlx5e_priv *priv) 53300277Shselasky{ 54300277Shselasky /* 55300277Shselasky * Limit the maximum distance between completion events to 56300277Shselasky * half of the currently set TX queue size. 57300277Shselasky * 58300277Shselasky * The maximum number of queue entries a single IP packet can 59300277Shselasky * consume is given by MLX5_SEND_WQE_MAX_WQEBBS. 60300277Shselasky * 61300277Shselasky * The worst case max value is then given as below: 62300277Shselasky */ 63300277Shselasky uint64_t max = priv->params_ethtool.tx_queue_size / 64300277Shselasky (2 * MLX5_SEND_WQE_MAX_WQEBBS); 65300277Shselasky 66300277Shselasky /* 67300277Shselasky * Update the maximum completion factor value in case the 68300277Shselasky * tx_queue_size field changed. Ensure we don't overflow 69300277Shselasky * 16-bits. 70300277Shselasky */ 71300277Shselasky if (max < 1) 72300277Shselasky max = 1; 73300277Shselasky else if (max > 65535) 74300277Shselasky max = 65535; 75300277Shselasky priv->params_ethtool.tx_completion_fact_max = max; 76300277Shselasky 77300277Shselasky /* 78300277Shselasky * Verify that the current TX completion factor is within the 79300277Shselasky * given limits: 80300277Shselasky */ 81300277Shselasky if (priv->params_ethtool.tx_completion_fact < 1) 82300277Shselasky priv->params_ethtool.tx_completion_fact = 1; 83300277Shselasky else if (priv->params_ethtool.tx_completion_fact > max) 84300277Shselasky priv->params_ethtool.tx_completion_fact = max; 85300277Shselasky} 86300277Shselasky 87331577Shselaskystatic int 88331577Shselaskymlx5e_getmaxrate(struct mlx5e_priv *priv) 89331577Shselasky{ 90331577Shselasky struct mlx5_core_dev *mdev = priv->mdev; 91331577Shselasky u8 max_bw_unit[IEEE_8021QAZ_MAX_TCS]; 92331577Shselasky u8 max_bw_value[IEEE_8021QAZ_MAX_TCS]; 93331577Shselasky int err; 94331577Shselasky int i; 95331577Shselasky 96331577Shselasky PRIV_LOCK(priv); 97331577Shselasky err = -mlx5_query_port_tc_rate_limit(mdev, max_bw_value, max_bw_unit); 98331577Shselasky if (err) 99331577Shselasky goto done; 100331577Shselasky 101331577Shselasky for (i = 0; i <= mlx5_max_tc(mdev); i++) { 102331577Shselasky switch (max_bw_unit[i]) { 103331577Shselasky case MLX5_100_MBPS_UNIT: 104331577Shselasky priv->params_ethtool.max_bw_value[i] = max_bw_value[i] * MLX5E_100MB; 105331577Shselasky break; 106331577Shselasky case MLX5_GBPS_UNIT: 107331577Shselasky priv->params_ethtool.max_bw_value[i] = max_bw_value[i] * MLX5E_1GB; 108331577Shselasky break; 109331577Shselasky case MLX5_BW_NO_LIMIT: 110331577Shselasky priv->params_ethtool.max_bw_value[i] = 0; 111331577Shselasky break; 112331577Shselasky default: 113331577Shselasky priv->params_ethtool.max_bw_value[i] = -1; 114331577Shselasky WARN_ONCE(true, "non-supported BW unit"); 115331577Shselasky break; 116331577Shselasky } 117331577Shselasky } 118331577Shselaskydone: 119331577Shselasky PRIV_UNLOCK(priv); 120331577Shselasky return (err); 121331577Shselasky} 122331577Shselasky 123331577Shselaskystatic int 124341968Shselaskymlx5e_get_max_alloc(struct mlx5e_priv *priv) 125341968Shselasky{ 126341968Shselasky struct mlx5_core_dev *mdev = priv->mdev; 127341968Shselasky int err; 128341968Shselasky int x; 129341968Shselasky 130341968Shselasky PRIV_LOCK(priv); 131341968Shselasky err = -mlx5_query_port_tc_bw_alloc(mdev, priv->params_ethtool.max_bw_share); 132341968Shselasky if (err == 0) { 133341968Shselasky /* set default value */ 134341968Shselasky for (x = 0; x != IEEE_8021QAZ_MAX_TCS; x++) { 135341968Shselasky priv->params_ethtool.max_bw_share[x] = 136341968Shselasky 100 / IEEE_8021QAZ_MAX_TCS; 137341968Shselasky } 138341968Shselasky err = -mlx5_set_port_tc_bw_alloc(mdev, 139341968Shselasky priv->params_ethtool.max_bw_share); 140341968Shselasky } 141341968Shselasky PRIV_UNLOCK(priv); 142341968Shselasky 143341968Shselasky return (err); 144341968Shselasky} 145341968Shselasky 146341968Shselaskystatic int 147337098Shselaskymlx5e_get_dscp(struct mlx5e_priv *priv) 148337098Shselasky{ 149337098Shselasky struct mlx5_core_dev *mdev = priv->mdev; 150337098Shselasky int err; 151337098Shselasky 152337098Shselasky if (MLX5_CAP_GEN(mdev, qcam_reg) == 0 || 153337098Shselasky MLX5_CAP_QCAM_REG(mdev, qpts) == 0 || 154337098Shselasky MLX5_CAP_QCAM_REG(mdev, qpdpm) == 0) 155337098Shselasky return (EOPNOTSUPP); 156337098Shselasky 157337098Shselasky PRIV_LOCK(priv); 158337098Shselasky err = -mlx5_query_dscp2prio(mdev, priv->params_ethtool.dscp2prio); 159337098Shselasky if (err) 160337098Shselasky goto done; 161337098Shselasky 162337098Shselasky err = -mlx5_query_trust_state(mdev, &priv->params_ethtool.trust_state); 163337098Shselasky if (err) 164337098Shselasky goto done; 165337098Shselaskydone: 166337098Shselasky PRIV_UNLOCK(priv); 167337098Shselasky return (err); 168337098Shselasky} 169337098Shselasky 170341968Shselaskystatic void 171341968Shselaskymlx5e_tc_get_parameters(struct mlx5e_priv *priv, 172341968Shselasky u64 *new_bw_value, u8 *max_bw_value, u8 *max_bw_unit) 173341968Shselasky{ 174341968Shselasky const u64 upper_limit_mbps = 255 * MLX5E_100MB; 175341968Shselasky const u64 upper_limit_gbps = 255 * MLX5E_1GB; 176341968Shselasky u64 temp; 177341968Shselasky int i; 178341968Shselasky 179341968Shselasky memset(max_bw_value, 0, IEEE_8021QAZ_MAX_TCS); 180341968Shselasky memset(max_bw_unit, 0, IEEE_8021QAZ_MAX_TCS); 181341968Shselasky 182341968Shselasky for (i = 0; i <= mlx5_max_tc(priv->mdev); i++) { 183341968Shselasky temp = (new_bw_value != NULL) ? 184341968Shselasky new_bw_value[i] : priv->params_ethtool.max_bw_value[i]; 185341968Shselasky 186341968Shselasky if (!temp) { 187341968Shselasky max_bw_unit[i] = MLX5_BW_NO_LIMIT; 188341968Shselasky } else if (temp > upper_limit_gbps) { 189341968Shselasky max_bw_unit[i] = MLX5_BW_NO_LIMIT; 190341968Shselasky } else if (temp <= upper_limit_mbps) { 191341968Shselasky max_bw_value[i] = howmany(temp, MLX5E_100MB); 192341968Shselasky max_bw_unit[i] = MLX5_100_MBPS_UNIT; 193341968Shselasky } else { 194341968Shselasky max_bw_value[i] = howmany(temp, MLX5E_1GB); 195341968Shselasky max_bw_unit[i] = MLX5_GBPS_UNIT; 196341968Shselasky } 197341968Shselasky } 198341968Shselasky} 199341968Shselasky 200337098Shselaskystatic int 201331577Shselaskymlx5e_tc_maxrate_handler(SYSCTL_HANDLER_ARGS) 202331577Shselasky{ 203331577Shselasky struct mlx5e_priv *priv = arg1; 204331577Shselasky struct mlx5_core_dev *mdev = priv->mdev; 205331577Shselasky u8 max_bw_unit[IEEE_8021QAZ_MAX_TCS]; 206331577Shselasky u8 max_bw_value[IEEE_8021QAZ_MAX_TCS]; 207341968Shselasky u64 new_bw_value[IEEE_8021QAZ_MAX_TCS]; 208341968Shselasky u8 max_rates = mlx5_max_tc(mdev) + 1; 209341968Shselasky u8 x; 210341968Shselasky int err; 211331577Shselasky 212331577Shselasky PRIV_LOCK(priv); 213341968Shselasky err = SYSCTL_OUT(req, priv->params_ethtool.max_bw_value, 214341968Shselasky sizeof(priv->params_ethtool.max_bw_value[0]) * max_rates); 215341968Shselasky if (err || !req->newptr) 216331577Shselasky goto done; 217341968Shselasky err = SYSCTL_IN(req, new_bw_value, 218341968Shselasky sizeof(new_bw_value[0]) * max_rates); 219341968Shselasky if (err) 220341968Shselasky goto done; 221331577Shselasky 222341968Shselasky /* range check input value */ 223341968Shselasky for (x = 0; x != max_rates; x++) { 224341968Shselasky if (new_bw_value[x] % MLX5E_100MB) { 225341968Shselasky err = ERANGE; 226341968Shselasky goto done; 227341968Shselasky } 228331577Shselasky } 229331577Shselasky 230341968Shselasky mlx5e_tc_get_parameters(priv, new_bw_value, max_bw_value, max_bw_unit); 231331577Shselasky 232341968Shselasky err = -mlx5_modify_port_tc_rate_limit(mdev, max_bw_value, max_bw_unit); 233341968Shselasky if (err) 234341968Shselasky goto done; 235331577Shselasky 236341968Shselasky memcpy(priv->params_ethtool.max_bw_value, new_bw_value, 237341968Shselasky sizeof(priv->params_ethtool.max_bw_value)); 238341968Shselaskydone: 239341968Shselasky PRIV_UNLOCK(priv); 240341968Shselasky return (err); 241341968Shselasky} 242341968Shselasky 243341968Shselaskystatic int 244341968Shselaskymlx5e_tc_rate_share_handler(SYSCTL_HANDLER_ARGS) 245341968Shselasky{ 246341968Shselasky struct mlx5e_priv *priv = arg1; 247341968Shselasky struct mlx5_core_dev *mdev = priv->mdev; 248341968Shselasky u8 max_bw_share[IEEE_8021QAZ_MAX_TCS]; 249341968Shselasky u8 max_rates = mlx5_max_tc(mdev) + 1; 250341968Shselasky int i; 251341968Shselasky int err; 252341968Shselasky int sum; 253341968Shselasky 254341968Shselasky PRIV_LOCK(priv); 255341968Shselasky err = SYSCTL_OUT(req, priv->params_ethtool.max_bw_share, max_rates); 256341968Shselasky if (err || !req->newptr) 257341968Shselasky goto done; 258341968Shselasky err = SYSCTL_IN(req, max_bw_share, max_rates); 259341968Shselasky if (err) 260341968Shselasky goto done; 261341968Shselasky 262341968Shselasky /* range check input value */ 263341968Shselasky for (sum = i = 0; i != max_rates; i++) { 264341968Shselasky if (max_bw_share[i] < 1 || max_bw_share[i] > 100) { 265341968Shselasky err = ERANGE; 266341968Shselasky goto done; 267331577Shselasky } 268341968Shselasky sum += max_bw_share[i]; 269331577Shselasky } 270331577Shselasky 271341968Shselasky /* sum of values should be as close to 100 as possible */ 272341968Shselasky if (sum < (100 - max_rates + 1) || sum > 100) { 273341968Shselasky err = ERANGE; 274341968Shselasky goto done; 275341968Shselasky } 276341968Shselasky 277341968Shselasky err = -mlx5_set_port_tc_bw_alloc(mdev, max_bw_share); 278331577Shselasky if (err) 279331577Shselasky goto done; 280331577Shselasky 281341968Shselasky memcpy(priv->params_ethtool.max_bw_share, max_bw_share, 282341968Shselasky sizeof(priv->params_ethtool.max_bw_share)); 283331577Shselaskydone: 284331577Shselasky PRIV_UNLOCK(priv); 285331577Shselasky return (err); 286331577Shselasky} 287331577Shselasky 288331578Shselaskystatic int 289331578Shselaskymlx5e_get_prio_tc(struct mlx5e_priv *priv) 290331578Shselasky{ 291331578Shselasky struct mlx5_core_dev *mdev = priv->mdev; 292331578Shselasky int err = 0; 293331578Shselasky int i; 294331578Shselasky 295331578Shselasky PRIV_LOCK(priv); 296331578Shselasky if (!MLX5_CAP_GEN(priv->mdev, ets)) { 297331578Shselasky PRIV_UNLOCK(priv); 298331578Shselasky return (EOPNOTSUPP); 299331578Shselasky } 300331578Shselasky 301331578Shselasky for (i = 0; i <= mlx5_max_tc(priv->mdev); i++) { 302331578Shselasky err = -mlx5_query_port_prio_tc(mdev, i, &(priv->params_ethtool.prio_tc[i])); 303331578Shselasky if (err) 304331578Shselasky break; 305331578Shselasky } 306331578Shselasky PRIV_UNLOCK(priv); 307331578Shselasky return (err); 308331578Shselasky} 309331578Shselasky 310331578Shselaskystatic int 311331578Shselaskymlx5e_prio_to_tc_handler(SYSCTL_HANDLER_ARGS) 312331578Shselasky{ 313331578Shselasky struct mlx5e_priv *priv = arg1; 314331578Shselasky int prio_index = arg2; 315331578Shselasky struct mlx5_core_dev *mdev = priv->mdev; 316331578Shselasky int err; 317341968Shselasky uint8_t result; 318331578Shselasky 319331578Shselasky PRIV_LOCK(priv); 320341968Shselasky result = priv->params_ethtool.prio_tc[prio_index]; 321331578Shselasky err = sysctl_handle_8(oidp, &result, 0, req); 322331578Shselasky if (err || !req->newptr || 323331578Shselasky result == priv->params_ethtool.prio_tc[prio_index]) 324331578Shselasky goto done; 325331578Shselasky 326331578Shselasky if (result > mlx5_max_tc(mdev)) { 327331578Shselasky err = ERANGE; 328331578Shselasky goto done; 329331578Shselasky } 330331578Shselasky 331331578Shselasky err = -mlx5_set_port_prio_tc(mdev, prio_index, result); 332331578Shselasky if (err) 333331578Shselasky goto done; 334331578Shselasky 335331578Shselasky priv->params_ethtool.prio_tc[prio_index] = result; 336331578Shselasky 337331578Shselaskydone: 338331578Shselasky PRIV_UNLOCK(priv); 339331578Shselasky return (err); 340331578Shselasky} 341331578Shselasky 342337098Shselaskystatic int 343337098Shselaskymlx5e_trust_state_handler(SYSCTL_HANDLER_ARGS) 344337098Shselasky{ 345337098Shselasky struct mlx5e_priv *priv = arg1; 346337098Shselasky struct mlx5_core_dev *mdev = priv->mdev; 347337098Shselasky int err; 348337098Shselasky u8 result; 349337098Shselasky 350337098Shselasky PRIV_LOCK(priv); 351337098Shselasky result = priv->params_ethtool.trust_state; 352337098Shselasky err = sysctl_handle_8(oidp, &result, 0, req); 353337098Shselasky if (err || !req->newptr || 354337098Shselasky result == priv->params_ethtool.trust_state) 355337098Shselasky goto done; 356337098Shselasky 357337098Shselasky switch (result) { 358337098Shselasky case MLX5_QPTS_TRUST_PCP: 359337098Shselasky case MLX5_QPTS_TRUST_DSCP: 360337098Shselasky break; 361337098Shselasky case MLX5_QPTS_TRUST_BOTH: 362337098Shselasky if (!MLX5_CAP_QCAM_FEATURE(mdev, qpts_trust_both)) { 363337098Shselasky err = EOPNOTSUPP; 364337098Shselasky goto done; 365337098Shselasky } 366337098Shselasky break; 367337098Shselasky default: 368337098Shselasky err = ERANGE; 369337098Shselasky goto done; 370337098Shselasky } 371337098Shselasky 372337098Shselasky err = -mlx5_set_trust_state(mdev, result); 373337098Shselasky if (err) 374337098Shselasky goto done; 375337098Shselasky 376337098Shselasky priv->params_ethtool.trust_state = result; 377341972Shselasky 378341972Shselasky /* update inline mode */ 379341972Shselasky mlx5e_refresh_sq_inline(priv); 380341972Shselasky#ifdef RATELIMIT 381341972Shselasky mlx5e_rl_refresh_sq_inline(&priv->rl); 382341972Shselasky#endif 383337098Shselaskydone: 384337098Shselasky PRIV_UNLOCK(priv); 385337098Shselasky return (err); 386337098Shselasky} 387337098Shselasky 388337098Shselaskystatic int 389337098Shselaskymlx5e_dscp_prio_handler(SYSCTL_HANDLER_ARGS) 390337098Shselasky{ 391337098Shselasky struct mlx5e_priv *priv = arg1; 392337098Shselasky int prio_index = arg2; 393337098Shselasky struct mlx5_core_dev *mdev = priv->mdev; 394337098Shselasky uint8_t dscp2prio[MLX5_MAX_SUPPORTED_DSCP]; 395337098Shselasky uint8_t x; 396337098Shselasky int err; 397337098Shselasky 398337098Shselasky PRIV_LOCK(priv); 399337098Shselasky err = SYSCTL_OUT(req, priv->params_ethtool.dscp2prio + prio_index, 400337098Shselasky sizeof(priv->params_ethtool.dscp2prio) / 8); 401337098Shselasky if (err || !req->newptr) 402337098Shselasky goto done; 403337098Shselasky 404337098Shselasky memcpy(dscp2prio, priv->params_ethtool.dscp2prio, sizeof(dscp2prio)); 405337098Shselasky err = SYSCTL_IN(req, dscp2prio + prio_index, sizeof(dscp2prio) / 8); 406337098Shselasky if (err) 407337098Shselasky goto done; 408337098Shselasky for (x = 0; x != MLX5_MAX_SUPPORTED_DSCP; x++) { 409337098Shselasky if (dscp2prio[x] > 7) { 410337098Shselasky err = ERANGE; 411337098Shselasky goto done; 412337098Shselasky } 413337098Shselasky } 414337098Shselasky err = -mlx5_set_dscp2prio(mdev, dscp2prio); 415337098Shselasky if (err) 416337098Shselasky goto done; 417337098Shselasky 418337098Shselasky /* update local array */ 419337098Shselasky memcpy(priv->params_ethtool.dscp2prio, dscp2prio, 420337098Shselasky sizeof(priv->params_ethtool.dscp2prio)); 421337098Shselaskydone: 422337098Shselasky PRIV_UNLOCK(priv); 423337098Shselasky return (err); 424337098Shselasky} 425337098Shselasky 426300282Shselasky#define MLX5_PARAM_OFFSET(n) \ 427300282Shselasky __offsetof(struct mlx5e_priv, params_ethtool.n) 428300282Shselasky 429290650Shselaskystatic int 430290650Shselaskymlx5e_ethtool_handler(SYSCTL_HANDLER_ARGS) 431290650Shselasky{ 432290650Shselasky struct mlx5e_priv *priv = arg1; 433290650Shselasky uint64_t value; 434321995Shselasky int mode_modify; 435290650Shselasky int was_opened; 436290650Shselasky int error; 437290650Shselasky 438290650Shselasky PRIV_LOCK(priv); 439290650Shselasky value = priv->params_ethtool.arg[arg2]; 440292837Shselasky if (req != NULL) { 441292837Shselasky error = sysctl_handle_64(oidp, &value, 0, req); 442292837Shselasky if (error || req->newptr == NULL || 443292837Shselasky value == priv->params_ethtool.arg[arg2]) 444292837Shselasky goto done; 445290650Shselasky 446292837Shselasky /* assign new value */ 447292837Shselasky priv->params_ethtool.arg[arg2] = value; 448292837Shselasky } else { 449292837Shselasky error = 0; 450292837Shselasky } 451290650Shselasky /* check if device is gone */ 452290650Shselasky if (priv->gone) { 453290650Shselasky error = ENXIO; 454290650Shselasky goto done; 455290650Shselasky } 456300282Shselasky was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state); 457321995Shselasky mode_modify = MLX5_CAP_GEN(priv->mdev, cq_period_mode_modify); 458290650Shselasky 459300282Shselasky switch (MLX5_PARAM_OFFSET(arg[arg2])) { 460300282Shselasky case MLX5_PARAM_OFFSET(rx_coalesce_usecs): 461300282Shselasky /* import RX coal time */ 462300282Shselasky if (priv->params_ethtool.rx_coalesce_usecs < 1) 463300282Shselasky priv->params_ethtool.rx_coalesce_usecs = 0; 464300282Shselasky else if (priv->params_ethtool.rx_coalesce_usecs > 465300282Shselasky MLX5E_FLD_MAX(cqc, cq_period)) { 466300282Shselasky priv->params_ethtool.rx_coalesce_usecs = 467300282Shselasky MLX5E_FLD_MAX(cqc, cq_period); 468300282Shselasky } 469300282Shselasky priv->params.rx_cq_moderation_usec = 470300282Shselasky priv->params_ethtool.rx_coalesce_usecs; 471292949Shselasky 472300282Shselasky /* check to avoid down and up the network interface */ 473300282Shselasky if (was_opened) 474300282Shselasky error = mlx5e_refresh_channel_params(priv); 475300282Shselasky break; 476292949Shselasky 477300282Shselasky case MLX5_PARAM_OFFSET(rx_coalesce_pkts): 478300282Shselasky /* import RX coal pkts */ 479300282Shselasky if (priv->params_ethtool.rx_coalesce_pkts < 1) 480300282Shselasky priv->params_ethtool.rx_coalesce_pkts = 0; 481300282Shselasky else if (priv->params_ethtool.rx_coalesce_pkts > 482300282Shselasky MLX5E_FLD_MAX(cqc, cq_max_count)) { 483300282Shselasky priv->params_ethtool.rx_coalesce_pkts = 484300282Shselasky MLX5E_FLD_MAX(cqc, cq_max_count); 485300282Shselasky } 486300282Shselasky priv->params.rx_cq_moderation_pkts = 487300282Shselasky priv->params_ethtool.rx_coalesce_pkts; 488292949Shselasky 489300282Shselasky /* check to avoid down and up the network interface */ 490300282Shselasky if (was_opened) 491300282Shselasky error = mlx5e_refresh_channel_params(priv); 492300282Shselasky break; 493292949Shselasky 494300282Shselasky case MLX5_PARAM_OFFSET(tx_coalesce_usecs): 495300282Shselasky /* import TX coal time */ 496300282Shselasky if (priv->params_ethtool.tx_coalesce_usecs < 1) 497300282Shselasky priv->params_ethtool.tx_coalesce_usecs = 0; 498300282Shselasky else if (priv->params_ethtool.tx_coalesce_usecs > 499300282Shselasky MLX5E_FLD_MAX(cqc, cq_period)) { 500300282Shselasky priv->params_ethtool.tx_coalesce_usecs = 501300282Shselasky MLX5E_FLD_MAX(cqc, cq_period); 502300282Shselasky } 503300282Shselasky priv->params.tx_cq_moderation_usec = 504300282Shselasky priv->params_ethtool.tx_coalesce_usecs; 505300282Shselasky 506300282Shselasky /* check to avoid down and up the network interface */ 507300282Shselasky if (was_opened) 508292949Shselasky error = mlx5e_refresh_channel_params(priv); 509300282Shselasky break; 510300282Shselasky 511300282Shselasky case MLX5_PARAM_OFFSET(tx_coalesce_pkts): 512300282Shselasky /* import TX coal pkts */ 513300282Shselasky if (priv->params_ethtool.tx_coalesce_pkts < 1) 514300282Shselasky priv->params_ethtool.tx_coalesce_pkts = 0; 515300282Shselasky else if (priv->params_ethtool.tx_coalesce_pkts > 516300282Shselasky MLX5E_FLD_MAX(cqc, cq_max_count)) { 517300282Shselasky priv->params_ethtool.tx_coalesce_pkts = 518300282Shselasky MLX5E_FLD_MAX(cqc, cq_max_count); 519292949Shselasky } 520300282Shselasky priv->params.tx_cq_moderation_pkts = 521300282Shselasky priv->params_ethtool.tx_coalesce_pkts; 522300282Shselasky 523300282Shselasky /* check to avoid down and up the network interface */ 524300282Shselasky if (was_opened) 525300282Shselasky error = mlx5e_refresh_channel_params(priv); 526300282Shselasky break; 527300282Shselasky 528300282Shselasky case MLX5_PARAM_OFFSET(tx_queue_size): 529300282Shselasky /* network interface must be down */ 530300282Shselasky if (was_opened) 531300282Shselasky mlx5e_close_locked(priv->ifp); 532300282Shselasky 533300282Shselasky /* import TX queue size */ 534300282Shselasky if (priv->params_ethtool.tx_queue_size < 535300282Shselasky (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) { 536300282Shselasky priv->params_ethtool.tx_queue_size = 537300282Shselasky (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE); 538300282Shselasky } else if (priv->params_ethtool.tx_queue_size > 539300282Shselasky priv->params_ethtool.tx_queue_size_max) { 540300282Shselasky priv->params_ethtool.tx_queue_size = 541300282Shselasky priv->params_ethtool.tx_queue_size_max; 542300282Shselasky } 543300282Shselasky /* store actual TX queue size */ 544300282Shselasky priv->params.log_sq_size = 545300282Shselasky order_base_2(priv->params_ethtool.tx_queue_size); 546290650Shselasky priv->params_ethtool.tx_queue_size = 547300282Shselasky 1 << priv->params.log_sq_size; 548290650Shselasky 549300282Shselasky /* verify TX completion factor */ 550300282Shselasky mlx5e_ethtool_sync_tx_completion_fact(priv); 551300282Shselasky 552300282Shselasky /* restart network interface, if any */ 553300282Shselasky if (was_opened) 554300282Shselasky mlx5e_open_locked(priv->ifp); 555300282Shselasky break; 556300282Shselasky 557300282Shselasky case MLX5_PARAM_OFFSET(rx_queue_size): 558300282Shselasky /* network interface must be down */ 559300282Shselasky if (was_opened) 560300282Shselasky mlx5e_close_locked(priv->ifp); 561300282Shselasky 562300282Shselasky /* import RX queue size */ 563300282Shselasky if (priv->params_ethtool.rx_queue_size < 564300282Shselasky (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)) { 565300282Shselasky priv->params_ethtool.rx_queue_size = 566300282Shselasky (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE); 567300282Shselasky } else if (priv->params_ethtool.rx_queue_size > 568300282Shselasky priv->params_ethtool.rx_queue_size_max) { 569300282Shselasky priv->params_ethtool.rx_queue_size = 570300282Shselasky priv->params_ethtool.rx_queue_size_max; 571300282Shselasky } 572300282Shselasky /* store actual RX queue size */ 573300282Shselasky priv->params.log_rq_size = 574300282Shselasky order_base_2(priv->params_ethtool.rx_queue_size); 575290650Shselasky priv->params_ethtool.rx_queue_size = 576300282Shselasky 1 << priv->params.log_rq_size; 577290650Shselasky 578300282Shselasky /* update least number of RX WQEs */ 579300282Shselasky priv->params.min_rx_wqes = min( 580300282Shselasky priv->params_ethtool.rx_queue_size - 1, 581300282Shselasky MLX5E_PARAMS_DEFAULT_MIN_RX_WQES); 582290650Shselasky 583300282Shselasky /* restart network interface, if any */ 584300282Shselasky if (was_opened) 585300282Shselasky mlx5e_open_locked(priv->ifp); 586300282Shselasky break; 587290650Shselasky 588338552Shselasky case MLX5_PARAM_OFFSET(channels_rsss): 589338552Shselasky /* network interface must be down */ 590338552Shselasky if (was_opened) 591338552Shselasky mlx5e_close_locked(priv->ifp); 592338552Shselasky 593338552Shselasky /* import number of channels */ 594338552Shselasky if (priv->params_ethtool.channels_rsss < 1) 595338552Shselasky priv->params_ethtool.channels_rsss = 1; 596338552Shselasky else if (priv->params_ethtool.channels_rsss > 128) 597338552Shselasky priv->params_ethtool.channels_rsss = 128; 598338552Shselasky 599338552Shselasky priv->params.channels_rsss = priv->params_ethtool.channels_rsss; 600338552Shselasky 601338552Shselasky /* restart network interface, if any */ 602338552Shselasky if (was_opened) 603338552Shselasky mlx5e_open_locked(priv->ifp); 604338552Shselasky break; 605338552Shselasky 606300282Shselasky case MLX5_PARAM_OFFSET(channels): 607300282Shselasky /* network interface must be down */ 608300282Shselasky if (was_opened) 609300282Shselasky mlx5e_close_locked(priv->ifp); 610290650Shselasky 611300282Shselasky /* import number of channels */ 612300282Shselasky if (priv->params_ethtool.channels < 1) 613300282Shselasky priv->params_ethtool.channels = 1; 614300282Shselasky else if (priv->params_ethtool.channels > 615300282Shselasky (u64) priv->mdev->priv.eq_table.num_comp_vectors) { 616300282Shselasky priv->params_ethtool.channels = 617300282Shselasky (u64) priv->mdev->priv.eq_table.num_comp_vectors; 618300282Shselasky } 619300282Shselasky priv->params.num_channels = priv->params_ethtool.channels; 620291932Shselasky 621300282Shselasky /* restart network interface, if any */ 622300282Shselasky if (was_opened) 623300282Shselasky mlx5e_open_locked(priv->ifp); 624300282Shselasky break; 625300282Shselasky 626300282Shselasky case MLX5_PARAM_OFFSET(rx_coalesce_mode): 627300282Shselasky /* network interface must be down */ 628321995Shselasky if (was_opened != 0 && mode_modify == 0) 629300282Shselasky mlx5e_close_locked(priv->ifp); 630300282Shselasky 631300282Shselasky /* import RX coalesce mode */ 632347796Shselasky if (priv->params_ethtool.rx_coalesce_mode > 3) 633347796Shselasky priv->params_ethtool.rx_coalesce_mode = 3; 634300282Shselasky priv->params.rx_cq_moderation_mode = 635300282Shselasky priv->params_ethtool.rx_coalesce_mode; 636300282Shselasky 637300282Shselasky /* restart network interface, if any */ 638321995Shselasky if (was_opened != 0) { 639321995Shselasky if (mode_modify == 0) 640321995Shselasky mlx5e_open_locked(priv->ifp); 641321995Shselasky else 642321995Shselasky error = mlx5e_refresh_channel_params(priv); 643321995Shselasky } 644300282Shselasky break; 645300282Shselasky 646300282Shselasky case MLX5_PARAM_OFFSET(tx_coalesce_mode): 647300282Shselasky /* network interface must be down */ 648321995Shselasky if (was_opened != 0 && mode_modify == 0) 649300282Shselasky mlx5e_close_locked(priv->ifp); 650300282Shselasky 651300282Shselasky /* import TX coalesce mode */ 652300282Shselasky if (priv->params_ethtool.tx_coalesce_mode != 0) 653300282Shselasky priv->params_ethtool.tx_coalesce_mode = 1; 654300282Shselasky priv->params.tx_cq_moderation_mode = 655300282Shselasky priv->params_ethtool.tx_coalesce_mode; 656300282Shselasky 657300282Shselasky /* restart network interface, if any */ 658321995Shselasky if (was_opened != 0) { 659321995Shselasky if (mode_modify == 0) 660321995Shselasky mlx5e_open_locked(priv->ifp); 661321995Shselasky else 662321995Shselasky error = mlx5e_refresh_channel_params(priv); 663321995Shselasky } 664300282Shselasky break; 665300282Shselasky 666300282Shselasky case MLX5_PARAM_OFFSET(hw_lro): 667300282Shselasky /* network interface must be down */ 668300282Shselasky if (was_opened) 669300282Shselasky mlx5e_close_locked(priv->ifp); 670300282Shselasky 671300282Shselasky /* import HW LRO mode */ 672341983Shselasky if (priv->params_ethtool.hw_lro != 0 && 673341983Shselasky MLX5_CAP_ETH(priv->mdev, lro_cap)) { 674341983Shselasky priv->params_ethtool.hw_lro = 1; 675341983Shselasky /* check if feature should actually be enabled */ 676341983Shselasky if (priv->ifp->if_capenable & IFCAP_LRO) { 677341983Shselasky priv->params.hw_lro_en = true; 678300282Shselasky } else { 679341983Shselasky priv->params.hw_lro_en = false; 680300282Shselasky 681341983Shselasky if_printf(priv->ifp, "To enable HW LRO " 682341983Shselasky "please also enable LRO via ifconfig(8).\n"); 683300282Shselasky } 684294319Shselasky } else { 685341983Shselasky /* return an error if HW does not support this feature */ 686341983Shselasky if (priv->params_ethtool.hw_lro != 0) 687341983Shselasky error = EINVAL; 688341983Shselasky priv->params.hw_lro_en = false; 689341983Shselasky priv->params_ethtool.hw_lro = 0; 690291068Shselasky } 691300282Shselasky /* restart network interface, if any */ 692300282Shselasky if (was_opened) 693300282Shselasky mlx5e_open_locked(priv->ifp); 694300282Shselasky break; 695290650Shselasky 696300282Shselasky case MLX5_PARAM_OFFSET(cqe_zipping): 697300282Shselasky /* network interface must be down */ 698300282Shselasky if (was_opened) 699300282Shselasky mlx5e_close_locked(priv->ifp); 700300282Shselasky 701300282Shselasky /* import CQE zipping mode */ 702292838Shselasky if (priv->params_ethtool.cqe_zipping && 703292838Shselasky MLX5_CAP_GEN(priv->mdev, cqe_compression)) { 704292838Shselasky priv->params.cqe_zipping_en = true; 705292838Shselasky priv->params_ethtool.cqe_zipping = 1; 706292838Shselasky } else { 707292838Shselasky priv->params.cqe_zipping_en = false; 708292838Shselasky priv->params_ethtool.cqe_zipping = 0; 709292838Shselasky } 710300282Shselasky /* restart network interface, if any */ 711300282Shselasky if (was_opened) 712300282Shselasky mlx5e_open_locked(priv->ifp); 713300282Shselasky break; 714300277Shselasky 715300282Shselasky case MLX5_PARAM_OFFSET(tx_completion_fact): 716300282Shselasky /* network interface must be down */ 717300282Shselasky if (was_opened) 718300282Shselasky mlx5e_close_locked(priv->ifp); 719300282Shselasky 720300277Shselasky /* verify parameter */ 721300277Shselasky mlx5e_ethtool_sync_tx_completion_fact(priv); 722300282Shselasky 723300282Shselasky /* restart network interface, if any */ 724300282Shselasky if (was_opened) 725300282Shselasky mlx5e_open_locked(priv->ifp); 726300282Shselasky break; 727300282Shselasky 728331568Shselasky case MLX5_PARAM_OFFSET(modify_tx_dma): 729331568Shselasky /* check if network interface is opened */ 730331568Shselasky if (was_opened) { 731331568Shselasky priv->params_ethtool.modify_tx_dma = 732331568Shselasky priv->params_ethtool.modify_tx_dma ? 1 : 0; 733331568Shselasky /* modify tx according to value */ 734331568Shselasky mlx5e_modify_tx_dma(priv, value != 0); 735331568Shselasky } else { 736331568Shselasky /* if closed force enable tx */ 737331568Shselasky priv->params_ethtool.modify_tx_dma = 0; 738331568Shselasky } 739331568Shselasky break; 740331568Shselasky 741331568Shselasky case MLX5_PARAM_OFFSET(modify_rx_dma): 742331568Shselasky /* check if network interface is opened */ 743331568Shselasky if (was_opened) { 744331568Shselasky priv->params_ethtool.modify_rx_dma = 745331568Shselasky priv->params_ethtool.modify_rx_dma ? 1 : 0; 746331568Shselasky /* modify rx according to value */ 747331568Shselasky mlx5e_modify_rx_dma(priv, value != 0); 748331568Shselasky } else { 749331568Shselasky /* if closed force enable rx */ 750331568Shselasky priv->params_ethtool.modify_rx_dma = 0; 751331568Shselasky } 752331568Shselasky break; 753331568Shselasky 754322006Shselasky case MLX5_PARAM_OFFSET(diag_pci_enable): 755322006Shselasky priv->params_ethtool.diag_pci_enable = 756322006Shselasky priv->params_ethtool.diag_pci_enable ? 1 : 0; 757322006Shselasky 758322006Shselasky error = -mlx5_core_set_diagnostics_full(priv->mdev, 759322006Shselasky priv->params_ethtool.diag_pci_enable, 760322006Shselasky priv->params_ethtool.diag_general_enable); 761322006Shselasky break; 762322006Shselasky 763322006Shselasky case MLX5_PARAM_OFFSET(diag_general_enable): 764322006Shselasky priv->params_ethtool.diag_general_enable = 765322006Shselasky priv->params_ethtool.diag_general_enable ? 1 : 0; 766322006Shselasky 767322006Shselasky error = -mlx5_core_set_diagnostics_full(priv->mdev, 768322006Shselasky priv->params_ethtool.diag_pci_enable, 769322006Shselasky priv->params_ethtool.diag_general_enable); 770322006Shselasky break; 771322006Shselasky 772331569Shselasky case MLX5_PARAM_OFFSET(mc_local_lb): 773331569Shselasky priv->params_ethtool.mc_local_lb = 774331569Shselasky priv->params_ethtool.mc_local_lb ? 1 : 0; 775331569Shselasky 776331569Shselasky if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) { 777331569Shselasky error = mlx5_nic_vport_modify_local_lb(priv->mdev, 778331569Shselasky MLX5_LOCAL_MC_LB, priv->params_ethtool.mc_local_lb); 779331569Shselasky } else { 780331569Shselasky error = EOPNOTSUPP; 781331569Shselasky } 782331569Shselasky break; 783331569Shselasky 784331569Shselasky case MLX5_PARAM_OFFSET(uc_local_lb): 785331569Shselasky priv->params_ethtool.uc_local_lb = 786331569Shselasky priv->params_ethtool.uc_local_lb ? 1 : 0; 787331569Shselasky 788331569Shselasky if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) { 789331569Shselasky error = mlx5_nic_vport_modify_local_lb(priv->mdev, 790331569Shselasky MLX5_LOCAL_UC_LB, priv->params_ethtool.uc_local_lb); 791331569Shselasky } else { 792331569Shselasky error = EOPNOTSUPP; 793331569Shselasky } 794331569Shselasky break; 795331569Shselasky 796300282Shselasky default: 797300282Shselasky break; 798300277Shselasky } 799290650Shselaskydone: 800290650Shselasky PRIV_UNLOCK(priv); 801290650Shselasky return (error); 802290650Shselasky} 803290650Shselasky 804290650Shselasky/* 805290650Shselasky * Read the first three bytes of the eeprom in order to get the needed info 806290650Shselasky * for the whole reading. 807290650Shselasky * Byte 0 - Identifier byte 808290650Shselasky * Byte 1 - Revision byte 809290650Shselasky * Byte 2 - Status byte 810290650Shselasky */ 811290650Shselaskystatic int 812290650Shselaskymlx5e_get_eeprom_info(struct mlx5e_priv *priv, struct mlx5e_eeprom *eeprom) 813290650Shselasky{ 814290650Shselasky struct mlx5_core_dev *dev = priv->mdev; 815290650Shselasky u32 data = 0; 816290650Shselasky int size_read = 0; 817290650Shselasky int ret; 818290650Shselasky 819290650Shselasky ret = mlx5_query_module_num(dev, &eeprom->module_num); 820290650Shselasky if (ret) { 821290650Shselasky if_printf(priv->ifp, "%s:%d: Failed query module error=%d\n", 822290650Shselasky __func__, __LINE__, ret); 823290650Shselasky return (ret); 824290650Shselasky } 825290650Shselasky 826290650Shselasky /* Read the first three bytes to get Identifier, Revision and Status */ 827290650Shselasky ret = mlx5_query_eeprom(dev, eeprom->i2c_addr, eeprom->page_num, 828290650Shselasky eeprom->device_addr, MLX5E_EEPROM_INFO_BYTES, eeprom->module_num, &data, 829290650Shselasky &size_read); 830290650Shselasky if (ret) { 831290650Shselasky if_printf(priv->ifp, "%s:%d: Failed query eeprom module error=0x%x\n", 832290650Shselasky __func__, __LINE__, ret); 833290650Shselasky return (ret); 834290650Shselasky } 835290650Shselasky 836290650Shselasky switch (data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) { 837290650Shselasky case SFF_8024_ID_QSFP: 838290650Shselasky eeprom->type = MLX5E_ETH_MODULE_SFF_8436; 839290650Shselasky eeprom->len = MLX5E_ETH_MODULE_SFF_8436_LEN; 840290650Shselasky break; 841290650Shselasky case SFF_8024_ID_QSFPPLUS: 842290650Shselasky case SFF_8024_ID_QSFP28: 843290650Shselasky if ((data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK) == SFF_8024_ID_QSFP28 || 844291070Shselasky ((data & MLX5_EEPROM_REVISION_ID_BYTE_MASK) >> 8) >= 0x3) { 845290650Shselasky eeprom->type = MLX5E_ETH_MODULE_SFF_8636; 846290650Shselasky eeprom->len = MLX5E_ETH_MODULE_SFF_8636_LEN; 847290650Shselasky } else { 848290650Shselasky eeprom->type = MLX5E_ETH_MODULE_SFF_8436; 849290650Shselasky eeprom->len = MLX5E_ETH_MODULE_SFF_8436_LEN; 850290650Shselasky } 851290650Shselasky if ((data & MLX5_EEPROM_PAGE_3_VALID_BIT_MASK) == 0) 852290650Shselasky eeprom->page_valid = 1; 853290650Shselasky break; 854290650Shselasky case SFF_8024_ID_SFP: 855290650Shselasky eeprom->type = MLX5E_ETH_MODULE_SFF_8472; 856290650Shselasky eeprom->len = MLX5E_ETH_MODULE_SFF_8472_LEN; 857290650Shselasky break; 858290650Shselasky default: 859291067Shselasky if_printf(priv->ifp, "%s:%d: Not recognized cable type = 0x%x(%s)\n", 860291067Shselasky __func__, __LINE__, data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK, 861291067Shselasky sff_8024_id[data & MLX5_EEPROM_IDENTIFIER_BYTE_MASK]); 862290650Shselasky return (EINVAL); 863290650Shselasky } 864290650Shselasky return (0); 865290650Shselasky} 866290650Shselasky 867290650Shselasky/* Read both low and high pages of the eeprom */ 868290650Shselaskystatic int 869290650Shselaskymlx5e_get_eeprom(struct mlx5e_priv *priv, struct mlx5e_eeprom *ee) 870290650Shselasky{ 871290650Shselasky struct mlx5_core_dev *dev = priv->mdev; 872290650Shselasky int size_read = 0; 873290650Shselasky int ret; 874290650Shselasky 875290650Shselasky if (ee->len == 0) 876290650Shselasky return (EINVAL); 877290650Shselasky 878290650Shselasky /* Read low page of the eeprom */ 879290650Shselasky while (ee->device_addr < ee->len) { 880290650Shselasky ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, ee->device_addr, 881290650Shselasky ee->len - ee->device_addr, ee->module_num, 882291070Shselasky ee->data + (ee->device_addr / 4), &size_read); 883290650Shselasky if (ret) { 884290650Shselasky if_printf(priv->ifp, "%s:%d: Failed reading eeprom, " 885290650Shselasky "error = 0x%02x\n", __func__, __LINE__, ret); 886290650Shselasky return (ret); 887290650Shselasky } 888290650Shselasky ee->device_addr += size_read; 889290650Shselasky } 890290650Shselasky 891290650Shselasky /* Read high page of the eeprom */ 892290650Shselasky if (ee->page_valid) { 893290650Shselasky ee->device_addr = MLX5E_EEPROM_HIGH_PAGE_OFFSET; 894290650Shselasky ee->page_num = MLX5E_EEPROM_HIGH_PAGE; 895290650Shselasky size_read = 0; 896290650Shselasky while (ee->device_addr < MLX5E_EEPROM_PAGE_LENGTH) { 897290650Shselasky ret = mlx5_query_eeprom(dev, ee->i2c_addr, ee->page_num, 898290650Shselasky ee->device_addr, MLX5E_EEPROM_PAGE_LENGTH - ee->device_addr, 899291070Shselasky ee->module_num, ee->data + (ee->len / 4) + 900291070Shselasky ((ee->device_addr - MLX5E_EEPROM_HIGH_PAGE_OFFSET) / 4), 901290650Shselasky &size_read); 902290650Shselasky if (ret) { 903290650Shselasky if_printf(priv->ifp, "%s:%d: Failed reading eeprom, " 904290650Shselasky "error = 0x%02x\n", __func__, __LINE__, ret); 905290650Shselasky return (ret); 906290650Shselasky } 907290650Shselasky ee->device_addr += size_read; 908290650Shselasky } 909290650Shselasky } 910290650Shselasky return (0); 911290650Shselasky} 912290650Shselasky 913290650Shselaskystatic void 914290650Shselaskymlx5e_print_eeprom(struct mlx5e_eeprom *eeprom) 915290650Shselasky{ 916292835Shselasky int row; 917292835Shselasky int index_in_row; 918292835Shselasky int byte_to_write = 0; 919292835Shselasky int line_length = 16; 920290650Shselasky 921290650Shselasky printf("\nOffset\t\tValues\n"); 922292835Shselasky printf("------\t\t------"); 923292835Shselasky while (byte_to_write < eeprom->len) { 924292835Shselasky printf("\n0x%04X\t\t", byte_to_write); 925292835Shselasky for (index_in_row = 0; index_in_row < line_length; index_in_row++) { 926292835Shselasky printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]); 927292835Shselasky byte_to_write++; 928290650Shselasky } 929290650Shselasky } 930290650Shselasky 931290650Shselasky if (eeprom->page_valid) { 932290650Shselasky row = MLX5E_EEPROM_HIGH_PAGE_OFFSET; 933292835Shselasky printf("\n\nUpper Page 0x03\n"); 934290650Shselasky printf("\nOffset\t\tValues\n"); 935292835Shselasky printf("------\t\t------"); 936290650Shselasky while (row < MLX5E_EEPROM_PAGE_LENGTH) { 937292835Shselasky printf("\n0x%04X\t\t", row); 938292835Shselasky for (index_in_row = 0; index_in_row < line_length; index_in_row++) { 939292835Shselasky printf("%02X ", ((u8 *)eeprom->data)[byte_to_write]); 940292835Shselasky byte_to_write++; 941290650Shselasky row++; 942290650Shselasky } 943290650Shselasky } 944290650Shselasky } 945290650Shselasky} 946290650Shselasky 947290650Shselasky/* 948290650Shselasky * Read cable EEPROM module information by first inspecting the first 949290650Shselasky * three bytes to get the initial information for a whole reading. 950290650Shselasky * Information will be printed to dmesg. 951290650Shselasky */ 952290650Shselaskystatic int 953290650Shselaskymlx5e_read_eeprom(SYSCTL_HANDLER_ARGS) 954290650Shselasky{ 955290650Shselasky struct mlx5e_priv *priv = arg1; 956290650Shselasky struct mlx5e_eeprom eeprom; 957290650Shselasky int error; 958290650Shselasky int result = 0; 959290650Shselasky 960290650Shselasky PRIV_LOCK(priv); 961290650Shselasky error = sysctl_handle_int(oidp, &result, 0, req); 962290650Shselasky if (error || !req->newptr) 963290650Shselasky goto done; 964290650Shselasky 965290650Shselasky /* Check if device is gone */ 966290650Shselasky if (priv->gone) { 967290650Shselasky error = ENXIO; 968290650Shselasky goto done; 969290650Shselasky } 970290650Shselasky 971290650Shselasky if (result == 1) { 972290650Shselasky eeprom.i2c_addr = MLX5E_I2C_ADDR_LOW; 973290650Shselasky eeprom.device_addr = 0; 974290650Shselasky eeprom.page_num = MLX5E_EEPROM_LOW_PAGE; 975290650Shselasky eeprom.page_valid = 0; 976290650Shselasky 977290650Shselasky /* Read three first bytes to get important info */ 978290650Shselasky error = mlx5e_get_eeprom_info(priv, &eeprom); 979290650Shselasky if (error) { 980290650Shselasky if_printf(priv->ifp, "%s:%d: Failed reading eeprom's " 981290650Shselasky "initial information\n", __func__, __LINE__); 982290650Shselasky error = 0; 983290650Shselasky goto done; 984290650Shselasky } 985291070Shselasky /* 986291070Shselasky * Allocate needed length buffer and additional space for 987291070Shselasky * page 0x03 988291070Shselasky */ 989290650Shselasky eeprom.data = malloc(eeprom.len + MLX5E_EEPROM_PAGE_LENGTH, 990290650Shselasky M_MLX5EN, M_WAITOK | M_ZERO); 991290650Shselasky 992290650Shselasky /* Read the whole eeprom information */ 993290650Shselasky error = mlx5e_get_eeprom(priv, &eeprom); 994290650Shselasky if (error) { 995290650Shselasky if_printf(priv->ifp, "%s:%d: Failed reading eeprom\n", 996290650Shselasky __func__, __LINE__); 997290650Shselasky error = 0; 998291070Shselasky /* 999291070Shselasky * Continue printing partial information in case of 1000291070Shselasky * an error 1001291070Shselasky */ 1002290650Shselasky } 1003290650Shselasky mlx5e_print_eeprom(&eeprom); 1004290650Shselasky free(eeprom.data, M_MLX5EN); 1005290650Shselasky } 1006290650Shselaskydone: 1007290650Shselasky PRIV_UNLOCK(priv); 1008290650Shselasky return (error); 1009290650Shselasky} 1010290650Shselasky 1011290650Shselaskystatic const char *mlx5e_params_desc[] = { 1012290650Shselasky MLX5E_PARAMS(MLX5E_STATS_DESC) 1013290650Shselasky}; 1014290650Shselasky 1015290650Shselaskystatic const char *mlx5e_port_stats_debug_desc[] = { 1016290650Shselasky MLX5E_PORT_STATS_DEBUG(MLX5E_STATS_DESC) 1017290650Shselasky}; 1018290650Shselasky 1019290650Shselaskystatic int 1020337108Shselaskymlx5e_ethtool_debug_channel_info(SYSCTL_HANDLER_ARGS) 1021337108Shselasky{ 1022337108Shselasky struct mlx5e_priv *priv; 1023337108Shselasky struct sbuf sb; 1024337108Shselasky struct mlx5e_channel *c; 1025337108Shselasky struct mlx5e_sq *sq; 1026337108Shselasky struct mlx5e_rq *rq; 1027337108Shselasky int error, i, tc; 1028337108Shselasky 1029337108Shselasky priv = arg1; 1030337108Shselasky error = sysctl_wire_old_buffer(req, 0); 1031337108Shselasky if (error != 0) 1032337108Shselasky return (error); 1033337108Shselasky if (sbuf_new_for_sysctl(&sb, NULL, 128, req) == NULL) 1034337108Shselasky return (ENOMEM); 1035337108Shselasky sbuf_clear_flags(&sb, SBUF_INCLUDENUL); 1036337108Shselasky 1037337108Shselasky PRIV_LOCK(priv); 1038337108Shselasky if (test_bit(MLX5E_STATE_OPENED, &priv->state) == 0) 1039337108Shselasky goto out; 1040337108Shselasky for (i = 0; i < priv->params.num_channels; i++) { 1041341979Shselasky c = &priv->channel[i]; 1042337108Shselasky rq = &c->rq; 1043337108Shselasky sbuf_printf(&sb, "channel %d rq %d cq %d\n", 1044337108Shselasky c->ix, rq->rqn, rq->cq.mcq.cqn); 1045337108Shselasky for (tc = 0; tc < c->num_tc; tc++) { 1046337108Shselasky sq = &c->sq[tc]; 1047337108Shselasky sbuf_printf(&sb, "channel %d tc %d sq %d cq %d\n", 1048337108Shselasky c->ix, tc, sq->sqn, sq->cq.mcq.cqn); 1049337108Shselasky } 1050337108Shselasky } 1051337108Shselaskyout: 1052337108Shselasky PRIV_UNLOCK(priv); 1053337108Shselasky error = sbuf_finish(&sb); 1054337108Shselasky sbuf_delete(&sb); 1055337108Shselasky return (error); 1056337108Shselasky} 1057337108Shselasky 1058337108Shselaskystatic int 1059290650Shselaskymlx5e_ethtool_debug_stats(SYSCTL_HANDLER_ARGS) 1060290650Shselasky{ 1061290650Shselasky struct mlx5e_priv *priv = arg1; 1062341977Shselasky int sys_debug; 1063341977Shselasky int error; 1064290650Shselasky 1065341977Shselasky PRIV_LOCK(priv); 1066347806Shselasky if (priv->gone != 0) { 1067347806Shselasky error = ENODEV; 1068347806Shselasky goto done; 1069347806Shselasky } 1070290650Shselasky sys_debug = priv->sysctl_debug; 1071341977Shselasky error = sysctl_handle_int(oidp, &sys_debug, 0, req); 1072337108Shselasky if (error != 0 || !req->newptr) 1073341977Shselasky goto done; 1074341977Shselasky sys_debug = sys_debug ? 1 : 0; 1075290650Shselasky if (sys_debug == priv->sysctl_debug) 1076341977Shselasky goto done; 1077337108Shselasky 1078341977Shselasky if ((priv->sysctl_debug = sys_debug)) { 1079290650Shselasky mlx5e_create_stats(&priv->stats.port_stats_debug.ctx, 1080290650Shselasky SYSCTL_CHILDREN(priv->sysctl_ifnet), "debug_stats", 1081290650Shselasky mlx5e_port_stats_debug_desc, MLX5E_PORT_STATS_DEBUG_NUM, 1082290650Shselasky priv->stats.port_stats_debug.arg); 1083341977Shselasky SYSCTL_ADD_PROC(&priv->stats.port_stats_debug.ctx, 1084337108Shselasky SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, 1085337108Shselasky "hw_ctx_debug", 1086337108Shselasky CTLFLAG_RD | CTLFLAG_MPSAFE | CTLTYPE_STRING, priv, 0, 1087337108Shselasky mlx5e_ethtool_debug_channel_info, "S", ""); 1088337108Shselasky } else { 1089290650Shselasky sysctl_ctx_free(&priv->stats.port_stats_debug.ctx); 1090337108Shselasky } 1091341977Shselaskydone: 1092337108Shselasky PRIV_UNLOCK(priv); 1093341977Shselasky return (error); 1094290650Shselasky} 1095290650Shselasky 1096322006Shselaskystatic void 1097322006Shselaskymlx5e_create_diagnostics(struct mlx5e_priv *priv) 1098322006Shselasky{ 1099322006Shselasky struct mlx5_core_diagnostics_entry entry; 1100322006Shselasky struct sysctl_ctx_list *ctx; 1101322006Shselasky struct sysctl_oid *node; 1102322006Shselasky int x; 1103322006Shselasky 1104322006Shselasky /* sysctl context we are using */ 1105322006Shselasky ctx = &priv->sysctl_ctx; 1106322006Shselasky 1107322006Shselasky /* create root node */ 1108322006Shselasky node = SYSCTL_ADD_NODE(ctx, 1109322006Shselasky SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, 1110322006Shselasky "diagnostics", CTLFLAG_RD, NULL, "Diagnostics"); 1111322006Shselasky if (node == NULL) 1112322006Shselasky return; 1113322006Shselasky 1114322006Shselasky /* create PCI diagnostics */ 1115322006Shselasky for (x = 0; x != MLX5_CORE_PCI_DIAGNOSTICS_NUM; x++) { 1116322006Shselasky entry = mlx5_core_pci_diagnostics_table[x]; 1117322006Shselasky if (mlx5_core_supports_diagnostics(priv->mdev, entry.counter_id) == 0) 1118322006Shselasky continue; 1119322006Shselasky SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, 1120322006Shselasky entry.desc, CTLFLAG_RD, priv->params_pci.array + x, 1121322006Shselasky "PCI diagnostics counter"); 1122322006Shselasky } 1123322006Shselasky 1124322006Shselasky /* create general diagnostics */ 1125322006Shselasky for (x = 0; x != MLX5_CORE_GENERAL_DIAGNOSTICS_NUM; x++) { 1126322006Shselasky entry = mlx5_core_general_diagnostics_table[x]; 1127322006Shselasky if (mlx5_core_supports_diagnostics(priv->mdev, entry.counter_id) == 0) 1128322006Shselasky continue; 1129322006Shselasky SYSCTL_ADD_UQUAD(ctx, SYSCTL_CHILDREN(node), OID_AUTO, 1130322006Shselasky entry.desc, CTLFLAG_RD, priv->params_general.array + x, 1131322006Shselasky "General diagnostics counter"); 1132322006Shselasky } 1133322006Shselasky} 1134322006Shselasky 1135290650Shselaskyvoid 1136290650Shselaskymlx5e_create_ethtool(struct mlx5e_priv *priv) 1137290650Shselasky{ 1138331577Shselasky struct mlx5_core_dev *mdev = priv->mdev; 1139331577Shselasky struct sysctl_oid *node, *qos_node; 1140290650Shselasky const char *pnameunit; 1141290650Shselasky unsigned x; 1142331577Shselasky int i; 1143290650Shselasky 1144290650Shselasky /* set some defaults */ 1145290650Shselasky priv->params_ethtool.tx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_SQ_SIZE; 1146290650Shselasky priv->params_ethtool.rx_queue_size_max = 1 << MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE; 1147290650Shselasky priv->params_ethtool.tx_queue_size = 1 << priv->params.log_sq_size; 1148290650Shselasky priv->params_ethtool.rx_queue_size = 1 << priv->params.log_rq_size; 1149290650Shselasky priv->params_ethtool.channels = priv->params.num_channels; 1150338552Shselasky priv->params_ethtool.channels_rsss = priv->params.channels_rsss; 1151290650Shselasky priv->params_ethtool.coalesce_pkts_max = MLX5E_FLD_MAX(cqc, cq_max_count); 1152290650Shselasky priv->params_ethtool.coalesce_usecs_max = MLX5E_FLD_MAX(cqc, cq_period); 1153290650Shselasky priv->params_ethtool.rx_coalesce_mode = priv->params.rx_cq_moderation_mode; 1154290650Shselasky priv->params_ethtool.rx_coalesce_usecs = priv->params.rx_cq_moderation_usec; 1155290650Shselasky priv->params_ethtool.rx_coalesce_pkts = priv->params.rx_cq_moderation_pkts; 1156291932Shselasky priv->params_ethtool.tx_coalesce_mode = priv->params.tx_cq_moderation_mode; 1157290650Shselasky priv->params_ethtool.tx_coalesce_usecs = priv->params.tx_cq_moderation_usec; 1158290650Shselasky priv->params_ethtool.tx_coalesce_pkts = priv->params.tx_cq_moderation_pkts; 1159290650Shselasky priv->params_ethtool.hw_lro = priv->params.hw_lro_en; 1160292838Shselasky priv->params_ethtool.cqe_zipping = priv->params.cqe_zipping_en; 1161300277Shselasky mlx5e_ethtool_sync_tx_completion_fact(priv); 1162290650Shselasky 1163331569Shselasky /* get default values for local loopback, if any */ 1164331569Shselasky if (MLX5_CAP_GEN(priv->mdev, disable_local_lb)) { 1165331569Shselasky int err; 1166331569Shselasky u8 val; 1167331569Shselasky 1168331569Shselasky err = mlx5_nic_vport_query_local_lb(priv->mdev, MLX5_LOCAL_MC_LB, &val); 1169331569Shselasky if (err == 0) 1170331569Shselasky priv->params_ethtool.mc_local_lb = val; 1171331569Shselasky 1172331569Shselasky err = mlx5_nic_vport_query_local_lb(priv->mdev, MLX5_LOCAL_UC_LB, &val); 1173331569Shselasky if (err == 0) 1174331569Shselasky priv->params_ethtool.uc_local_lb = val; 1175331569Shselasky } 1176331569Shselasky 1177290650Shselasky /* create root node */ 1178290650Shselasky node = SYSCTL_ADD_NODE(&priv->sysctl_ctx, 1179290650Shselasky SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, 1180290650Shselasky "conf", CTLFLAG_RW, NULL, "Configuration"); 1181290650Shselasky if (node == NULL) 1182290650Shselasky return; 1183290650Shselasky for (x = 0; x != MLX5E_PARAMS_NUM; x++) { 1184290650Shselasky /* check for read-only parameter */ 1185331570Shselasky if (strstr(mlx5e_params_desc[2 * x], "_max") != NULL || 1186331570Shselasky strstr(mlx5e_params_desc[2 * x], "_mtu") != NULL) { 1187290650Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, 1188290650Shselasky mlx5e_params_desc[2 * x], CTLTYPE_U64 | CTLFLAG_RD | 1189290650Shselasky CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU", 1190290650Shselasky mlx5e_params_desc[2 * x + 1]); 1191290650Shselasky } else { 1192292837Shselasky#if (__FreeBSD_version < 1100000) 1193292837Shselasky char path[64]; 1194292837Shselasky#endif 1195292837Shselasky /* 1196292837Shselasky * NOTE: In FreeBSD-11 and newer the 1197292837Shselasky * CTLFLAG_RWTUN flag will take care of 1198292837Shselasky * loading default sysctl value from the 1199292837Shselasky * kernel environment, if any: 1200292837Shselasky */ 1201290650Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, 1202290650Shselasky mlx5e_params_desc[2 * x], CTLTYPE_U64 | CTLFLAG_RWTUN | 1203290650Shselasky CTLFLAG_MPSAFE, priv, x, &mlx5e_ethtool_handler, "QU", 1204290650Shselasky mlx5e_params_desc[2 * x + 1]); 1205292837Shselasky 1206292837Shselasky#if (__FreeBSD_version < 1100000) 1207292837Shselasky /* compute path for sysctl */ 1208292837Shselasky snprintf(path, sizeof(path), "dev.mce.%d.conf.%s", 1209292837Shselasky device_get_unit(priv->mdev->pdev->dev.bsddev), 1210292837Shselasky mlx5e_params_desc[2 * x]); 1211292837Shselasky 1212292837Shselasky /* try to fetch tunable, if any */ 1213292837Shselasky if (TUNABLE_QUAD_FETCH(path, &priv->params_ethtool.arg[x])) 1214292837Shselasky mlx5e_ethtool_handler(NULL, priv, x, NULL); 1215292837Shselasky#endif 1216290650Shselasky } 1217290650Shselasky } 1218290650Shselasky 1219290650Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, 1220290650Shselasky "debug_stats", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 1221290650Shselasky 0, &mlx5e_ethtool_debug_stats, "I", "Extended debug statistics"); 1222290650Shselasky 1223290650Shselasky pnameunit = device_get_nameunit(priv->mdev->pdev->dev.bsddev); 1224290650Shselasky 1225290650Shselasky SYSCTL_ADD_STRING(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), 1226290650Shselasky OID_AUTO, "device_name", CTLFLAG_RD, 1227290650Shselasky __DECONST(void *, pnameunit), 0, 1228290650Shselasky "PCI device name"); 1229290650Shselasky 1230290650Shselasky /* EEPROM support */ 1231290650Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(node), OID_AUTO, "eeprom_info", 1232290650Shselasky CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, priv, 0, 1233290650Shselasky mlx5e_read_eeprom, "I", "EEPROM information"); 1234322006Shselasky 1235322006Shselasky /* Diagnostics support */ 1236322006Shselasky mlx5e_create_diagnostics(priv); 1237331577Shselasky 1238331577Shselasky /* create qos node */ 1239331577Shselasky qos_node = SYSCTL_ADD_NODE(&priv->sysctl_ctx, 1240331577Shselasky SYSCTL_CHILDREN(node), OID_AUTO, 1241331577Shselasky "qos", CTLFLAG_RW, NULL, "Quality Of Service configuration"); 1242341968Shselasky if (qos_node == NULL) 1243331577Shselasky return; 1244331577Shselasky 1245341968Shselasky /* Priority rate limit support */ 1246341968Shselasky if (mlx5e_getmaxrate(priv) == 0) { 1247341968Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), 1248341968Shselasky OID_AUTO, "tc_max_rate", CTLTYPE_U64 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1249341968Shselasky priv, 0, mlx5e_tc_maxrate_handler, "QU", 1250341968Shselasky "Max rate for priority, specified in kilobits, where kilo=1000, " 1251341968Shselasky "max_rate must be divisible by 100000"); 1252341968Shselasky } 1253331577Shselasky 1254341968Shselasky /* Bandwidth limiting by ratio */ 1255341968Shselasky if (mlx5e_get_max_alloc(priv) == 0) { 1256331577Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), 1257341968Shselasky OID_AUTO, "tc_rate_share", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1258341968Shselasky priv, 0, mlx5e_tc_rate_share_handler, "QU", 1259341968Shselasky "Specify bandwidth ratio from 1 to 100 " 1260341968Shselasky "for the available traffic classes"); 1261331577Shselasky } 1262331578Shselasky 1263341968Shselasky /* Priority to traffic class mapping */ 1264341968Shselasky if (mlx5e_get_prio_tc(priv) == 0) { 1265341968Shselasky for (i = 0; i <= mlx5_max_tc(mdev); i++) { 1266341968Shselasky char name[32]; 1267341968Shselasky snprintf(name, sizeof(name), "prio_%d_to_tc", i); 1268341968Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), 1269341968Shselasky OID_AUTO, name, CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1270331578Shselasky priv, i, mlx5e_prio_to_tc_handler, "CU", 1271331578Shselasky "Set priority to traffic class"); 1272341968Shselasky } 1273331578Shselasky } 1274337098Shselasky 1275337098Shselasky /* DSCP support */ 1276337098Shselasky if (mlx5e_get_dscp(priv) == 0) { 1277337098Shselasky for (i = 0; i != MLX5_MAX_SUPPORTED_DSCP; i += 8) { 1278337098Shselasky char name[32]; 1279337098Shselasky snprintf(name, sizeof(name), "dscp_%d_%d_prio", i, i + 7); 1280337098Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), 1281337098Shselasky OID_AUTO, name, CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1282337098Shselasky priv, i, mlx5e_dscp_prio_handler, "CU", 1283337098Shselasky "Set DSCP to priority mapping, 0..7"); 1284337098Shselasky } 1285337107Shselasky#define A "Set trust state, 1:PCP 2:DSCP" 1286337107Shselasky#define B " 3:BOTH" 1287337098Shselasky SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(qos_node), 1288337098Shselasky OID_AUTO, "trust_state", CTLTYPE_U8 | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1289337098Shselasky priv, 0, mlx5e_trust_state_handler, "CU", 1290337107Shselasky MLX5_CAP_QCAM_FEATURE(mdev, qpts_trust_both) ? 1291337107Shselasky A B : A); 1292337107Shselasky#undef B 1293337107Shselasky#undef A 1294337098Shselasky } 1295290650Shselasky} 1296