Date: Fri, 22 Jan 2021 12:48:44 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c408d03b378a - stable/11 - MFC r367609: mlx5en: Refactor repeated code to register media type to mlx5e_ifm_add(). Message-ID: <202101221248.10MCmiw8020010@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c408d03b378aeebba1faa09fe62c1562ad34295a commit c408d03b378aeebba1faa09fe62c1562ad34295a Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2020-11-19 09:13:23 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2021-01-22 12:47:15 +0000 MFC r367609: mlx5en: Refactor repeated code to register media type to mlx5e_ifm_add(). --- sys/dev/mlx5/mlx5_en/mlx5_en_main.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c index cbb5d20ed900..77ed6f78aafc 100644 --- a/sys/dev/mlx5/mlx5_en/mlx5_en_main.c +++ b/sys/dev/mlx5/mlx5_en/mlx5_en_main.c @@ -3913,6 +3913,14 @@ mlx5e_setup_pauseframes(struct mlx5e_priv *priv) PRIV_UNLOCK(priv); } +static void +mlx5e_ifm_add(struct mlx5e_priv *priv, int type) +{ + ifmedia_add(&priv->media, type | IFM_ETHER, 0, NULL); + ifmedia_add(&priv->media, type | IFM_ETHER | IFM_FDX | + IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); +} + static void * mlx5e_create_ifp(struct mlx5_core_dev *mdev) { @@ -4088,21 +4096,12 @@ mlx5e_create_ifp(struct mlx5_core_dev *mdev) mlx5e_mode_table[i][j]; if (media_entry.baudrate == 0) continue; - if (MLX5E_PROT_MASK(i) & eth_proto_cap) { - ifmedia_add(&priv->media, - media_entry.subtype | - IFM_ETHER, 0, NULL); - ifmedia_add(&priv->media, - media_entry.subtype | - IFM_ETHER | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); - } + if (MLX5E_PROT_MASK(i) & eth_proto_cap) + mlx5e_ifm_add(priv, media_entry.subtype); } } - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX | - IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE, 0, NULL); + mlx5e_ifm_add(priv, IFM_AUTO); /* Set autoselect by default */ ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO | IFM_FDX |
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101221248.10MCmiw8020010>