Author: kib Date: Thu Nov 12 02:21:14 2020 New Revision: 367609 URL: https://svnweb.freebsd.org/changeset/base/367609
Log: mlx5en: Refactor repeated code to register media type to mlx5e_ifm_add(). Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 01:18:05 2020 (r367608) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Nov 12 02:21:14 2020 (r367609) @@ -4260,6 +4260,14 @@ mlx5e_snd_tag_free(struct m_snd_tag *pmt) } } +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) { @@ -4463,21 +4471,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 | _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"