iPXE
mlx_vmac.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2015 Mellanox Technologies Ltd.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301, USA.
00018  */
00019 
00020 FILE_LICENCE ( GPL2_OR_LATER );
00021 
00022 #include "../../mlx_lib/mlx_vmac/mlx_vmac.h"
00023 #include "../../include/public/mlx_icmd.h"
00024 #include "../../include/public/mlx_bail.h"
00025 
00026 mlx_status
00027 mlx_vmac_query_virt_mac (
00028         IN mlx_utils *utils,
00029         OUT struct mlx_vmac_query_virt_mac *virt_mac
00030         )
00031 {
00032         mlx_status status = MLX_SUCCESS;
00033         if (utils == NULL || virt_mac == NULL) {
00034                 status = MLX_INVALID_PARAMETER;
00035                 goto bad_param;
00036         }
00037 
00038         status = mlx_icmd_send_command(
00039                         utils,
00040                         QUERY_VIRTUAL_MAC,
00041                         virt_mac,
00042                         0,
00043                         sizeof(*virt_mac)
00044                         );
00045         MLX_CHECK_STATUS(utils, status, icmd_err, "mlx_icmd_send_command failed");
00046 icmd_err:
00047 bad_param:
00048         return status;
00049 }
00050 
00051 mlx_status
00052 mlx_vmac_set_virt_mac (
00053         IN mlx_utils *utils,
00054         OUT struct mlx_vmac_set_virt_mac *virt_mac
00055         )
00056 {
00057         mlx_status status = MLX_SUCCESS;
00058         if (utils == NULL || virt_mac == NULL) {
00059                 status = MLX_INVALID_PARAMETER;
00060                 goto bad_param;
00061         }
00062 
00063         status = mlx_icmd_send_command(
00064                         utils,
00065                         SET_VIRTUAL_MAC,
00066                         virt_mac,
00067                         sizeof(*virt_mac),
00068                         0
00069                         );
00070         MLX_CHECK_STATUS(utils, status, icmd_err, "mlx_icmd_send_command failed");
00071 icmd_err:
00072 bad_param:
00073         return status;
00074 }