mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 02:01:36 +03:00
* Add new cl_* macros for printing client-specific messages. This adds client index to messages in code which is called from user space. This makes it easier to diagnose errors when multiple clients (processes) open the driver. * Use kernel print levels appropriate to messages being printed. * Print process pid when opening the driver. * Print information about access token being set or released. * Print information about PCI devices being enabled or disabled. PCI device enablement is tied to the driver getting ownership of the device. It also prevents multiple MODS instances from owning the same PCI device. * Print info about device DMA mask, print device DMA mask when DMA mapping fails. * Print more info about SRIOV actions. * Disable SRIOV when the driver is being closed by the process which enables SRIOV. Leaving SRIOV enabled when disabling PCI device is an error and leads to stale functions, unusable on subsequent MODS runs. * Clean up log messages in a few places. Change-Id: I51953e984a55c0990e90f89d8260f215c8c58498 Signed-off-by: Chris Dragan <kdragan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2279439 Tested-by: Ellis Roberts <ellisr@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
46 lines
1.4 KiB
C
46 lines
1.4 KiB
C
/*
|
|
* mods_net.c - This file is part of NVIDIA MODS kernel driver.
|
|
*
|
|
* Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved.
|
|
*
|
|
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License,
|
|
* version 2, as published by the Free Software Foundation.
|
|
*
|
|
* NVIDIA MODS kernel driver is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with NVIDIA MODS kernel driver.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "mods.h"
|
|
#include "mods_internal.h"
|
|
#include <linux/netdevice.h>
|
|
|
|
int esc_mods_net_force_link(struct mods_client *client,
|
|
struct MODS_NET_DEVICE_NAME *p)
|
|
{
|
|
struct net_device *ndev;
|
|
|
|
if (!p ||
|
|
(strnlen(p->device_name, MAX_NET_DEVICE_NAME_LENGTH) == 0) ||
|
|
(!memchr(p->device_name, '\0', MAX_NET_DEVICE_NAME_LENGTH))) {
|
|
cl_error("invalid device name\n");
|
|
return -EINVAL;
|
|
}
|
|
|
|
for_each_netdev(&init_net, ndev)
|
|
if (!strcmp(ndev->name, p->device_name)) {
|
|
netif_carrier_on(ndev);
|
|
cl_info("carrier forced on: %s\n", p->device_name);
|
|
return OK;
|
|
}
|
|
|
|
cl_error("failed to find network device %s\n", p->device_name);
|
|
return -EINVAL;
|
|
}
|