Thu Apr 23 15:06:50 2020 UTC ()
also let backend know that feature-ipv6-csum-offload is supported


(jdolecek)
diff -r1.115 -r1.116 src/sys/arch/xen/xen/if_xennet_xenbus.c

cvs diff -r1.115 -r1.116 src/sys/arch/xen/xen/if_xennet_xenbus.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/if_xennet_xenbus.c 2020/04/23 14:54:48 1.115
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c 2020/04/23 15:06:49 1.116
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_xennet_xenbus.c,v 1.115 2020/04/23 14:54:48 jdolecek Exp $ */ 1/* $NetBSD: if_xennet_xenbus.c,v 1.116 2020/04/23 15:06:49 jdolecek Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -71,27 +71,27 @@ @@ -71,27 +71,27 @@
71 * Purpose is to process the packets received from the outside. RX buffers 71 * Purpose is to process the packets received from the outside. RX buffers
72 * are pre-allocated through xennet_alloc_rx_buffer(), during xennet autoconf 72 * are pre-allocated through xennet_alloc_rx_buffer(), during xennet autoconf
73 * attach. During pre-allocation, frontend pushes requests in the I/O ring, in 73 * attach. During pre-allocation, frontend pushes requests in the I/O ring, in
74 * preparation for incoming packets from backend. 74 * preparation for incoming packets from backend.
75 * When RX packets need to be processed, backend takes the requests previously 75 * When RX packets need to be processed, backend takes the requests previously
76 * offered by frontend and pushes the associated responses inside the I/O ring. 76 * offered by frontend and pushes the associated responses inside the I/O ring.
77 * When done, it notifies frontend through an event notification, which will 77 * When done, it notifies frontend through an event notification, which will
78 * asynchronously call xennet_handler() in frontend. 78 * asynchronously call xennet_handler() in frontend.
79 * xennet_handler() processes the responses, generates the associated mbuf, and 79 * xennet_handler() processes the responses, generates the associated mbuf, and
80 * passes it to the MI layer for further processing. 80 * passes it to the MI layer for further processing.
81 */ 81 */
82 82
83#include <sys/cdefs.h> 83#include <sys/cdefs.h>
84__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.115 2020/04/23 14:54:48 jdolecek Exp $"); 84__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.116 2020/04/23 15:06:49 jdolecek Exp $");
85 85
86#include "opt_xen.h" 86#include "opt_xen.h"
87#include "opt_nfs_boot.h" 87#include "opt_nfs_boot.h"
88 88
89#include <sys/param.h> 89#include <sys/param.h>
90#include <sys/device.h> 90#include <sys/device.h>
91#include <sys/conf.h> 91#include <sys/conf.h>
92#include <sys/kernel.h> 92#include <sys/kernel.h>
93#include <sys/proc.h> 93#include <sys/proc.h>
94#include <sys/systm.h> 94#include <sys/systm.h>
95#include <sys/intr.h> 95#include <sys/intr.h>
96#include <sys/rndsource.h> 96#include <sys/rndsource.h>
97 97
@@ -566,26 +566,32 @@ again: @@ -566,26 +566,32 @@ again:
566 error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, 566 error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path,
567 "request-rx-copy", "%lu", rx_copy); 567 "request-rx-copy", "%lu", rx_copy);
568 if (error) { 568 if (error) {
569 errmsg = "writing request-rx-copy"; 569 errmsg = "writing request-rx-copy";
570 goto abort_transaction; 570 goto abort_transaction;
571 } 571 }
572 error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, 572 error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path,
573 "feature-rx-notify", "%u", 1); 573 "feature-rx-notify", "%u", 1);
574 if (error) { 574 if (error) {
575 errmsg = "writing feature-rx-notify"; 575 errmsg = "writing feature-rx-notify";
576 goto abort_transaction; 576 goto abort_transaction;
577 } 577 }
578 error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path, 578 error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path,
 579 "feature-ipv6-csum-offload", "%u", 1);
 580 if (error) {
 581 errmsg = "writing feature-ipv6-csum-offload";
 582 goto abort_transaction;
 583 }
 584 error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path,
579 "event-channel", "%u", sc->sc_evtchn); 585 "event-channel", "%u", sc->sc_evtchn);
580 if (error) { 586 if (error) {
581 errmsg = "writing event channel"; 587 errmsg = "writing event channel";
582 goto abort_transaction; 588 goto abort_transaction;
583 } 589 }
584 error = xenbus_transaction_end(xbt, 0); 590 error = xenbus_transaction_end(xbt, 0);
585 if (error == EAGAIN) 591 if (error == EAGAIN)
586 goto again; 592 goto again;
587 if (error) { 593 if (error) {
588 xenbus_dev_fatal(sc->sc_xbusd, error, "completing transaction"); 594 xenbus_dev_fatal(sc->sc_xbusd, error, "completing transaction");
589 return false; 595 return false;
590 } 596 }
591 mutex_enter(&sc->sc_rx_lock); 597 mutex_enter(&sc->sc_rx_lock);