Commit c2659479 authored by Anish Bhatt's avatar Anish Bhatt Committed by David S. Miller

Update setapp/getapp prototypes in dcbnl_rtnl_ops to return int instead of u8

v2: fixed issue with checking return of dcbnl_rtnl_ops->getapp()
Signed-off-by: default avatarAnish Bhatt <anish@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9cc63db5
...@@ -2303,8 +2303,8 @@ static int bnx2x_set_admin_app_up(struct bnx2x *bp, u8 idtype, u16 idval, u8 up) ...@@ -2303,8 +2303,8 @@ static int bnx2x_set_admin_app_up(struct bnx2x *bp, u8 idtype, u16 idval, u8 up)
return 0; return 0;
} }
static u8 bnx2x_dcbnl_set_app_up(struct net_device *netdev, u8 idtype, static int bnx2x_dcbnl_set_app_up(struct net_device *netdev, u8 idtype,
u16 idval, u8 up) u16 idval, u8 up)
{ {
struct bnx2x *bp = netdev_priv(netdev); struct bnx2x *bp = netdev_priv(netdev);
......
...@@ -648,26 +648,17 @@ static int __cxgb4_getapp(struct net_device *dev, u8 app_idtype, u16 app_id, ...@@ -648,26 +648,17 @@ static int __cxgb4_getapp(struct net_device *dev, u8 app_idtype, u16 app_id,
} }
/* Return the Application User Priority Map associated with the specified /* Return the Application User Priority Map associated with the specified
* Application ID. Since this routine is prototyped to return "u8" we can't * Application ID.
* return errors ...
*/ */
static u8 cxgb4_getapp(struct net_device *dev, u8 app_idtype, u16 app_id) static int cxgb4_getapp(struct net_device *dev, u8 app_idtype, u16 app_id)
{ {
int result = __cxgb4_getapp(dev, app_idtype, app_id, 0); return __cxgb4_getapp(dev, app_idtype, app_id, 0);
if (result < 0)
result = 0;
return result;
} }
/* Write a new Application User Priority Map for the specified Application ID. /* Write a new Application User Priority Map for the specified Application ID
* This routine is prototyped to return "u8" but other instantiations of the
* DCB NetLink Operations "setapp" routines return negative errnos for errors.
* We follow their lead.
*/ */
static u8 cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id, static int cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id,
u8 app_prio) u8 app_prio)
{ {
struct fw_port_cmd pcmd; struct fw_port_cmd pcmd;
struct port_info *pi = netdev2pinfo(dev); struct port_info *pi = netdev2pinfo(dev);
......
...@@ -495,10 +495,10 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state) ...@@ -495,10 +495,10 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
* @id: id is either ether type or TCP/UDP port number * @id: id is either ether type or TCP/UDP port number
* *
* Returns : on success, returns a non-zero 802.1p user priority bitmap * Returns : on success, returns a non-zero 802.1p user priority bitmap
* otherwise returns 0 as the invalid user priority bitmap to indicate an * otherwise returns -EINVAL as the invalid user priority bitmap to indicate an
* error. * error.
*/ */
static u8 ixgbe_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id) static int ixgbe_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id)
{ {
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct dcb_app app = { struct dcb_app app = {
...@@ -507,7 +507,7 @@ static u8 ixgbe_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id) ...@@ -507,7 +507,7 @@ static u8 ixgbe_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id)
}; };
if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
return 0; return -EINVAL;
return dcb_getapp(netdev, &app); return dcb_getapp(netdev, &app);
} }
......
...@@ -926,7 +926,7 @@ static int qlcnic_dcb_get_num_tcs(struct net_device *netdev, int attr, u8 *num) ...@@ -926,7 +926,7 @@ static int qlcnic_dcb_get_num_tcs(struct net_device *netdev, int attr, u8 *num)
} }
} }
static u8 qlcnic_dcb_get_app(struct net_device *netdev, u8 idtype, u16 id) static int qlcnic_dcb_get_app(struct net_device *netdev, u8 idtype, u16 id)
{ {
struct qlcnic_adapter *adapter = netdev_priv(netdev); struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct dcb_app app = { struct dcb_app app = {
...@@ -935,7 +935,7 @@ static u8 qlcnic_dcb_get_app(struct net_device *netdev, u8 idtype, u16 id) ...@@ -935,7 +935,7 @@ static u8 qlcnic_dcb_get_app(struct net_device *netdev, u8 idtype, u16 id)
}; };
if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state)) if (!test_bit(QLCNIC_DCB_STATE, &adapter->dcb->state))
return 0; return -EINVAL;
return dcb_getapp(netdev, &app); return dcb_getapp(netdev, &app);
} }
......
...@@ -81,8 +81,8 @@ struct dcbnl_rtnl_ops { ...@@ -81,8 +81,8 @@ struct dcbnl_rtnl_ops {
void (*setbcncfg)(struct net_device *, int, u32); void (*setbcncfg)(struct net_device *, int, u32);
void (*getbcnrp)(struct net_device *, int, u8 *); void (*getbcnrp)(struct net_device *, int, u8 *);
void (*setbcnrp)(struct net_device *, int, u8); void (*setbcnrp)(struct net_device *, int, u8);
u8 (*setapp)(struct net_device *, u8, u16, u8); int (*setapp)(struct net_device *, u8, u16, u8);
u8 (*getapp)(struct net_device *, u8, u16); int (*getapp)(struct net_device *, u8, u16);
u8 (*getfeatcfg)(struct net_device *, int, u8 *); u8 (*getfeatcfg)(struct net_device *, int, u8 *);
u8 (*setfeatcfg)(struct net_device *, int, u8); u8 (*setfeatcfg)(struct net_device *, int, u8);
......
...@@ -471,7 +471,11 @@ static int dcbnl_getapp(struct net_device *netdev, struct nlmsghdr *nlh, ...@@ -471,7 +471,11 @@ static int dcbnl_getapp(struct net_device *netdev, struct nlmsghdr *nlh,
id = nla_get_u16(app_tb[DCB_APP_ATTR_ID]); id = nla_get_u16(app_tb[DCB_APP_ATTR_ID]);
if (netdev->dcbnl_ops->getapp) { if (netdev->dcbnl_ops->getapp) {
up = netdev->dcbnl_ops->getapp(netdev, idtype, id); ret = netdev->dcbnl_ops->getapp(netdev, idtype, id);
if (ret < 0)
return ret;
else
up = ret;
} else { } else {
struct dcb_app app = { struct dcb_app app = {
.selector = idtype, .selector = idtype,
...@@ -538,6 +542,8 @@ static int dcbnl_setapp(struct net_device *netdev, struct nlmsghdr *nlh, ...@@ -538,6 +542,8 @@ static int dcbnl_setapp(struct net_device *netdev, struct nlmsghdr *nlh,
if (netdev->dcbnl_ops->setapp) { if (netdev->dcbnl_ops->setapp) {
ret = netdev->dcbnl_ops->setapp(netdev, idtype, id, up); ret = netdev->dcbnl_ops->setapp(netdev, idtype, id, up);
if (ret < 0)
return ret;
} else { } else {
struct dcb_app app; struct dcb_app app;
app.selector = idtype; app.selector = idtype;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment