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.3.2\n" | #define GVE_DRIVER_VERSION "GVE-FBSD-1.3.3\n" | ||||
| #define GVE_VERSION_MAJOR 1 | #define GVE_VERSION_MAJOR 1 | ||||
| #define GVE_VERSION_MINOR 3 | #define GVE_VERSION_MINOR 3 | ||||
| #define GVE_VERSION_SUB 2 | #define GVE_VERSION_SUB 3 | ||||
| #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; | ||||
| const char *name; | const char *name; | ||||
| ▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | gve_adjust_tx_queues(struct gve_priv *priv, uint16_t new_queue_cnt) | ||||
| } | } | ||||
| priv->tx_cfg.num_queues = new_queue_cnt; | priv->tx_cfg.num_queues = new_queue_cnt; | ||||
| err = gve_up(priv); | err = gve_up(priv); | ||||
| if (err != 0) | if (err != 0) | ||||
| gve_schedule_reset(priv); | gve_schedule_reset(priv); | ||||
| return (err); | return (err); | ||||
| } | |||||
| int | |||||
| gve_adjust_ring_sizes(struct gve_priv *priv, uint16_t new_desc_cnt, bool is_rx) | |||||
| { | |||||
| int err; | |||||
| uint16_t prev_desc_cnt; | |||||
| GVE_IFACE_LOCK_ASSERT(priv->gve_iface_lock); | |||||
| gve_down(priv); | |||||
| if (is_rx) { | |||||
| gve_free_rx_rings(priv, 0, priv->rx_cfg.num_queues); | |||||
| prev_desc_cnt = priv->rx_desc_cnt; | |||||
| priv->rx_desc_cnt = new_desc_cnt; | |||||
| err = gve_alloc_rx_rings(priv, 0, priv->rx_cfg.num_queues); | |||||
| if (err != 0) { | |||||
| device_printf(priv->dev, | |||||
| "Failed to allocate rings. Trying to start back up with previous ring size."); | |||||
| priv->rx_desc_cnt = prev_desc_cnt; | |||||
| err = gve_alloc_rx_rings(priv, 0, priv->rx_cfg.num_queues); | |||||
| } | |||||
| } else { | |||||
| gve_free_tx_rings(priv, 0, priv->tx_cfg.num_queues); | |||||
| prev_desc_cnt = priv->tx_desc_cnt; | |||||
| priv->tx_desc_cnt = new_desc_cnt; | |||||
| err = gve_alloc_tx_rings(priv, 0, priv->tx_cfg.num_queues); | |||||
| if (err != 0) { | |||||
| device_printf(priv->dev, | |||||
| "Failed to allocate rings. Trying to start back up with previous ring size."); | |||||
| priv->tx_desc_cnt = prev_desc_cnt; | |||||
| err = gve_alloc_tx_rings(priv, 0, priv->tx_cfg.num_queues); | |||||
| } | |||||
| } | |||||
| if (err != 0) { | |||||
| device_printf(priv->dev, "Failed to allocate rings! Cannot start device back up!"); | |||||
| return (err); | |||||
markj: Is this gve_down() call needed, given that we already bought the interface down? | |||||
| } | |||||
| err = gve_up(priv); | |||||
| if (err != 0) { | |||||
| gve_schedule_reset(priv); | |||||
| return (err); | |||||
| } | |||||
| return (0); | |||||
| } | } | ||||
| static int | static int | ||||
| gve_set_mtu(if_t ifp, uint32_t new_mtu) | gve_set_mtu(if_t ifp, uint32_t new_mtu) | ||||
| { | { | ||||
| struct gve_priv *priv = if_getsoftc(ifp); | struct gve_priv *priv = if_getsoftc(ifp); | ||||
| const uint32_t max_problem_range = 8227; | const uint32_t max_problem_range = 8227; | ||||
| const uint32_t min_problem_range = 7822; | const uint32_t min_problem_range = 7822; | ||||
| ▲ Show 20 Lines • Show All 759 Lines • Show Last 20 Lines | |||||
Is this gve_down() call needed, given that we already bought the interface down?