|
@@ -35,6 +35,7 @@
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
|
|
#include <linux/mlx4/cmd.h>
|
|
|
+#include <linux/mlx4/qp.h>
|
|
|
#include <linux/export.h>
|
|
|
|
|
|
#include "mlx4.h"
|
|
@@ -985,16 +986,21 @@ int mlx4_flow_attach(struct mlx4_dev *dev,
|
|
|
if (IS_ERR(mailbox))
|
|
|
return PTR_ERR(mailbox);
|
|
|
|
|
|
+ if (!mlx4_qp_lookup(dev, rule->qpn)) {
|
|
|
+ mlx4_err_rule(dev, "QP doesn't exist\n", rule);
|
|
|
+ ret = -EINVAL;
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
+
|
|
|
trans_rule_ctrl_to_hw(rule, mailbox->buf);
|
|
|
|
|
|
size += sizeof(struct mlx4_net_trans_rule_hw_ctrl);
|
|
|
|
|
|
list_for_each_entry(cur, &rule->list, list) {
|
|
|
ret = parse_trans_rule(dev, cur, mailbox->buf + size);
|
|
|
- if (ret < 0) {
|
|
|
- mlx4_free_cmd_mailbox(dev, mailbox);
|
|
|
- return ret;
|
|
|
- }
|
|
|
+ if (ret < 0)
|
|
|
+ goto out;
|
|
|
+
|
|
|
size += ret;
|
|
|
}
|
|
|
|
|
@@ -1021,6 +1027,7 @@ int mlx4_flow_attach(struct mlx4_dev *dev,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+out:
|
|
|
mlx4_free_cmd_mailbox(dev, mailbox);
|
|
|
|
|
|
return ret;
|