Skip to content

Commit

Permalink
enic: Add api for link down count and to get firmware notification st…
Browse files Browse the repository at this point in the history
…atus.

Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Scott Feldman authored and David S. Miller committed Feb 10, 2009
1 parent 68f7170 commit 4cdc44a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
2 changes: 0 additions & 2 deletions drivers/net/enic/enic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,6 @@ static int __devinit enic_probe(struct pci_dev *pdev,
if (using_dac)
netdev->features |= NETIF_F_HIGHDMA;


enic->csum_rx_enabled = ENIC_SETTING(enic, RXCSUM);

enic->lro_mgr.max_aggr = ENIC_LRO_MAX_AGGR;
Expand All @@ -1878,7 +1877,6 @@ static int __devinit enic_probe(struct pci_dev *pdev,
enic->lro_mgr.ip_summed = CHECKSUM_COMPLETE;
enic->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;


err = register_netdev(netdev);
if (err) {
printk(KERN_ERR PFX
Expand Down
33 changes: 29 additions & 4 deletions drivers/net/enic/vnic_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ struct vnic_res {
unsigned int count;
};

#define VNIC_DEV_CAP_INIT 0x0001
#define VNIC_DEV_CAP_PERBI 0x0002

struct vnic_dev {
void *priv;
struct pci_dev *pdev;
Expand All @@ -50,6 +53,7 @@ struct vnic_dev {
dma_addr_t stats_pa;
struct vnic_devcmd_fw_info *fw_info;
dma_addr_t fw_info_pa;
u32 cap_flags;
};

#define VNIC_MAX_RES_HDR_SIZE \
Expand Down Expand Up @@ -575,9 +579,9 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)
{
u64 a0 = (u32)arg, a1 = 0;
int wait = 1000;
int r = 0;
int r = 0;

if (vnic_dev_capable(vdev, CMD_INIT))
if (vdev->cap_flags & VNIC_DEV_CAP_INIT)
r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait);
else {
vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait);
Expand All @@ -587,8 +591,8 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)
vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait);
vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
}
}
return r;
}
return r;
}

int vnic_dev_link_status(struct vnic_dev *vdev)
Expand Down Expand Up @@ -626,6 +630,22 @@ u32 vnic_dev_mtu(struct vnic_dev *vdev)
return vdev->notify_copy.mtu;
}

u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev)
{
if (!vnic_dev_notify_ready(vdev))
return 0;

return vdev->notify_copy.link_down_cnt;
}

u32 vnic_dev_notify_status(struct vnic_dev *vdev)
{
if (!vnic_dev_notify_ready(vdev))
return 0;

return vdev->notify_copy.status;
}

void vnic_dev_set_intr_mode(struct vnic_dev *vdev,
enum vnic_dev_intr_mode intr_mode)
{
Expand Down Expand Up @@ -682,6 +702,11 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
if (!vdev->devcmd)
goto err_out;

vdev->cap_flags = 0;

if (vnic_dev_capable(vdev, CMD_INIT))
vdev->cap_flags |= VNIC_DEV_CAP_INIT;

return vdev;

err_out:
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/enic/vnic_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ int vnic_dev_link_status(struct vnic_dev *vdev);
u32 vnic_dev_port_speed(struct vnic_dev *vdev);
u32 vnic_dev_msg_lvl(struct vnic_dev *vdev);
u32 vnic_dev_mtu(struct vnic_dev *vdev);
u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev);
u32 vnic_dev_notify_status(struct vnic_dev *vdev);
int vnic_dev_close(struct vnic_dev *vdev);
int vnic_dev_enable(struct vnic_dev *vdev);
int vnic_dev_disable(struct vnic_dev *vdev);
Expand Down
8 changes: 7 additions & 1 deletion drivers/net/enic/vnic_devcmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ enum vnic_devcmd_cmd {
CMD_INIT_STATUS = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 31),

/* INT13 API: (u64)a0=paddr to vnic_int13_params struct
* (u8)a1=INT13_CMD_xxx */
* (u32)a1=INT13_CMD_xxx */
CMD_INT13 = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_FC, 32),

/* logical uplink enable/disable: (u64)a0: 0/1=disable/enable */
Expand All @@ -207,6 +207,11 @@ enum vnic_devcmd_cmd {
* in: (u32)a0=cmd
* out: (u32)a0=errno, 0:valid cmd, a1=supported VNIC_STF_* bits */
CMD_CAPABILITY = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 36),

/* persistent binding info
* in: (u64)a0=paddr of arg
* (u32)a1=CMD_PERBI_XXX */
CMD_PERBI = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 37),
};

/* flags for CMD_OPEN */
Expand Down Expand Up @@ -259,6 +264,7 @@ struct vnic_devcmd_notify {
u32 status; /* status bits (see VNIC_STF_*) */
u32 error; /* error code (see ERR_*) for first ERR */
u32 link_down_cnt; /* running count of link down transitions */
u32 perbi_rebuild_cnt; /* running count of perbi rebuilds */
};
#define VNIC_STF_FATAL_ERR 0x0001 /* fatal fw error */
#define VNIC_STF_STD_PAUSE 0x0002 /* standard link-level pause on */
Expand Down

0 comments on commit 4cdc44a

Please sign in to comment.