On 13/07/2016 3:54 AM, Brenden Blanco wrote:
On Tue, Jul 12, 2016 at 02:18:32PM -0700, David Miller wrote:
From: Brenden Blanco <bbla...@plumgrid.com>
Date: Tue, 12 Jul 2016 00:51:29 -0700
+ mlx4_en_free_resources(priv);
+
old_prog = xchg(&priv->prog, prog);
if (old_prog)
bpf_prog_put(old_prog);
- return 0;
+ err = mlx4_en_alloc_resources(priv);
+ if (err) {
+ en_err(priv, "Failed reallocating port resources\n");
+ goto out;
+ }
+ if (port_up) {
+ err = mlx4_en_start_port(dev);
+ if (err)
+ en_err(priv, "Failed starting port\n");
A failed configuration operation should _NEVER_ leave the interface in
an inoperative state like these error paths do.
You must instead preallocate the necessary resources, and only change
the chip's configuration and commit to the new settings once you have
successfully allocated those resources.
I'll see what I can do here.
That's exactly what we're doing in a patchset that will be submitted to
net very soon (this week).
It fixes/refactors these failure flows just like Dave described,
something like:
err = mlx4_en_try_alloc_resources(priv, tmp, &new_prof);
if (err)
goto out;
if (priv->port_up) {
port_up = 1;
mlx4_en_stop_port(dev, 1);
}
mlx4_en_safe_replace_resources(priv, tmp);
if (port_up) {
err = mlx4_en_start_port(dev);
if (err)
en_err(priv, "Failed starting port\n");
}
I suggest you keep your code aligned with current net-next driver, and
later I will take it and fix it (once merged with net).
Regards,
Tariq