Merge branch 'qed-dcbnl'

Sudarsana Reddy Kalluru says:

====================
qed/qede support for dcbnl.

This series adds the dcbnl functionality to the driver. Patch (1) adds
the qed infrastucture for querying/configuring the dcbx parameters.
Patch (2) adds the qed infrastructure for dcbnl APIs. And patch (3)
adds the qede support for dcbnl.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2016-06-08 11:11:00 -07:00
commit df0437e147
10 changed files with 2168 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,24 @@ struct qed_dcbx_app_data {
u8 tc; /* Traffic Class */
};
#ifdef CONFIG_DCB
#define QED_DCBX_VERSION_DISABLED 0
#define QED_DCBX_VERSION_IEEE 1
#define QED_DCBX_VERSION_CEE 2
struct qed_dcbx_set {
#define QED_DCBX_OVERRIDE_STATE BIT(0)
#define QED_DCBX_OVERRIDE_PFC_CFG BIT(1)
#define QED_DCBX_OVERRIDE_ETS_CFG BIT(2)
#define QED_DCBX_OVERRIDE_APP_CFG BIT(3)
#define QED_DCBX_OVERRIDE_DSCP_CFG BIT(4)
u32 override_flags;
bool enabled;
struct qed_dcbx_admin_params config;
u32 ver_num;
};
#endif
struct qed_dcbx_results {
bool dcbx_enabled;
u8 pf_id;
@ -55,6 +73,9 @@ struct qed_dcbx_info {
struct qed_dcbx_results results;
struct dcbx_mib operational;
struct dcbx_mib remote;
#ifdef CONFIG_DCB
struct qed_dcbx_set set;
#endif
u8 dcbx_cap;
};
@ -67,6 +88,13 @@ struct qed_dcbx_mib_meta_data {
u32 addr;
};
#ifdef CONFIG_DCB
int qed_dcbx_get_config_params(struct qed_hwfn *, struct qed_dcbx_set *);
int qed_dcbx_config_params(struct qed_hwfn *,
struct qed_ptt *, struct qed_dcbx_set *, bool);
#endif
/* QED local interface routines */
int
qed_dcbx_mib_update_event(struct qed_hwfn *,

View File

@ -7244,6 +7244,9 @@ struct public_drv_mb {
#define DRV_MB_PARAM_CFG_VF_MSIX_VF_ID_MASK 0x000000FF
#define DRV_MB_PARAM_CFG_VF_MSIX_SB_NUM_SHIFT 8
#define DRV_MB_PARAM_CFG_VF_MSIX_SB_NUM_MASK 0x0000FF00
#define DRV_MB_PARAM_LLDP_SEND_MASK 0x00000001
#define DRV_MB_PARAM_LLDP_SEND_SHIFT 0
#define DRV_MB_PARAM_SET_LED_MODE_OPER 0x0
#define DRV_MB_PARAM_SET_LED_MODE_ON 0x1

View File

@ -2166,10 +2166,17 @@ static int qed_fp_cqe_completion(struct qed_dev *dev,
extern const struct qed_iov_hv_ops qed_iov_ops_pass;
#endif
#ifdef CONFIG_DCB
extern const struct qed_eth_dcbnl_ops qed_dcbnl_ops_pass;
#endif
static const struct qed_eth_ops qed_eth_ops_pass = {
.common = &qed_common_ops_pass,
#ifdef CONFIG_QED_SRIOV
.iov = &qed_iov_ops_pass,
#endif
#ifdef CONFIG_DCB
.dcb = &qed_dcbnl_ops_pass,
#endif
.fill_dev_info = &qed_fill_eth_dev_info,
.register_ops = &qed_register_eth_ops,

View File

@ -1,3 +1,4 @@
obj-$(CONFIG_QEDE) := qede.o
qede-y := qede_main.o qede_ethtool.o
qede-$(CONFIG_DCB) += qede_dcbnl.o

View File

@ -304,6 +304,9 @@ union qede_reload_args {
u16 mtu;
};
#ifdef CONFIG_DCB
void qede_set_dcbnl_ops(struct net_device *ndev);
#endif
void qede_config_debug(uint debug, u32 *p_dp_module, u8 *p_dp_level);
void qede_set_ethtool_ops(struct net_device *netdev);
void qede_reload(struct qede_dev *edev,

View File

@ -0,0 +1,348 @@
/* QLogic qede NIC Driver
* Copyright (c) 2015 QLogic Corporation
*
* This software is available under the terms of the GNU General Public License
* (GPL) Version 2, available from the file COPYING in the main directory of
* this source tree.
*/
#include <linux/types.h>
#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
#include <net/dcbnl.h>
#include "qede.h"
static u8 qede_dcbnl_getstate(struct net_device *netdev)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->getstate(edev->cdev);
}
static u8 qede_dcbnl_setstate(struct net_device *netdev, u8 state)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setstate(edev->cdev, state);
}
static void qede_dcbnl_getpermhwaddr(struct net_device *netdev,
u8 *perm_addr)
{
memcpy(perm_addr, netdev->dev_addr, netdev->addr_len);
}
static void qede_dcbnl_getpgtccfgtx(struct net_device *netdev, int prio,
u8 *prio_type, u8 *pgid, u8 *bw_pct,
u8 *up_map)
{
struct qede_dev *edev = netdev_priv(netdev);
edev->ops->dcb->getpgtccfgtx(edev->cdev, prio, prio_type,
pgid, bw_pct, up_map);
}
static void qede_dcbnl_getpgbwgcfgtx(struct net_device *netdev,
int pgid, u8 *bw_pct)
{
struct qede_dev *edev = netdev_priv(netdev);
edev->ops->dcb->getpgbwgcfgtx(edev->cdev, pgid, bw_pct);
}
static void qede_dcbnl_getpgtccfgrx(struct net_device *netdev, int prio,
u8 *prio_type, u8 *pgid, u8 *bw_pct,
u8 *up_map)
{
struct qede_dev *edev = netdev_priv(netdev);
edev->ops->dcb->getpgtccfgrx(edev->cdev, prio, prio_type, pgid, bw_pct,
up_map);
}
static void qede_dcbnl_getpgbwgcfgrx(struct net_device *netdev,
int pgid, u8 *bw_pct)
{
struct qede_dev *edev = netdev_priv(netdev);
edev->ops->dcb->getpgbwgcfgrx(edev->cdev, pgid, bw_pct);
}
static void qede_dcbnl_getpfccfg(struct net_device *netdev, int prio,
u8 *setting)
{
struct qede_dev *edev = netdev_priv(netdev);
edev->ops->dcb->getpfccfg(edev->cdev, prio, setting);
}
static void qede_dcbnl_setpfccfg(struct net_device *netdev, int prio,
u8 setting)
{
struct qede_dev *edev = netdev_priv(netdev);
edev->ops->dcb->setpfccfg(edev->cdev, prio, setting);
}
static u8 qede_dcbnl_getcap(struct net_device *netdev, int capid, u8 *cap)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->getcap(edev->cdev, capid, cap);
}
static int qede_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->getnumtcs(edev->cdev, tcid, num);
}
static u8 qede_dcbnl_getpfcstate(struct net_device *netdev)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->getpfcstate(edev->cdev);
}
static int qede_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->getapp(edev->cdev, idtype, id);
}
static u8 qede_dcbnl_getdcbx(struct net_device *netdev)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->getdcbx(edev->cdev);
}
static void qede_dcbnl_setpgtccfgtx(struct net_device *netdev, int prio,
u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setpgtccfgtx(edev->cdev, prio, pri_type, pgid,
bw_pct, up_map);
}
static void qede_dcbnl_setpgtccfgrx(struct net_device *netdev, int prio,
u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setpgtccfgrx(edev->cdev, prio, pri_type, pgid,
bw_pct, up_map);
}
static void qede_dcbnl_setpgbwgcfgtx(struct net_device *netdev, int pgid,
u8 bw_pct)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setpgbwgcfgtx(edev->cdev, pgid, bw_pct);
}
static void qede_dcbnl_setpgbwgcfgrx(struct net_device *netdev, int pgid,
u8 bw_pct)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setpgbwgcfgrx(edev->cdev, pgid, bw_pct);
}
static u8 qede_dcbnl_setall(struct net_device *netdev)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setall(edev->cdev);
}
static int qede_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setnumtcs(edev->cdev, tcid, num);
}
static void qede_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setpfcstate(edev->cdev, state);
}
static int qede_dcbnl_setapp(struct net_device *netdev, u8 idtype, u16 idval,
u8 up)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setapp(edev->cdev, idtype, idval, up);
}
static u8 qede_dcbnl_setdcbx(struct net_device *netdev, u8 state)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setdcbx(edev->cdev, state);
}
static u8 qede_dcbnl_getfeatcfg(struct net_device *netdev, int featid,
u8 *flags)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->getfeatcfg(edev->cdev, featid, flags);
}
static u8 qede_dcbnl_setfeatcfg(struct net_device *netdev, int featid, u8 flags)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->setfeatcfg(edev->cdev, featid, flags);
}
static int qede_dcbnl_peer_getappinfo(struct net_device *netdev,
struct dcb_peer_app_info *info,
u16 *count)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->peer_getappinfo(edev->cdev, info, count);
}
static int qede_dcbnl_peer_getapptable(struct net_device *netdev,
struct dcb_app *app)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->peer_getapptable(edev->cdev, app);
}
static int qede_dcbnl_cee_peer_getpfc(struct net_device *netdev,
struct cee_pfc *pfc)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->cee_peer_getpfc(edev->cdev, pfc);
}
static int qede_dcbnl_cee_peer_getpg(struct net_device *netdev,
struct cee_pg *pg)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->cee_peer_getpg(edev->cdev, pg);
}
static int qede_dcbnl_ieee_getpfc(struct net_device *netdev,
struct ieee_pfc *pfc)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->ieee_getpfc(edev->cdev, pfc);
}
static int qede_dcbnl_ieee_setpfc(struct net_device *netdev,
struct ieee_pfc *pfc)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->ieee_setpfc(edev->cdev, pfc);
}
static int qede_dcbnl_ieee_getets(struct net_device *netdev,
struct ieee_ets *ets)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->ieee_getets(edev->cdev, ets);
}
static int qede_dcbnl_ieee_setets(struct net_device *netdev,
struct ieee_ets *ets)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->ieee_setets(edev->cdev, ets);
}
static int qede_dcbnl_ieee_getapp(struct net_device *netdev,
struct dcb_app *app)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->ieee_getapp(edev->cdev, app);
}
static int qede_dcbnl_ieee_setapp(struct net_device *netdev,
struct dcb_app *app)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->ieee_setapp(edev->cdev, app);
}
static int qede_dcbnl_ieee_peer_getpfc(struct net_device *netdev,
struct ieee_pfc *pfc)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->ieee_peer_getpfc(edev->cdev, pfc);
}
static int qede_dcbnl_ieee_peer_getets(struct net_device *netdev,
struct ieee_ets *ets)
{
struct qede_dev *edev = netdev_priv(netdev);
return edev->ops->dcb->ieee_peer_getets(edev->cdev, ets);
}
static const struct dcbnl_rtnl_ops qede_dcbnl_ops = {
.ieee_getpfc = qede_dcbnl_ieee_getpfc,
.ieee_setpfc = qede_dcbnl_ieee_setpfc,
.ieee_getets = qede_dcbnl_ieee_getets,
.ieee_setets = qede_dcbnl_ieee_setets,
.ieee_getapp = qede_dcbnl_ieee_getapp,
.ieee_setapp = qede_dcbnl_ieee_setapp,
.getdcbx = qede_dcbnl_getdcbx,
.ieee_peer_getpfc = qede_dcbnl_ieee_peer_getpfc,
.ieee_peer_getets = qede_dcbnl_ieee_peer_getets,
.getstate = qede_dcbnl_getstate,
.setstate = qede_dcbnl_setstate,
.getpermhwaddr = qede_dcbnl_getpermhwaddr,
.getpgtccfgtx = qede_dcbnl_getpgtccfgtx,
.getpgbwgcfgtx = qede_dcbnl_getpgbwgcfgtx,
.getpgtccfgrx = qede_dcbnl_getpgtccfgrx,
.getpgbwgcfgrx = qede_dcbnl_getpgbwgcfgrx,
.getpfccfg = qede_dcbnl_getpfccfg,
.setpfccfg = qede_dcbnl_setpfccfg,
.getcap = qede_dcbnl_getcap,
.getnumtcs = qede_dcbnl_getnumtcs,
.getpfcstate = qede_dcbnl_getpfcstate,
.getapp = qede_dcbnl_getapp,
.getdcbx = qede_dcbnl_getdcbx,
.setpgtccfgtx = qede_dcbnl_setpgtccfgtx,
.setpgtccfgrx = qede_dcbnl_setpgtccfgrx,
.setpgbwgcfgtx = qede_dcbnl_setpgbwgcfgtx,
.setpgbwgcfgrx = qede_dcbnl_setpgbwgcfgrx,
.setall = qede_dcbnl_setall,
.setnumtcs = qede_dcbnl_setnumtcs,
.setpfcstate = qede_dcbnl_setpfcstate,
.setapp = qede_dcbnl_setapp,
.setdcbx = qede_dcbnl_setdcbx,
.setfeatcfg = qede_dcbnl_setfeatcfg,
.getfeatcfg = qede_dcbnl_getfeatcfg,
.peer_getappinfo = qede_dcbnl_peer_getappinfo,
.peer_getapptable = qede_dcbnl_peer_getapptable,
.cee_peer_getpfc = qede_dcbnl_cee_peer_getpfc,
.cee_peer_getpg = qede_dcbnl_cee_peer_getpg,
};
void qede_set_dcbnl_ops(struct net_device *dev)
{
dev->dcbnl_ops = &qede_dcbnl_ops;
}

