#include "netlink.h"
#include "common.h"
#include <linux/phy.h>
struct linkstate_req_info { … };
struct linkstate_reply_data { … };
#define LINKSTATE_REPDATA(__reply_base) …
const struct nla_policy ethnl_linkstate_get_policy[] = …;
static int linkstate_get_sqi(struct net_device *dev)
{ … }
static int linkstate_get_sqi_max(struct net_device *dev)
{
struct phy_device *phydev = dev->phydev;
int ret;
if (!phydev)
return -EOPNOTSUPP;
mutex_lock(&phydev->lock);
if (!phydev->drv || !phydev->drv->get_sqi_max)
ret = -EOPNOTSUPP;
else if (!phydev->link)
ret = -ENETDOWN;
else
ret = phydev->drv->get_sqi_max(phydev);
mutex_unlock(&phydev->lock);
return ret;
};
static bool linkstate_sqi_critical_error(int sqi)
{ … }
static bool linkstate_sqi_valid(struct linkstate_reply_data *data)
{ … }
static int linkstate_get_link_ext_state(struct net_device *dev,
struct linkstate_reply_data *data)
{ … }
static int linkstate_prepare_data(const struct ethnl_req_info *req_base,
struct ethnl_reply_data *reply_base,
const struct genl_info *info)
{ … }
static int linkstate_reply_size(const struct ethnl_req_info *req_base,
const struct ethnl_reply_data *reply_base)
{ … }
static int linkstate_fill_reply(struct sk_buff *skb,
const struct ethnl_req_info *req_base,
const struct ethnl_reply_data *reply_base)
{ … }
const struct ethnl_request_ops ethnl_linkstate_request_ops = …;