Skip to content

Commit 09bba1c

Browse files
committed
Merge branch 'sunvnet-jumbograms'
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>
2 parents a12a601 + a2b78e9 commit 09bba1c

File tree

5 files changed

+366
-68
lines changed

5 files changed

+366
-68
lines changed

arch/sparc/include/asm/vio.h

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct vio_dring_register {
6565
u16 options;
6666
#define VIO_TX_DRING 0x0001
6767
#define VIO_RX_DRING 0x0002
68+
#define VIO_RX_DRING_DATA 0x0004
6869
u16 resv;
6970
u32 num_cookies;
7071
struct ldc_trans_cookie cookies[0];
@@ -80,6 +81,8 @@ struct vio_dring_unregister {
8081
#define VIO_PKT_MODE 0x01 /* Packet based transfer */
8182
#define VIO_DESC_MODE 0x02 /* In-band descriptors */
8283
#define VIO_DRING_MODE 0x03 /* Descriptor rings */
84+
/* in vers >= 1.2, VIO_DRING_MODE is 0x04 and transfer mode is a bitmask */
85+
#define VIO_NEW_DRING_MODE 0x04
8386

8487
struct vio_dring_data {
8588
struct vio_msg_tag tag;
@@ -205,10 +208,20 @@ struct vio_net_attr_info {
205208
u8 addr_type;
206209
#define VNET_ADDR_ETHERMAC 0x01
207210
u16 ack_freq;
208-
u32 resv1;
211+
u8 plnk_updt;
212+
#define PHYSLINK_UPDATE_NONE 0x00
213+
#define PHYSLINK_UPDATE_STATE 0x01
214+
#define PHYSLINK_UPDATE_STATE_ACK 0x02
215+
#define PHYSLINK_UPDATE_STATE_NACK 0x03
216+
u8 options;
217+
u16 resv1;
209218
u64 addr;
210219
u64 mtu;
211-
u64 resv2[3];
220+
u16 cflags;
221+
#define VNET_LSO_IPV4_CAPAB 0x0001
222+
u16 ipv4_lso_maxlen;
223+
u32 resv2;
224+
u64 resv3[2];
212225
};
213226

214227
#define VNET_NUM_MCAST 7
@@ -366,6 +379,33 @@ struct vio_driver_state {
366379
struct vio_driver_ops *ops;
367380
};
368381

382+
static inline bool vio_version_before(struct vio_driver_state *vio,
383+
u16 major, u16 minor)
384+
{
385+
u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
386+
u32 want = (u32)major << 16 | minor;
387+
388+
return have < want;
389+
}
390+
391+
static inline bool vio_version_after(struct vio_driver_state *vio,
392+
u16 major, u16 minor)
393+
{
394+
u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
395+
u32 want = (u32)major << 16 | minor;
396+
397+
return have > want;
398+
}
399+
400+
static inline bool vio_version_after_eq(struct vio_driver_state *vio,
401+
u16 major, u16 minor)
402+
{
403+
u32 have = (u32)vio->ver.major << 16 | vio->ver.minor;
404+
u32 want = (u32)major << 16 | minor;
405+
406+
return have >= want;
407+
}
408+
369409
#define viodbg(TYPE, f, a...) \
370410
do { if (vio->debug & VIO_DEBUG_##TYPE) \
371411
printk(KERN_INFO "vio: ID[%lu] " f, \

arch/sparc/kernel/ldc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,7 @@ int ldc_map_single(struct ldc_channel *lp,
21592159
state.pte_idx = (base - iommu->page_table);
21602160
state.nc = 0;
21612161
fill_cookies(&state, (pa & PAGE_MASK), (pa & ~PAGE_MASK), len);
2162-
BUG_ON(state.nc != 1);
2162+
BUG_ON(state.nc > ncookies);
21632163

21642164
return state.nc;
21652165
}

arch/sparc/kernel/viohs.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,13 @@ static int process_dreg_info(struct vio_driver_state *vio,
426426
if (vio->dr_state & VIO_DR_STATE_RXREG)
427427
goto send_nack;
428428

429+
/* v1.6 and higher, ACK with desired, supported mode, or NACK */
430+
if (vio_version_after_eq(vio, 1, 6)) {
431+
if (!(pkt->options & VIO_TX_DRING))
432+
goto send_nack;
433+
pkt->options = VIO_TX_DRING;
434+
}
435+
429436
BUG_ON(vio->desc_buf);
430437

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

456-
viodbg(HS, "SEND DRING_REG ACK ident[%llx]\n",
457-
(unsigned long long) pkt->dring_ident);
463+
viodbg(HS, "SEND DRING_REG ACK ident[%llx] "
464+
"ndesc[%u] dsz[%u] opt[0x%x] ncookies[%u]\n",
465+
(unsigned long long) pkt->dring_ident,
466+
pkt->num_descr, pkt->descr_size, pkt->options,
467+
pkt->num_cookies);
458468

459469
len = (sizeof(*pkt) +
460470
(dr->ncookies * sizeof(struct ldc_trans_cookie)));

0 commit comments

Comments
 (0)