Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/gve/gve_main.c
| Show All 26 Lines | |||||
| * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||||
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| */ | */ | ||||
| #include "gve.h" | #include "gve.h" | ||||
| #include "gve_adminq.h" | #include "gve_adminq.h" | ||||
| #include "gve_dqo.h" | #include "gve_dqo.h" | ||||
| #define GVE_DRIVER_VERSION "GVE-FBSD-1.2.0\n" | #define GVE_DRIVER_VERSION "GVE-FBSD-1.3.0\n" | ||||
| #define GVE_VERSION_MAJOR 1 | #define GVE_VERSION_MAJOR 1 | ||||
| #define GVE_VERSION_MINOR 2 | #define GVE_VERSION_MINOR 3 | ||||
| #define GVE_VERSION_SUB 0 | #define GVE_VERSION_SUB 0 | ||||
| #define GVE_DEFAULT_RX_COPYBREAK 256 | #define GVE_DEFAULT_RX_COPYBREAK 256 | ||||
| /* Devices supported by this driver. */ | /* Devices supported by this driver. */ | ||||
| static struct gve_dev { | static struct gve_dev { | ||||
| uint16_t vendor_id; | uint16_t vendor_id; | ||||
| uint16_t device_id; | uint16_t device_id; | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | if (if_getcapenable(ifp) & IFCAP_TXCSUM) | ||||
| if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); | if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP, 0); | ||||
| if (if_getcapenable(ifp) & IFCAP_TXCSUM_IPV6) | if (if_getcapenable(ifp) & IFCAP_TXCSUM_IPV6) | ||||
| if_sethwassistbits(ifp, CSUM_IP6_TCP | CSUM_IP6_UDP, 0); | if_sethwassistbits(ifp, CSUM_IP6_TCP | CSUM_IP6_UDP, 0); | ||||
| if (if_getcapenable(ifp) & IFCAP_TSO4) | if (if_getcapenable(ifp) & IFCAP_TSO4) | ||||
| if_sethwassistbits(ifp, CSUM_IP_TSO, 0); | if_sethwassistbits(ifp, CSUM_IP_TSO, 0); | ||||
| if (if_getcapenable(ifp) & IFCAP_TSO6) | if (if_getcapenable(ifp) & IFCAP_TSO6) | ||||
| if_sethwassistbits(ifp, CSUM_IP6_TSO, 0); | if_sethwassistbits(ifp, CSUM_IP6_TSO, 0); | ||||
| if (gve_is_gqi(priv)) { | if (gve_is_qpl(priv)) { | ||||
| err = gve_register_qpls(priv); | err = gve_register_qpls(priv); | ||||
| if (err != 0) | if (err != 0) | ||||
| goto reset; | goto reset; | ||||
| } | } | ||||
| err = gve_create_rx_rings(priv); | err = gve_create_rx_rings(priv); | ||||
| if (err != 0) | if (err != 0) | ||||
| goto reset; | goto reset; | ||||
| Show All 35 Lines | gve_down(struct gve_priv *priv) | ||||
| if_setdrvflagbits(priv->ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); | if_setdrvflagbits(priv->ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); | ||||
| if (gve_destroy_rx_rings(priv) != 0) | if (gve_destroy_rx_rings(priv) != 0) | ||||
| goto reset; | goto reset; | ||||
| if (gve_destroy_tx_rings(priv) != 0) | if (gve_destroy_tx_rings(priv) != 0) | ||||
| goto reset; | goto reset; | ||||
| if (gve_is_gqi(priv)) { | if (gve_is_qpl(priv)) { | ||||
| if (gve_unregister_qpls(priv) != 0) | if (gve_unregister_qpls(priv) != 0) | ||||
| goto reset; | goto reset; | ||||
| } | } | ||||
| if (gve_is_gqi(priv)) | if (gve_is_gqi(priv)) | ||||
| gve_mask_all_queue_irqs(priv); | gve_mask_all_queue_irqs(priv); | ||||
| gve_clear_state_flag(priv, GVE_STATE_FLAG_QUEUES_UP); | gve_clear_state_flag(priv, GVE_STATE_FLAG_QUEUES_UP); | ||||
| priv->interface_down_cnt++; | priv->interface_down_cnt++; | ||||
| ▲ Show 20 Lines • Show All 181 Lines • ▼ Show 20 Lines | gve_setup_ifnet(device_t dev, struct gve_priv *priv) | ||||
| if_setdev(ifp, dev); | if_setdev(ifp, dev); | ||||
| if_setinitfn(ifp, gve_init); | if_setinitfn(ifp, gve_init); | ||||
| if_setioctlfn(ifp, gve_ioctl); | if_setioctlfn(ifp, gve_ioctl); | ||||
| if_settransmitfn(ifp, gve_xmit_ifp); | if_settransmitfn(ifp, gve_xmit_ifp); | ||||
| if_setqflushfn(ifp, gve_qflush); | if_setqflushfn(ifp, gve_qflush); | ||||
| /* | /* | ||||
| * Set TSO limits, must match the arguments to bus_dma_tag_create | * Set TSO limits, must match the arguments to bus_dma_tag_create | ||||
| * when creating tx->dqo.buf_dmatag | * when creating tx->dqo.buf_dmatag. Only applies to the RDA mode | ||||
| * because in QPL we copy the entire pakcet into the bounce buffer | |||||
| * and thus it does not matter how fragmented the mbuf is. | |||||
| */ | */ | ||||
| if (!gve_is_gqi(priv)) { | if (!gve_is_gqi(priv) && !gve_is_qpl(priv)) { | ||||
| if_sethwtsomax(ifp, GVE_TSO_MAXSIZE_DQO); | |||||
| if_sethwtsomaxsegcount(ifp, GVE_TX_MAX_DATA_DESCS_DQO); | if_sethwtsomaxsegcount(ifp, GVE_TX_MAX_DATA_DESCS_DQO); | ||||
| if_sethwtsomaxsegsize(ifp, GVE_TX_MAX_BUF_SIZE_DQO); | if_sethwtsomaxsegsize(ifp, GVE_TX_MAX_BUF_SIZE_DQO); | ||||
| } | } | ||||
| if_sethwtsomax(ifp, GVE_TSO_MAXSIZE_DQO); | |||||
| #if __FreeBSD_version >= 1400086 | #if __FreeBSD_version >= 1400086 | ||||
| if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); | if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); | ||||
| #else | #else | ||||
| if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_KNOWSEPOCH); | if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_KNOWSEPOCH); | ||||
| #endif | #endif | ||||
| ifmedia_init(&priv->media, IFM_IMASK, gve_media_change, gve_media_status); | ifmedia_init(&priv->media, IFM_IMASK, gve_media_change, gve_media_status); | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void | static void | ||||
| gve_free_rings(struct gve_priv *priv) | gve_free_rings(struct gve_priv *priv) | ||||
| { | { | ||||
| gve_free_irqs(priv); | gve_free_irqs(priv); | ||||
| gve_free_tx_rings(priv); | gve_free_tx_rings(priv); | ||||
| gve_free_rx_rings(priv); | gve_free_rx_rings(priv); | ||||
| if (gve_is_gqi(priv)) | if (gve_is_qpl(priv)) | ||||
| gve_free_qpls(priv); | gve_free_qpls(priv); | ||||
| } | } | ||||
| static int | static int | ||||
| gve_alloc_rings(struct gve_priv *priv) | gve_alloc_rings(struct gve_priv *priv) | ||||
| { | { | ||||
| int err; | int err; | ||||
| if (gve_is_gqi(priv)) { | if (gve_is_qpl(priv)) { | ||||
| err = gve_alloc_qpls(priv); | err = gve_alloc_qpls(priv); | ||||
| if (err != 0) | if (err != 0) | ||||
| goto abort; | goto abort; | ||||
| } | } | ||||
| err = gve_alloc_rx_rings(priv); | err = gve_alloc_rx_rings(priv); | ||||
| if (err != 0) | if (err != 0) | ||||
| goto abort; | goto abort; | ||||
| ▲ Show 20 Lines • Show All 417 Lines • Show Last 20 Lines | |||||