View File

@ -2499,6 +2499,10 @@ static int __qede_probe(struct pci_dev *pdev, u32 dp_module, u8 dp_level,
edev->ops->register_ops(cdev, &qede_ll_ops, edev);
#ifdef CONFIG_DCB
qede_set_dcbnl_ops(edev->ndev);
#endif
INIT_DELAYED_WORK(&edev->sp_task, qede_sp_task);
mutex_init(&edev->qede_lock);

View File

@ -128,11 +128,73 @@ struct qed_eth_cb_ops {
void (*force_mac) (void *dev, u8 *mac);
};
#ifdef CONFIG_DCB
/* Prototype declaration of qed_eth_dcbnl_ops should match with the declaration
* of dcbnl_rtnl_ops structure.
*/
struct qed_eth_dcbnl_ops {
/* IEEE 802.1Qaz std */
int (*ieee_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
int (*ieee_setpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
int (*ieee_getets)(struct qed_dev *cdev, struct ieee_ets *ets);
int (*ieee_setets)(struct qed_dev *cdev, struct ieee_ets *ets);
int (*ieee_peer_getets)(struct qed_dev *cdev, struct ieee_ets *ets);
int (*ieee_peer_getpfc)(struct qed_dev *cdev, struct ieee_pfc *pfc);
int (*ieee_getapp)(struct qed_dev *cdev, struct dcb_app *app);
int (*ieee_setapp)(struct qed_dev *cdev, struct dcb_app *app);
/* CEE std */
u8 (*getstate)(struct qed_dev *cdev);
u8 (*setstate)(struct qed_dev *cdev, u8 state);
void (*getpgtccfgtx)(struct qed_dev *cdev, int prio, u8 *prio_type,
u8 *pgid, u8 *bw_pct, u8 *up_map);
void (*getpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 *bw_pct);
void (*getpgtccfgrx)(struct qed_dev *cdev, int prio, u8 *prio_type,
u8 *pgid, u8 *bw_pct, u8 *up_map);
void (*getpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 *bw_pct);
void (*getpfccfg)(struct qed_dev *cdev, int prio, u8 *setting);
void (*setpfccfg)(struct qed_dev *cdev, int prio, u8 setting);
u8 (*getcap)(struct qed_dev *cdev, int capid, u8 *cap);
int (*getnumtcs)(struct qed_dev *cdev, int tcid, u8 *num);
u8 (*getpfcstate)(struct qed_dev *cdev);
int (*getapp)(struct qed_dev *cdev, u8 idtype, u16 id);
u8 (*getfeatcfg)(struct qed_dev *cdev, int featid, u8 *flags);
/* DCBX configuration */
u8 (*getdcbx)(struct qed_dev *cdev);
void (*setpgtccfgtx)(struct qed_dev *cdev, int prio,
u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map);
void (*setpgtccfgrx)(struct qed_dev *cdev, int prio,
u8 pri_type, u8 pgid, u8 bw_pct, u8 up_map);
void (*setpgbwgcfgtx)(struct qed_dev *cdev, int pgid, u8 bw_pct);
void (*setpgbwgcfgrx)(struct qed_dev *cdev, int pgid, u8 bw_pct);
u8 (*setall)(struct qed_dev *cdev);
int (*setnumtcs)(struct qed_dev *cdev, int tcid, u8 num);
void (*setpfcstate)(struct qed_dev *cdev, u8 state);
int (*setapp)(struct qed_dev *cdev, u8 idtype, u16 idval, u8 up);
u8 (*setdcbx)(struct qed_dev *cdev, u8 state);
u8 (*setfeatcfg)(struct qed_dev *cdev, int featid, u8 flags);
/* Peer apps */
int (*peer_getappinfo)(struct qed_dev *cdev,
struct dcb_peer_app_info *info,
u16 *app_count);
int (*peer_getapptable)(struct qed_dev *cdev, struct dcb_app *table);
/* CEE peer */
int (*cee_peer_getpfc)(struct qed_dev *cdev, struct cee_pfc *pfc);
int (*cee_peer_getpg)(struct qed_dev *cdev, struct cee_pg *pg);
};
#endif
struct qed_eth_ops {
const struct qed_common_ops *common;
#ifdef CONFIG_QED_SRIOV
const struct qed_iov_hv_ops *iov;
#endif
#ifdef CONFIG_DCB
const struct qed_eth_dcbnl_ops *dcb;
#endif
int (*fill_dev_info)(struct qed_dev *cdev,
struct qed_dev_eth_info *info);

View File

@ -34,6 +34,96 @@ enum dcbx_protocol_type {
DCBX_MAX_PROTOCOL_TYPE
};
#ifdef CONFIG_DCB
#define QED_LLDP_CHASSIS_ID_STAT_LEN 4
#define QED_LLDP_PORT_ID_STAT_LEN 4
#define QED_DCBX_MAX_APP_PROTOCOL 32
#define QED_MAX_PFC_PRIORITIES 8
#define QED_DCBX_DSCP_SIZE 64
struct qed_dcbx_lldp_remote {
u32 peer_chassis_id[QED_LLDP_CHASSIS_ID_STAT_LEN];
u32 peer_port_id[QED_LLDP_PORT_ID_STAT_LEN];
bool enable_rx;
bool enable_tx;
u32 tx_interval;
u32 max_credit;
};
struct qed_dcbx_lldp_local {
u32 local_chassis_id[QED_LLDP_CHASSIS_ID_STAT_LEN];
u32 local_port_id[QED_LLDP_PORT_ID_STAT_LEN];
};
struct qed_dcbx_app_prio {
u8 roce;
u8 roce_v2;
u8 fcoe;
u8 iscsi;
u8 eth;
};
struct qed_dbcx_pfc_params {
bool willing;
bool enabled;
u8 prio[QED_MAX_PFC_PRIORITIES];
u8 max_tc;
};
struct qed_app_entry {
bool ethtype;
bool enabled;
u8 prio;
u16 proto_id;
enum dcbx_protocol_type proto_type;
};
struct qed_dcbx_params {
struct qed_app_entry app_entry[QED_DCBX_MAX_APP_PROTOCOL];
u16 num_app_entries;
bool app_willing;
bool app_valid;
bool app_error;
bool ets_willing;
bool ets_enabled;
bool ets_cbs;
bool valid;
u8 ets_pri_tc_tbl[QED_MAX_PFC_PRIORITIES];
u8 ets_tc_bw_tbl[QED_MAX_PFC_PRIORITIES];
u8 ets_tc_tsa_tbl[QED_MAX_PFC_PRIORITIES];
struct qed_dbcx_pfc_params pfc;
u8 max_ets_tc;
};
struct qed_dcbx_admin_params {
struct qed_dcbx_params params;
bool valid;
};
struct qed_dcbx_remote_params {
struct qed_dcbx_params params;
bool valid;
};
struct qed_dcbx_operational_params {
struct qed_dcbx_app_prio app_prio;
struct qed_dcbx_params params;
bool valid;
bool enabled;
bool ieee;
bool cee;
u32 err;
};
struct qed_dcbx_get {
struct qed_dcbx_operational_params operational;
struct qed_dcbx_lldp_remote lldp_remote;
struct qed_dcbx_lldp_local lldp_local;
struct qed_dcbx_remote_params remote;
struct qed_dcbx_admin_params local;
};
#endif
enum qed_led_mode {
QED_LED_MODE_OFF,
QED_LED_MODE_ON,