Skip to content

Commit

Permalink
Merge branch 'sunvnet-jumbograms'
Browse files Browse the repository at this point in the history
David L Stevens says:

====================
sunvnet: add jumbo frames support

This patch set updates the sunvnet driver to version 1.6 of the VIO protocol
to support per-port exchange of MTU information and allow non-standard MTU
sizes, including jumbo frames.

Using large MTUs shows a nearly 5X throughput improvement Linux-Solaris
and > 10X throughput improvement Linux-Linux.

Changes from v8:
	-add a short timeout to free pending skbs if a new transmit doesn't
	 do it first per Dave Miller <davem@davemloft.net>
Changes from v7:
	-handle skb allocation failures in vnet_skb_shape()
	 per Dave Miller <davem@davemloft.net>
Changes from v6:
	-made kernel transmit path zero-copy to remove memory n^2 scaling issue
	 raised by Raghuram Kothakota <Raghuram.Kothakota@oracle.com>
Changes from v5:
	- fixed comment per Sowmini Varadhan <sowmini.varadhan@oracle.com>
Changes from v4:
	- changed VNET_MAXPACKET per David Laight <David.Laight@ACULAB.COM>
	- added cookies to support non-contiguous buffers of max size
Changes from v3:
	- added version functions per Dave Miller <davem@davemloft.net>
	- moved rmtu to vnet_port per Dave Miller <davem@davemloft.net>
	- explicitly set options bits and capability flags to 0 per
		Raghuram Kothakota <Raghuram.Kothakota@oracle.com>
Changes from v2:
	- make checkpatch clean
Changes from v1:
	- fix brace formatting per Dave Miller <davem@davemloft.net>
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Sep 30, 2014
2 parents a12a601 + a2b78e9 commit 09bba1c
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 68 deletions.
44 changes: 42 additions & 2 deletions arch/sparc/include/asm/vio.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct vio_dring_register {
u16 options;
#define VIO_TX_DRING 0x0001
#define VIO_RX_DRING 0x0002
#define VIO_RX_DRING_DATA 0x0004
u16 resv;
u32 num_cookies;
struct ldc_trans_cookie cookies[0];
Expand All @@ -80,6 +81,8 @@ struct vio_dring_unregister {
#define VIO_PKT_MODE 0x01 /* Packet based transfer */
#define VIO_DESC_MODE 0x02 /* In-band descriptors */
#define VIO_DRING_MODE 0x03 /* Descriptor rings */
/* in vers >= 1.2, VIO_DRING_MODE is 0x04 and transfer mode is a bitmask */
#define VIO_NEW_DRING_MODE 0x04

struct vio_dring_data {
struct vio_msg_tag tag;
Expand Down Expand Up @@ -205,10 +208,20 @@ struct vio_net_attr_info {
u8 addr_type;
#define VNET_ADDR_ETHERMAC 0x01
u16 ack_freq;
u32 resv1;
u8 plnk_updt;
#define PHYSLINK_UPDATE_NONE 0x00
#define PHYSLINK_UPDATE_STATE 0x01
#define PHYSLINK_UPDATE_STATE_ACK 0x02
#define PHYSLINK_UPDATE_STATE_NACK 0x03
u8 options;
u16 resv1;
u64 addr;
u64 mtu;
u64 resv2[3];
u16 cflags;
#define VNET_LSO_IPV4_CAPAB 0x0001
u16 ipv4_lso_maxlen;
u32 resv2;
u64 resv3[2];
};

#define VNET_NUM_MCAST 7
Expand Down Expand Up @@ -366,6 +379,33 @@ struct vio_driver_state {
struct vio_driver_ops *ops;
};

static inline bool vio_version_before(struct vio_driver_state *vio,
u16 major, u16 minor)
{
u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
u32 want = (u32)major << 16 | minor;

return have < want;
}

static inline bool vio_version_after(struct vio_driver_state *vio,
u16 major, u16 minor)
{
u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
u32 want = (u32)major << 16 | minor;

return have > want;
}

static inline bool vio_version_after_eq(struct vio_driver_state *vio,
u16 major, u16 minor)
{
u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
u32 want = (u32)major << 16 | minor;

return have >= want;
}

#define viodbg(TYPE, f, a...) \
do { if (vio->debug & VIO_DEBUG_##TYPE) \
printk(KERN_INFO "vio: ID[%lu] " f, \
Expand Down
2 changes: 1 addition & 1 deletion arch/sparc/kernel/ldc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2159,7 +2159,7 @@ int ldc_map_single(struct ldc_channel *lp,
state.pte_idx = (base - iommu->page_table);
state.nc = 0;
fill_cookies(&state, (pa & PAGE_MASK), (pa & ~PAGE_MASK), len);
BUG_ON(state.nc != 1);
BUG_ON(state.nc > ncookies);

return state.nc;
}
Expand Down
14 changes: 12 additions & 2 deletions arch/sparc/kernel/viohs.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,13 @@ static int process_dreg_info(struct vio_driver_state *vio,
if (vio->dr_state & VIO_DR_STATE_RXREG)
goto send_nack;

/* v1.6 and higher, ACK with desired, supported mode, or NACK */
if (vio_version_after_eq(vio, 1, 6)) {
if (!(pkt->options & VIO_TX_DRING))
goto send_nack;
pkt->options = VIO_TX_DRING;
}

BUG_ON(vio->desc_buf);

vio->desc_buf = kzalloc(pkt->descr_size, GFP_ATOMIC);
Expand Down Expand Up @@ -453,8 +460,11 @@ static int process_dreg_info(struct vio_driver_state *vio,
pkt->tag.stype = VIO_SUBTYPE_ACK;
pkt->dring_ident = ++dr->ident;

viodbg(HS, "SEND DRING_REG ACK ident[%llx]\n",
(unsigned long long) pkt->dring_ident);
viodbg(HS, "SEND DRING_REG ACK ident[%llx] "
"ndesc[%u] dsz[%u] opt[0x%x] ncookies[%u]\n",
(unsigned long long) pkt->dring_ident,
pkt->num_descr, pkt->descr_size, pkt->options,
pkt->num_cookies);

len = (sizeof(*pkt) +
(dr->ncookies * sizeof(struct ldc_trans_cookie)));
Expand Down
Loading

0 comments on commit 09bba1c

Please sign in to comment.